| 1 |
48 |
dpavlin |
#!/usr/bin/perl -w |
| 2 |
|
|
|
| 3 |
|
|
use Text::Lorem; |
| 4 |
|
|
use Getopt::Long; |
| 5 |
|
|
|
| 6 |
|
|
my ($words,$sentences,$paragraphs,$html); |
| 7 |
|
|
|
| 8 |
|
|
$paragraphs = 1; |
| 9 |
|
|
|
| 10 |
|
|
my $result = GetOptions ( |
| 11 |
|
|
"words=i" => \$words, |
| 12 |
|
|
"sentences=i" => \$sentences, |
| 13 |
|
|
"paragraphs=i" => \$paragraphs, |
| 14 |
|
|
"html" => \$html, |
| 15 |
|
|
); |
| 16 |
|
|
|
| 17 |
|
|
my $text = Text::Lorem->new(); |
| 18 |
|
|
|
| 19 |
|
|
print $text->words($words) if ($words); |
| 20 |
|
|
|
| 21 |
|
|
print $text->sentences($sentences) if ($sentences); |
| 22 |
|
|
|
| 23 |
|
|
if ($html) { |
| 24 |
|
|
for my $i (1 .. $paragraphs) { |
| 25 |
|
|
print "<p>",$text->paragraphs(1),"</p>\n"; |
| 26 |
|
|
} |
| 27 |
|
|
} else { |
| 28 |
|
|
print $text->paragraphs($paragraphs) if ($paragraphs); |
| 29 |
|
|
} |
| 30 |
|
|
|
| 31 |
|
|
print "\n"; |