Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Get me excited about perl

by temporal (Pilgrim)
on Sep 19, 2012 at 18:54 UTC ( #994500=note: print w/replies, xml ) Need Help??

in reply to Get me excited about perl

I like telling people about how awesome CPAN is =)

Might be a neat demo to show how quickly, simply, and intuitively you can grab module(s) and accomplish some of these web/batch tasks your audience typically does in their 'native' languages.

Strange things are afoot at the Circle-K.

Replies are listed 'Best First'.
Re^2: Get me excited about perl
by roboticus (Chancellor) on Sep 19, 2012 at 20:31 UTC

    I'll have to chime in with temporal: I think that CPAN is the best initial draw. The capabilities of the language help make it stay great.

    The example I usually use to "hook" people with perl is a stripped down version of my SQL_2_excel script. The stripped down version isn't fancy, but shows how easily you can get data from a database and into a spreadsheet:

    #!/usr/bin/perl # # Create a spreadsheet from an SQL query. # use strict; use warnings; use DBI; use Spreadsheet::WriteExcel; my $DSN = shift; my $usr = shift; my $pwd = shift or die "Missing argument(s)!"; # Attach to database and run query my $DB=DBI->connect($DSN,$usr,$pwd); my $ST=$DB->prepare(<<EOSQL); select MID, DBA, LastName, FirstName from customers where balance_due > 100 EOSQL $ST->execute; # Create a new workbook and worksheet my $xWB = Spreadsheet::WriteExcel->new('MySpreadsheet.xls'); my $xWS = $xWB->add_worksheet("Results"); # Add column headers (use column headers from query results) my $R=0; my $C=0; $xWS->write($R, $C++, $_) for @{$ST->{NAME}}; # Read the query results and write them into the spreadsheet while (my $ar=$ST->fetchrow_arrayref) { ++$R; $C=0; $xWS->write($R, $C++, $_) for @$ar; }

    It doesn't have much in the way of features (no error checking to speak of, no formatting and/or null handling, etc.). But it's easy to see what's going on and shows that you don't need much code for some basic tasks.


    When your only tool is a hammer, all problems look like your thumb.

Re^2: Get me excited about perl
by DrHyde (Prior) on Sep 20, 2012 at 10:46 UTC

    If you're going to do a live demo, do it against a CPAN mirror running on the same machine so you don't get embarrassed by network snafus! And practice practice practice beforehand. Make sure that the environment you're demoing in is exactly the same as what you practice in!

    If any of them spot that it's a rigged demo (ie a local CPAN mirror) then point out that that's a feature - minicpan is just one of the bounty of treasures on the CPAN.

      Seconding DrHyde on this one - I've actually had one of those 'Oh, well I can just snag this module from this amaaazing and wonderful thing called CPAN and we can demo this! *crickets*' moments during a meeting the big-wigs.

      The upshot being that it's not so fun also teaching them about how to tether your phone because the local point of internet access is spotty.

      Some great replies up here, I sometimes forget how shiny Perl really is. Then I am coerced into speaking some other language for a spell... which usually ends in a 'why you should be excited about Perl and be totally using it' speeches, haha!

      Strange things are afoot at the Circle-K.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://994500]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2017-05-22 22:54 GMT
Find Nodes?
    Voting Booth?