Text-Greeking-0.12/0000755000076500000240000000000011245546343012735 5ustar timastaffText-Greeking-0.12/.gitignore0000644000076500000240000000006711245541567014733 0ustar timastaff.DS_Store Makefile.old Makefile blib/ pm_to_blib *.bak Text-Greeking-0.12/.perltidyrc0000644000076500000240000000263111245537440015117 0ustar timastaff# Thanks to the Mojo team for an excellent .perltidyrc # From http://github.com/kraih/mojo/blob/685a370c882b1e7f22fde88f00eb222c14cbb2c2/.perltidyrc # Perl Best Practices (plus errata) .perltidyrc file -l=98 # Max line width is 98 cols -i=4 # Indent level is 4 cols -ci=4 # Continuation indent is 4 cols #-st # Output to STDOUT -se # Errors to STDERR -vt=2 # Maximal vertical tightness -cti=0 # No extra indentation for closing brackets -pt=1 # Medium parenthesis tightness -bt=1 # Medium brace tightness -sbt=1 # Medium square bracket tightness -bbt=1 # Medium block brace tightness -nsfs # No space before semicolons -nolq # Don't outdent long quoted strings -wbb="% + - * / x != == >= <= =~ < > | & **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=" # Break before all operators # extras/overrides/deviations from PBP --maximum-line-length=78 # be less generous --warning-output # Show warnings --maximum-consecutive-blank-lines=2 # default is 1 --nohanging-side-comments # troublesome for commented out code -isbc # block comments may only be indented if they have some space characters before the # -ci=2 # Continuation indent is 2 cols # we use version control, so just rewrite the file -b # for the up-tight folk :) -pt=2 # High parenthesis tightness -bt=2 # High brace tightness -sbt=2 # High square bracket tightness Text-Greeking-0.12/CHANGES0000644000076500000240000000062611245542772013736 0ustar timastaffRevision history for Perl extension Text::Greeking; 0.12 Aug 27 2009 - Applied patch to fix busted POD formatting. (Christine Spang) - Added proper standard units tests - Added lots of meta to Makefile.PL - Updated contact and copyright information - Ran perltidy of code 0.11 Mar 13 2005 - Fixed botched distribution. 0.1 Mar 13 2005 - Initial release into CPAN. Text-Greeking-0.12/lib/0000755000076500000240000000000011245546343013503 5ustar timastaffText-Greeking-0.12/lib/Text/0000755000076500000240000000000011245546343014427 5ustar timastaffText-Greeking-0.12/lib/Text/Greeking.pm0000644000076500000240000001607011245546162016523 0ustar timastaffpackage Text::Greeking; use strict; use warnings; use vars qw( $VERSION ); $VERSION = 0.12; # make controllable eventually. my @punc = split('', '..........??!'); my @inpunc = split('', ',,,,,,,,,,;;:'); push @inpunc, ' --'; sub new { my $class = shift; my $self = bless {}, $class; srand; $self->init; } sub init { $_[0]->sources([]); $_[0]->paragraphs(2, 8); $_[0]->sentences(2, 8); $_[0]->words(5, 15); $_[0]; } sub sources { $_[0]->{sources} = $_[1] if defined $_[1]; $_[0]->{sources}; } sub add_source { my ($self, $text) = @_; return unless $text; $text =~ s/[\n\r]/ /g; $text =~ s/[[:punct:]]//g; my @words = map { lc $_ } split /\s+/, $text; push @{$self->{sources}}, \@words; } sub generate { my $self = shift; my $out; $self->_load_default_source unless defined $self->{sources}->[0]; my @words = @{$self->{sources}->[int(rand(@{$self->{sources}}))]}; my ($paramin, $paramax) = @{$self->{paragraphs}}; my ($sentmin, $sentmax) = @{$self->{sentences}}; my ($phramin, $phramax) = @{$self->{words}}; my $pcount = int(rand($paramax - $paramin + 1) + $paramin); for (my $x = 0; $x < $pcount; $x++) { my $p; my $scount = int(rand($sentmax - $sentmin + 1) + $sentmin); for (my $y = 0; $y < $scount; $y++) { my $s; my $wcount = int(rand($phramax - $phramin + 1) + $phramin); for (my $w = 0; $w < $wcount; $w++) { my $word = $words[int(rand(@words))]; $s .= $s ? " $word" : ucfirst($word); $s .= (($w + 1 < $wcount) && !int(rand(10))) ? $inpunc[int(rand(@inpunc))] : ''; } $s .= $punc[int(rand(@punc))]; $p .= ' ' if $p; $p .= $s; } $out .= $p . "\n\n"; # assumes text. } $out; } sub paragraphs { $_[0]->{paragraphs} = [$_[1], $_[2]] } sub sentences { $_[0]->{sentences} = [$_[1], $_[2]] } sub words { $_[0]->{words} = [$_[1], $_[2]] } sub _load_default_source { my $text = <add_source($text); } 1; __END__ =begin pod =head1 NAME Text::Greeking - a module for generating meaningless text that creates the illusion of the finished document. =head1 SYNOPSIS #!/usr/bin/perl -w use strict; use Text::Greeking; my $g = Text::Greeking->new; $g->paragraphs(1,2) # min of 1 paragraph and a max of 2 $g->sentences(2,5) # min of 2 sentences per paragraph and a max of 5 $g->words(8,16) # min of 8 words per sentence and a max of 16 print $g->generate; # use default Lorem Ipsum source =head1 DESCRIPTION Greeking is the use of random letters or marks to show the overall appearance of a printed page without showing the actual text. Greeking is used to make it easy to judge the overall appearance of a document without being distracted by the meaning of the text. This is a module is for quickly generating varying meaningless text from any source to create this illusion of the content in systems. This module was created to quickly give developers simulated content to fill systems with simulated content. Instead of static Lorem Ipsum text, by using randomly generated text and optionally varying word sources, repetitive and monotonous patterns that do not represent real system usage is avoided. =head1 METHODS =over =item Text::Greeking->new Constructor method. Returns a new instance of the class. =item $g->init Initializes object with defaults. Called by the constructor. Broken out for easy overloading to enable customized defaults and other behaviour. =item $g->sources([\@ARRAY]) Gets/sets the table of source word collections current in memory as an ARRAY reference =item $g->add_source($text) The class takes a body of text passed as a SCALAR and processes it into a list of word tokens for use in generating random filler text later. =item $g->generate Returns a body of random text generated from a randomly selected source using the minimum and maximum values set by paragraphs, sentences, and words minimum and maximum values. If generate is called without any sources a standard Lorem Ipsum block is used added to the sources and then used for processing the random text. =item $g->paragraphs($min,$max) Sets the minimum and maximum number of paragraphs to generate. Default is a minimum of 2 and a maximum of 8. =item $g->sentences($min,$max) Sets the minimum and maximum number of sentences to generate per paragraph. Default is a minimum of 2 and a maximum of 8. =item $g->words($min,$max) Sets the minimum and maximum number of words to generate per sentence. Default is a minimum of 5 and a maximum of 15. =back =head1 SEE ALSO http://en.wikipedia.org/wiki/Greeking =head1 TO DO =over =item HTML output mode including random hyperlinked phrases. =item Configurable punctuation controls. =back =head1 PARTICIPATION I welcome and accept patches in diff format. If you wish to hack on this code, please fork the git repository found at: L. If you have something to push back to my repository, just use the "pull request" button on the github site. =head1 LICENSE The software is released under the Artistic License. The terms of the Artistic License are described at L. =head1 AUTHOR & COPYRIGHT Except where otherwise noted, Text::Greeking is Copyright 2005-2009, Timothy Appnel, tima@cpan.org. All rights reserved. =cut =end pod Text-Greeking-0.12/Makefile.PL0000644000076500000240000000124011245544131014675 0ustar timastaffuse ExtUtils::MakeMaker; use strict; WriteMakefile( 'NAME' => 'Text::Greeking', 'VERSION_FROM' => 'lib/Text/Greeking.pm', 'ABSTRACT_FROM' => 'lib/Text/Greeking.pm', 'MIN_PERL_VERSION' => '5.006', 'LICENSE' => 'perl', 'AUTHOR' => 'Timothy Appnel ', 'PREREQ_PM' => {}, 'META_MERGE' => { 'resources' => { 'license' => 'http://dev.perl.org/licenses/', 'repository' => 'http://github.com/tima/perl-text-greeking', 'bugtracker' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Text-Greeking', }, }, ); Text-Greeking-0.12/MANIFEST0000644000076500000240000000033511245544355014070 0ustar timastaff.gitignore .perltidyrc CHANGES lib/Text/Greeking.pm Makefile.PL MANIFEST This list of files MANIFEST.SKIP META.yml README t/01_compile.t t/90_perltidy.t t/96_manifest.t t/97_meta.t t/98_pod_syntax.t t/99_pod_coverage.t Text-Greeking-0.12/MANIFEST.SKIP0000644000076500000240000000012511245544315014626 0ustar timastaff\.git[^i] \.old$ \.bak$ ^build #^MANIFEST ^Makefile$ #^t\b test ^\._ blib pm_to_blib Text-Greeking-0.12/META.yml0000644000076500000240000000135611245546343014213 0ustar timastaff--- #YAML:1.0 name: Text-Greeking version: 0.12 abstract: a module for generating meaningless text author: - Timothy Appnel license: perl distribution_type: module configure_requires: ExtUtils::MakeMaker: 0 build_requires: ExtUtils::MakeMaker: 0 requires: perl: 5.006 resources: bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Text-Greeking license: http://dev.perl.org/licenses/ repository: http://github.com/tima/perl-text-greeking no_index: directory: - t - inc generated_by: ExtUtils::MakeMaker version 6.54 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 Text-Greeking-0.12/README0000644000076500000240000000102511245544204013605 0ustar timastaffText::Greeking is a module for generating meaningless text that creates the illusion of the finished document. INSTALLATION To install this module type the following: perl Makefile.PL make make test make install COPYRIGHT AND LICENCE The software is released under the Artistic License. The terms of the Artistic License are described at http://www.perl.com/language/misc/Artistic.html. Except where otherwise noted, Text::Greeking is Copyright 2005-2009, Timothy Appnel, tima@cpan.org. All rights reserved. Text-Greeking-0.12/t/0000755000076500000240000000000011245546343013200 5ustar timastaffText-Greeking-0.12/t/01_compile.t0000644000076500000240000000027011245543762015316 0ustar timastaff#!perl # Tests that the Text::Greeking package compiles use strict; use warnings; use Test::More tests => 2; ok($] >= 5.0061, "Your perl is new enough"); use_ok('Text::Greeking'); Text-Greeking-0.12/t/90_perltidy.t0000644000076500000240000000100111245543762015523 0ustar timastaff#!perl # Test that our code has been tidied use strict; use warnings; use Test::More; my $MODULE = 'Test::PerlTidy'; # Don't run tests for installs unless ($ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING}) { plan(skip_all => "Author tests not required for installation"); } # Load the testing module eval "use $MODULE"; if ($@) { $ENV{RELEASE_TESTING} ? die("Failed to load required release-testing module $MODULE") : plan(skip_all => "$MODULE not available for testing"); } run_tests(); Text-Greeking-0.12/t/96_manifest.t0000644000076500000240000000114711245543762015516 0ustar timastaff#!perl # Test that our MANIFEST file is accurate use strict; use warnings; use Test::More; # $ENV{MANIFEST_WARN_ONLY} = 1; # export MANIFEST_WARN_ONLY=1; my $MODULE = 'Test::DistManifest'; # Don't run tests for installs unless ($ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING}) { plan(skip_all => "Author tests not required for installation"); } # Load the testing module eval "use $MODULE"; if ($@) { $ENV{RELEASE_TESTING} ? die("Failed to load required release-testing module $MODULE") : plan(skip_all => "$MODULE not available for testing"); } manifest_ok('MANIFEST', 'MANIFEST.SKIP'); Text-Greeking-0.12/t/97_meta.t0000644000076500000240000000105011245543762014630 0ustar timastaff#!perl # Test that our META.yml file matches the current specification. use strict; use warnings; use Test::More; my $MODULE = 'Test::CPAN::Meta 0.12'; # Don't run tests for installs unless ($ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING}) { plan(skip_all => "Author tests not required for installation"); } # Load the testing module eval "use $MODULE"; if ($@) { $ENV{RELEASE_TESTING} ? die("Failed to load required release-testing module $MODULE") : plan(skip_all => "$MODULE not available for testing"); } meta_yaml_ok(); Text-Greeking-0.12/t/98_pod_syntax.t0000644000076500000240000000102711245543762016077 0ustar timastaff#!perl # Test all distribution POD are formatted correctly use strict; use warnings; use Test::More; my $MODULE = 'Test::Pod 1.00'; # Don't run tests for installs unless ($ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING}) { plan(skip_all => "Author tests not required for installation"); } # Load the testing module eval "use $MODULE"; if ($@) { $ENV{RELEASE_TESTING} ? die("Failed to load required release-testing module $MODULE") : plan(skip_all => "$MODULE not available for testing"); } all_pod_files_ok(); Text-Greeking-0.12/t/99_pod_coverage.t0000644000076500000240000000110311245543762016340 0ustar timastaff#!perl use strict; use warnings; use Test::More; my $MODULE = 'Test::Pod::Coverage 1.00'; # Don't run tests for installs unless ($ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING}) { plan(skip_all => "Author tests not required for installation"); } # Load the testing module eval "use $MODULE"; if ($@) { $ENV{RELEASE_TESTING} ? die("Failed to load required release-testing module $MODULE") : plan(skip_all => "$MODULE not available for testing"); } my $trustparents = {coverage_class => 'Pod::Coverage::CountParents'}; all_pod_coverage_ok($trustparents);