Text-Lorem-0.3/0040755000076500007650000000000010030532653012623 5ustar adeolaadeolaText-Lorem-0.3/bin/0040755000076500007650000000000010030532653013373 5ustar adeolaadeolaText-Lorem-0.3/bin/lorem0100644000076500007650000000227310030532653014435 0ustar adeolaadeola#!/usr/bin/perl -w use strict; use vars qw($opt_v $opt_w $opt_s $opt_p); use Getopt::Std; use Text::Lorem; getopts("vw:s:p:"); if ($opt_v) { print usage(); exit 0; } die usage() if ((defined($opt_w) + defined($opt_s) + defined($opt_p)) > 1); my $lorem = Text::Lorem->new; if ($opt_w) { print $lorem->words($opt_w); } elsif ($opt_s) { print $lorem->sentences($opt_s); } elsif ($opt_p) { print $lorem->paragraphs($opt_p); } else { print $lorem->paragraphs(1); } sub usage { return < is a simple command-line wrapper around the C module. It provides the same three basic methods: Generate C, generate C, and generate C. Text-Lorem-0.3/Build.PL0100644000076500007650000000053210030532653014114 0ustar adeolaadeola#!/usr/bin/perl use Module::Build; # See perldoc Module::Build for details of how this works Module::Build->new( module_name => 'Text::Lorem', license => 'perl', build_requires => { Test::More => 0, }, create_makefile_pl => 'passthrough' )->create_build_script; Text-Lorem-0.3/CHANGES0100644000076500007650000000025210030532653013612 0ustar adeolaadeola0.2 2004-01-12 + Added support for creating multiple instances of the Text::Lorem object. 0.3 2004-03-25 + Added command line utility submitted by Darren Chamberlain Text-Lorem-0.3/INSTALL0100644000076500007650000000037410030532653013655 0ustar adeolaadeolaTo install Text::Lorem, you need Module::Build installed. The included Makefile.PL will prompt you to use CPAN.pm to install it if you don't already have it. The installation process: perl Build.PL ./Build ./Build test ./Build installText-Lorem-0.3/lib/0040755000076500007650000000000010030532653013371 5ustar adeolaadeolaText-Lorem-0.3/lib/Text/0040755000076500007650000000000010030532653014315 5ustar adeolaadeolaText-Lorem-0.3/lib/Text/Lorem.pm0100644000076500007650000001047210030532653015732 0ustar adeolaadeolapackage Text::Lorem; use strict; use warnings; use vars qw($VERSION); $VERSION = "0.3"; my $lorem_singleton; sub new { my $class = shift; $lorem_singleton ||= bless {},$class; return $lorem_singleton; } sub generate_wordlist { my $self = shift; [ map { s/\W//; lc($_) }split(/\s+/, ) ]; } sub wordlist { my $self = shift; $self->{ wordlist } ||= $self->generate_wordlist(); } sub wordcount { my $self = shift; return scalar(@{$self->{ wordlist }}); } sub get_word { my $self = shift; return $self->wordlist->[ int( rand( $self->wordcount ) ) ]; } sub words { my $self = shift; my $num = shift; my @words; push @words, $self->get_word() for (1..$num); return join(' ', @words); } sub get_sentence { my $self = shift; my $words = $self->words( 4 + int( rand( 6 ) ) ); ucfirst( $words ); } sub sentences { my $self = shift; my $num = shift; my @sentences; push @sentences, $self->get_sentence for (1..$num); join( '. ', @sentences ) . '.'; } sub get_paragraph { my $self = shift; my $sentences = $self->sentences(3 + int( rand( 4 ) ) ); } sub paragraphs { my $self = shift; my $num = shift; my @paragraphs; push @paragraphs, $self->get_paragraph for (1..$num); join( "\n\n", @paragraphs ); } 1; =pod =head1 NAME Text::Lorem - Generate random Latin looking text =head1 SYNOPSIS use Text::Lorem; my $text = Text::Lorem->new(); # Generate a string of text with 5 words $words = $text->words(5); # Generate a string of text with 2 sentences $sentences = $text->sentences(2); # Generate 3 paragraphs $paragraphs = $text->paragraphs(3); =head1 DESCRIPTION Often when developing a website or other application it's important to have placeholders for content. This module generates prescribed amounts of fake Latin text. =head1 CONSTRUCTOR =over 4 =item C The default constructor, C takes no arguments and returns a Text::Lorem object. =back =head1 METHODS =over 4 =item C Returns INTEGER fake Latin words. =item C Returns INTEGER sentences in fake Latin. =item C Returns INTEGER paragraphs of fake Latin text. =back =head1 THANKS Thanks to the guys who pushed me off the cliff called comfort and into the scary world of Perl: James Duncan, Leon Brocard. =head1 AUTHOR Adeola Awoyemi (adeola@fotango.com) =head1 SEE ALSO L and L =head1 COPYRIGHT Copyright 2003 Fotango Ltd. All rights reserved. L This software is released under the same license as Perl itself. =cut __DATA__ alias consequatur aut perferendis sit voluptatem accusantium doloremque aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis Nemo enim ipsam voluptatem quia voluptas sit suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae et iusto odio dignissimos ducimus qui blanditiis praesentium laudantium, totam rem voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, Sed ut perspiciatis unde omnis iste natus error similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo porro quisquam est, qui minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? At vero eos et accusamus officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores doloribus asperiores repellat. Text-Lorem-0.3/Makefile.PL0100644000076500007650000000206110030532653014571 0ustar adeolaadeola# Note: this file was auto-generated by Module::Build::Compat version 0.03 unless (eval "use Module::Build::Compat 0.02; 1" ) { print "This module requires Module::Build to install itself.\n"; require ExtUtils::MakeMaker; my $yn = ExtUtils::MakeMaker::prompt (' Install Module::Build now from CPAN?', 'y'); unless ($yn =~ /^y/i) { die " *** Cannot install without Module::Build. Exiting ...\n"; } require Cwd; require File::Spec; require CPAN; # Save this 'cause CPAN will chdir all over the place. my $cwd = Cwd::cwd(); my $makefile = File::Spec->rel2abs($0); CPAN::Shell->install('Module::Build::Compat') or die " *** Cannot install without Module::Build. Exiting ...\n"; chdir $cwd or die "Cannot chdir() back to $cwd: $!"; exec $^X, $makefile, @ARGV; # Redo now that we have Module::Build } Module::Build::Compat->run_build_pl(args => \@ARGV); Module::Build::Compat->write_makefile(build_class => 'Module::Build'); Text-Lorem-0.3/MANIFEST0100644000076500007650000000017010030532653013747 0ustar adeolaadeolabin/lorem Build.PL CHANGES INSTALL lib/Text/Lorem.pm Makefile.PL MANIFEST META.yml README t/01_words.t t/02_singleton.t Text-Lorem-0.3/META.yml0100644000076500007650000000044610030532653014075 0ustar adeolaadeola--- #YAML:1.0 name: Text-Lorem version: 0.3 author: - Adeola Awoyemi (adeola@fotango.com) abstract: Generate random Latin looking text license: perl build_requires: Test::More: 0 provides: Text::Lorem: file: lib/Text/Lorem.pm version: 0.3 generated_by: Module::Build version 0.24 Text-Lorem-0.3/README0100644000076500007650000000244310030532653013503 0ustar adeolaadeolaNAME Text::Lorem - Generate random latin looking text SYNOPSIS #!/usr/bin/perl use strict; use warnings; use Text::Lorem; my $text = Text::Lorem->new(); # Generate a string of text with 5 words $words = $text->words(5); # Generate a string of text with 2 sentences $sentences = $text->sentences(2); #Generate 3 paragraphs $paragraphs = $text->paragraphs(3); DESCRIPTION Often when developing a website its important to have placeholders for content. This module generates prescribed amounts of fake latin text. CONSTRUCTOR new() The default constructor, `new' takes no arguments and returns a Text::Lorem object. METHODS words( INTEGER ) Returns INTEGER fake latin words. sentences( INTEGER ) Returns INTEGER sentences in fake latin. paragraphs( INTEGER ) Returns INTEGER paragraphs of fake latin text. THANKS Thanks to the guys who pushed me off the cliff called comfort and into the scary world of Perl: james Duncan, Leon Brocard. AUTHOR Adeola Awoyemi (adeola@fotango.com) SEE ALSO WWW::Lipsum(3) and http://lipsum.com/ COPYRIGHT Copyright 2003 Fotango Ltd. All rights reserved. This software is released under the same license as Perl itself. Text-Lorem-0.3/t/0040755000076500007650000000000010030532653013066 5ustar adeolaadeolaText-Lorem-0.3/t/01_words.t0100644000076500007650000000113510030532653014706 0ustar adeolaadeola#!/usr/bin/perl use strict; use warnings; use Test::More tests => 8; use_ok("Text::Lorem"); ok( my $object = Text::Lorem->new(), "Made a new object" ); ok( my $words = $object->words(3), "Got some words" ); is( my @foo = split( /\s+/, $words ), 3, "There were 3 words" ); ok( my $sentences = $object->sentences(3), "Got some sentences" ); is( my @bar = split( /\./, $sentences ), 3, "There were 3 sentences" ); ok( my $paragraphs = $object->paragraphs(4), "Got some paragraphs" ); is( my @baz = split ( /\n\n/, $paragraphs ), 4, "There were 4 paragraphs" ); Text-Lorem-0.3/t/02_singleton.t0100644000076500007650000000060110030532653015550 0ustar adeolaadeola#!/usr/bin/perl use strict; use warnings; use Test::More tests => 5; use_ok("Text::Lorem"); ok( my $object = Text::Lorem->new(), "Made a new object" ); ok( my $words = $object->words(3), "Got some words" ); ok( my $object_bis = Text::Lorem->new(), "Made a new object" ); ok( my $words_bis = $object_bis->words(3), "Got some words" );