I wrote a small Perl script to randomise file dates. It doesn’t seem particularly useful, but I needed it to have some test data. It accepts as argument either a filename or a wildcard expression. . . . → Read More: Randomise file dates
|
||||
|
I wrote a small Perl script to randomise file dates. It doesn’t seem particularly useful, but I needed it to have some test data. It accepts as argument either a filename or a wildcard expression. . . . → Read More: Randomise file dates In the last few days I’m trying to learn Groovy, and until now is surprisingly easy. The great part is that it can access all the Java classes and libraries natively, but without all Java boilerplate and verbosity. I’m starting to think to use Groovy instead of Perl for my scripting needs, for instance . . . → Read More: Groovy Baby! One way to do it is using the module Mail::Sender. #!/usr/bin/perl use Mail::Sender; my $sender = new Mail::Sender({smtp => ‘localhost’, from => ‘from@example.com’}); $sender->MailMsg({to => ‘to@example.com’, subject => ‘Testing the subject’, msg => ‘Testing the message body’}); I’ll be using the LWP::Simple module, and after declarations, to get the content of an URL is simply get $url. #!/usr/bin/perl use LWP::Simple; my $url = ‘http://perldoc.perl.org/index-overview.html’; my $content = get $url; print $content; The get() function will fetch the document identified by the given URL and return it. It returns undef if it fails. . . . → Read More: Retrieving a URL from Perl Here is a simple example in Perl to issue a query to the database (in this case MySQL) and retrieve the results. If the SQL is compatible, it can be used on another DBMS just by changing the query string. There are drivers also for CSV and other file formats! #!/usr/bin/perl use warnings; use strict; . . . → Read More: Select query in Perl It’s some time that I’m exploring Perl and I like it for its wittiness. I’ve been starting using it to write some system admin scripts, but since it was a good experience I tried to write some web script too, so I will add to my notebook here how to get Request Parameters. #!/usr/bin/perl use . . . → Read More: Request Parameters in Perl |
||||
|
Copyright © 2013 Stivlo - All Rights Reserved Powered by WordPress & Atahualpa |
||||
Recent Comments