Text-Lorem-0.34/000755 000765 000024 00000000000 14016025123 013326 5ustar00adestaff000000 000000 Text-Lorem-0.34/bin/000755 000765 000024 00000000000 14016025122 014075 5ustar00adestaff000000 000000 Text-Lorem-0.34/CHANGES000644 000765 000024 00000001123 14016025047 014323 0ustar00adestaff000000 000000 0.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 0.31 2021-02-13 + Convert build to ExtUtils::MakeMaker + Remove INSTALL file + Add gitignore file 0.32 2021-02-19 + Update methods to return list or scalar context + Add tests for context, singleton, and new 0.33 2021-02-23 + Update author contact details and copyright + Added Github workflow to make sure tests are passing 0.34 2021-02-25 + Remove .github dir from MANIFEST + Update author in Makefile.PL Text-Lorem-0.34/MANIFEST000644 000765 000024 00000000237 14016025047 014466 0ustar00adestaff000000 000000 bin/lorem CHANGES lib/Text/Lorem.pm Makefile.PL MANIFEST META.json META.yml README t/01_new.t t/02_singleton.t t/03_words.t t/04_sentences.t t/05_paragraphs.t Text-Lorem-0.34/t/000755 000765 000024 00000000000 14016025122 013570 5ustar00adestaff000000 000000 Text-Lorem-0.34/README000644 000765 000024 00000003175 14015775622 014233 0ustar00adestaff000000 000000 NAME Text::Lorem - Generate random Latin looking text SYNOPSIS use Text::Lorem; my $text = Text::Lorem->new(); # Generate a string of text with 5 words $words = $text->words(5); # Generate a list of 5 words @words = $text->words(5); # Generate a string of text with 2 sentences $sentences = $text->sentences(2); # Generate a list of 2 sentences @sentences = $text->sentences(2); # Generate a string of text with 3 paragraphs $paragraphs = $text->paragraphs(3); # Generate a list of 3 paragraphs @paragraphs = $text->paragraphs(3); 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. CONSTRUCTOR "new()" The default constructor, "new()" takes no arguments and returns a Text::Lorem object. METHODS All methods below will return a string in scalar context or list in list context. "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@cpan.org) SEE ALSO L and L COPYRIGHT Copyright (c) 2003 by Adeola Awoyemi. This software is released under the same license as Perl itself. Text-Lorem-0.34/META.yml000644 000765 000024 00000001266 14016025123 014604 0ustar00adestaff000000 000000 --- abstract: 'Generate random Latin looking text' author: - 'Adeola Awoyemi ' build_requires: ExtUtils::MakeMaker: '6.46' Test::More: '0' configure_requires: ExtUtils::MakeMaker: '6.46' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Text-Lorem no_index: directory: - t - inc resources: bugtracker: https://github.com/adeolaawoyemi/Text-Lorem/issues repository: https://github.com/adeolaawoyemi/Text-Lorem.git version: '0.34' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' Text-Lorem-0.34/lib/000755 000765 000024 00000000000 14016025122 014073 5ustar00adestaff000000 000000 Text-Lorem-0.34/Makefile.PL000644 000765 000024 00000001553 14016025047 015311 0ustar00adestaff000000 000000 use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Text::Lorem', ABSTRACT_FROM => 'lib/Text/Lorem.pm', VERSION_FROM => 'lib/Text/Lorem.pm', BUILD_REQUIRES => { 'ExtUtils::MakeMaker' => '6.46', }, CONFIGURE_REQUIRES => { 'ExtUtils::MakeMaker' => '6.46', }, TEST_REQUIRES => { 'Test::More' => 0, }, META_MERGE => { 'meta-spec' => { version => 2 }, resources => { bugtracker => { web => 'https://github.com/adeolaawoyemi/Text-Lorem/issues', }, repository => { type => 'git', url => 'https://github.com/adeolaawoyemi/Text-Lorem.git', web => 'https://github.com/adeolaawoyemi/Text-Lorem', }, }, }, LICENSE => 'perl_5', AUTHOR => 'Adeola Awoyemi ', ); Text-Lorem-0.34/META.json000644 000765 000024 00000002343 14016025123 014751 0ustar00adestaff000000 000000 { "abstract" : "Generate random Latin looking text", "author" : [ "Adeola Awoyemi " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Text-Lorem", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "6.46" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.46" } }, "test" : { "requires" : { "Test::More" : "0" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/adeolaawoyemi/Text-Lorem/issues" }, "repository" : { "type" : "git", "url" : "https://github.com/adeolaawoyemi/Text-Lorem.git", "web" : "https://github.com/adeolaawoyemi/Text-Lorem" } }, "version" : "0.34", "x_serialization_backend" : "JSON::PP version 4.04" } Text-Lorem-0.34/lib/Text/000755 000765 000024 00000000000 14016025122 015017 5ustar00adestaff000000 000000 Text-Lorem-0.34/lib/Text/Lorem.pm000644 000765 000024 00000011274 14016025047 016446 0ustar00adestaff000000 000000 package Text::Lorem; use strict; use warnings; use vars qw($VERSION); $VERSION = "0.34"; my $lorem_singleton; sub new { my $class = shift; $lorem_singleton ||= bless {},$class; return $lorem_singleton; } sub generate_wordlist { my $self = shift; return [ map { s/\W//; lc($_) }split(/\s+/, ) ]; } sub wordlist { my $self = shift; return $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 wantarray ? @words : join ' ', @words; } sub get_sentence { my $self = shift; my $words = $self->words( 4 + int( rand( 6 ) ) ) . '.'; return ucfirst( $words ); } sub sentences { my $self = shift; my $num = shift; my @sentences; push @sentences, $self->get_sentence for (1..$num); return wantarray ? @sentences : join ' ', @sentences; } sub get_paragraph { my $self = shift; my $paragraph = $self->sentences(3 + int( rand( 4 ) ) ); return $paragraph; } sub paragraphs { my $self = shift; my $num = shift; my @paragraphs; push @paragraphs, $self->get_paragraph for (1..$num); return wantarray ? @paragraphs : 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 list of 5 words @words = $text->words(5); # Generate a string of text with 2 sentences $sentences = $text->sentences(2); # Generate a list of 2 sentences @sentences = $text->sentences(2); # Generate a string of text with 3 paragraphs $paragraphs = $text->paragraphs(3); # Generate a list of 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 All methods below will return a string in scalar context or list in list context. =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@cpan.org) =head1 SEE ALSO L and L =head1 COPYRIGHT Copyright (c) 2003 by Adeola Awoyemi. 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.34/t/02_singleton.t000644 000765 000024 00000000377 14015306206 016273 0ustar00adestaff000000 000000 use strict; use warnings; use Test::More; my $class = 'Text::Lorem'; use_ok($class); my $object = $class->new(); my $object_singleton = $class->new(); ok( $object_singleton == $object, 'new instance is a singleton of the original' ); done_testing(); Text-Lorem-0.34/t/01_new.t000644 000765 000024 00000000510 14015306206 015046 0ustar00adestaff000000 000000 use strict; use warnings; use Test::More; my $class = 'Text::Lorem'; use_ok($class); my $object = $class->new(); isa_ok( $object, $class ); my @methods = (qw{ new generate_wordlist wordlist wordcount get_word words get_sentence sentences get_paragraph paragraphs }); can_ok( $object, $_ ) foreach @methods; done_testing(); Text-Lorem-0.34/t/04_sentences.t000644 000765 000024 00000001012 14015306206 016245 0ustar00adestaff000000 000000 use strict; use warnings; use Test::More; my $class = 'Text::Lorem'; use_ok($class); SCALAR_CONTEXT: { note( 'scalar context' ); my $object = $class->new(); my $sentences = $object->sentences(3); is( split( /\./, $sentences ), 3, 'string contains the expected number of sentences' ); } LIST_CONTEXT: { note( 'list context' ); my $object = $class->new(); my @sentences = $object->sentences(3); is( @sentences, 3, 'array contains the expected number of sentences' ); } done_testing(); Text-Lorem-0.34/t/03_words.t000644 000765 000024 00000000753 14015306206 015426 0ustar00adestaff000000 000000 use strict; use warnings; use Test::More; my $class = 'Text::Lorem'; use_ok($class); SCALAR_CONTEXT: { note( 'scalar context' ); my $object = $class->new(); my $words = $object->words(3); is( split( /\s+/, $words ), 3, 'string contains the expected number of words' ); } LIST_CONTEXT: { note( 'list context' ); my $object = $class->new(); my @words = $object->words(3); is( @words, 3, 'array contains the expected number of words' ); } done_testing(); Text-Lorem-0.34/t/05_paragraphs.t000644 000765 000024 00000001024 14015306206 016412 0ustar00adestaff000000 000000 use strict; use warnings; use Test::More; my $class = 'Text::Lorem'; use_ok($class); SCALAR_CONTEXT: { note( 'scalar context' ); my $object = $class->new(); my $paragraphs = $object->paragraphs(3); is( split( /\n\n/, $paragraphs ), 3, 'string contains the expected number of paragraphs' ); } LIST_CONTEXT: { note( 'list context' ); my $object = $class->new(); my @paragraphs = $object->paragraphs(3); is( @paragraphs, 3, 'array contains the expected number of paragraphs' ); } done_testing(); Text-Lorem-0.34/bin/lorem000644 000765 000024 00000002273 14015306206 015146 0ustar00adestaff000000 000000 #!/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.