Archive for the 'perl-coding-specialist' Category

Debugging Perl

Problem You have an error in your Perl script and want to debug it. Solution Debugging in Perl is very extensive, this demo is very basic! Check the reference for further instruction.You can manipulate PERLDB_OPTS variable, to force some debugging – then just pass through a -d option to your perl script.Also system debugging is [...]

Listen on port – client server demo

Problem You want to listen on a port, maybe to test firewalls! Excellent introduction to client server software. Solution Another use bit of socket programming, courtesy of Perl! Extremely useful bit of Perl, which can be used with the other post on this site, to confirm network connectivity (port scanner).This code (see example tab) will [...]

scan network port with perl

Problem You want to test a network port, on a remote system – over TCP/IP.Maybe this is a new setup, or you want confirmation it is working.Perhaps the firewall rules have just been changed! Solution A nice small bit of Perl code that I’ve used thousands of times!In fact I’m running it in most of [...]

Calculate largest field big data file

Problem I wanted to upload a delimited field to mysql db, but hit the problem that the file contained nearly 3000 rows and no schema on the required size of each field.Therefore I needed to traverse the file and calculate the length of each field. Then at the end, print the largest field found for [...]

Perl WIN32 OLE – Outlook save text

Problem How to use Perl to connect to MS Outlook. Then descend through given folders and save items to disk, as text files. Solution I wrote this some time ago, to traverse predefined outlook mail folders, saving items with given subject to text.Requires WIN32:OLE perl module (which comes with activeperl by default).Hardcoded is the upload [...]

Perl libcurl demo

Problem You want to use libcurl, driven through Perl. Solution Beautiful for parse HTML and either extracted (screen scraping) content or performing actions based on results.See the examples tab for this simple script, demonstrating the libcurl API for Perl. Example #!/usr/bin/perl$url=”http://perl.coding-school.com/”; # set your url here$|++;use Curl::easy;# Init the curl sessionmy $curl= Curl::easy::init() or die [...]