Cool/useful short examples of Perl?
B Maqueira
bmi at ferrarihaines.com
Mon May 30 12:14:30 BST 2011
Hi Leo,
I have an example on my blog of a script to build sitemaps using TT &
Mechanize (http://codelab.ferrarihaines.com/archives/135). Feel free to
use it if it suits your purpose...
Cheers...
Braudel
> Hi,
>
> I'm working on http://learn.perl.org/ and I'd like to have a few rotating
> example of what can be done with Perl on the home page.
>
> The first two I've thought of are below, does anyone have others?
>
> They don't have to use CPAN modules, one liners are fine as long as it
> is simple to see what they do. I'll have a 'more' link which goes on to
> show full example with line by line explanations.
>
> Module preference is anything from
> http://search.cpan.org/dist/Task-Kensho/
>
> E.g.:
>
> This is probably max sort of size...
>
> # Send an email
> use Email::Sender::Simple qw(sendmail);
> use Email::Simple;
> use Email::Simple::Creator;
>
> my $email = Email::Simple->create(
> header => [
> To => '"Xavier Q. Ample" <x.ample at example.com>',
> From => '"Bob Fishman" <orz at example.mil>',
> Subject => "don't forget to *enjoy the sauce*",
> ],
> body => "This message is short, but at least it's cheap.\n",
> );
>
> sendmail($email);
>
> or
>
> # Serve static files from document root with a directory index
> # app.psgi
> use Plack::App::Directory;
> my $app = Plack::App::Directory->new({ root => "/path/to/htdocs"
> })->to_app;
>
> > plackup
> > Accepting connections at http://0:5000/
>
> Thanks in advance!
>
> Leo
>
---------------------------
Dr Braudel Maqueira-Iglesias
Senior Software Engineer
CSR Plc
t: +44 (0)790 2664862
e: braudel at ferrarihaines.com
http://codelab.ferrarihaines.com
------------------------------------------
More information about the london.pm
mailing list