Why not adopt me?
NAME
WWW::Lipsum - get autogenerated text from lipsum.com
DESCRIPTION
WWW::Lipsum
is a module that will retrive "lorem ipsum" placeholder text from lipsum.com.
What is "lorem ipsum"?
"Lorem Ipsum, or Lipsum for short, is simply dummy text of the
printing and typesetting industry. Lipsum has been the industry's
standard dummy text ever since the 1500s, when an unknown printer
took a galley of type and scrambled it to make a type specimen book.
It has survived not only four centuries, but now the leap into
electronic typesetting, remaining essentially unchanged. It was
popularised in the 1960s with the release of Letraset sheets
containing Lipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of
Lipsum." -- lipsum.com
lipsum.com is a useful resource on the Web that will generate passages of lorem ipsum text for you in sizes of your choice. This module allows you to retrieve them in an OO fashion to utilise for whatever purpose you wish.
SYNOPSIS
use WWW::Lipsum;
my $stuff = WWW::Lipsum->new();
print $stuff->lipsum();
my @paragraphs = $stuff->lipsum(
amount => 5,
what => 'paras',
start => 1,
html => 1
);
METHODS
There is just one method, lipsum()
, which returns lorem ipsum text. It has several options to correspond with those offered by lipsum.com.
print $stuff->lipsum(); # default usage, no options
This will give you one paragraph of lorem ipsum, beginning with the phrase "Lorem ipsum dolor sit amet", as is traditional. The size of a "paragraph" is randomly determined by the lipsum.com text generator, but is generally between 70 and 120 words.
my @paragraphs = $stuff->lipsum(
amount => 5,
what => 'paras',
start => 0,
html => 0
);
This will give you five paragraphs of lorem ipsum, the first of which will be without the starting phrase. Setting 'html' to 1 will cause each paragraph to be wrapped in HTML's <p></p> tags.
print $stuff->lipsum(
amount => 100,
what => 'words'
);
This will give you roughly a hundred words of lorem ipsum with the starting phrase. Roughly, because the lipsum.com text generator makes whole 'sentences' of random length. The amount setting will be more accurate at higher values. The 'html' setting has no effect if you ask for words. When used to fill a variable, this will give you a list with one item.
print $stuff->lipsum(
amount => 1024,
what => 'bytes'
);
This will give you roughly 1024 bytes of lorem ipsum with the starting phrase. The same caveat regarding size applies, and again the 'html' setting will have no effect. Again, this will give you a one-item list.
my @lists = $stuff->lipsum(
amount => 10,
what => 'lists',
html => 1
);
The lipsum.com text generator's 'lists' setting produces HTML lists of random size. Using this setting with this module will give you small chunks of text, generally of the order of a couple of sentences. Using the 'html' setting will cause these chunks to be wrapped in <li></li> tags for you to use as you see fit.
AUTHOR
Earle Martin <emartin@cpan.org>.
LICENSE
This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
THANKS
James Wilson, for creating lipsum.com.