Wastholm.com

PSGI is an interface between Perl web applications and web servers, and Plack is a Perl module and toolkit that contains PSGI middleware, helpers and adapters to web servers.

PSGI and Plack are inspired by Python's WSGI and Ruby's Rack.

I started to write an article explaining how to package a Perl module but it got too long and detailed. Let's start with a simple case and build the smallest possible but still sane package. Later we can go in more details and see alternative ways.

This article is a comparison of seven CPAN modules for extracting information out of the User-Agent string passed to web sites by browsers, spiders, and other software agents. These are useful when processing log files, to produce analytics, and other purposes. You may even use it to change your application's behaviour, but that sort of thing is frowned upon.

There are two important reasons why bind_columns() is so awesome:

First, it greatly reduces the complexity of the code within the while() loop since you do not have to lookup in to an array ($sth->fetchrow_array()), de-reference an array ($sth->fetchrow_array()), or de-reference a hash-ref ($sth->fetchrow_hashref()). Instead the values themselves are available via appropriately named scalars.

Secondly, when using bind_columns() DBI is re-using the same scalars every time a fetch() is done which is much faster than creating an array or hash every fetch and typically causes the values to be copied one less time than normal. Benchmark it yourself – bind_columns() can make a huge difference when processing large sets of data.

Don't do these because "it's quicker" (it's not). Don't do these because "nobody else will use this code" (your future self will). Don't do these because "it's a one-time script" (almost all production software started as one-time scripts). Just do not do them. At all. Ever. Unless you are mst there is no reason to do any of this. The language has moved on. There is a better way.

What's CPAN Minus (or "cpanm" if you prefer the caps-challenged version) for? Installing CPAN modules, period. It can get, unpack, build, and install Perl modules from CPAN -- but it can't do any of the other stuff the CPAN shell can do. It's meant to require zero configuration, and it runs as a standalone application.

This class is the part of Mail::DKIM responsible for generating signatures for a given message. You create an object of this class, specifying the parameters of the signature you wish to create, or specifying a callback function so that the signature parameters can be determined later. Next, you feed it the entire message using "PRINT()", completing with "CLOSE()". Finally, use the "signatures()" method to access the generated signatures.

The main module, Lingua::EN::MatchNames, exports one function by default: name_eq(). You can either feed it four parameters:

name_eq( $firstname0, $lastname0, $firstname1, $lastname1 ) or two (thanks to Lingua::EN::NameParse, which breaks full names into their constituent components):

name_eq( $name0, $name1 ) and it will return a certainty score between 0 and 100, or undef if the names cannot be matched via any method known to the module.

Some of our PERL tools require some CPAN modules that are not part of the standard Ubuntu distribution. It's obviously possible to install the module using CPAN but I like using deb packages where possible as then you only have one repository to manage. Fortunately with dh-make-perl it is possible to quickly turn any CPAN module in to a debian package!

ack is a tool like grep, aimed at programmers with large trees of heterogeneous source code.

ack is written purely in Perl, and takes advantage of the power of Perl's regular expressions.

|< First   < Previous   11–20 (28)   Next >   Last >|