November 2013 Archives

WWW::Mechanize - Adding form_action()

https://github.com/markleightonfisher/WWW-Mechanize is a fork of WWW::Mechanize with a form_action method for finding a form using a regex that matches the form's action. (I've submitted this as a possible enhancement to WWW::Mechanize.)

I needed this when I encountered a page where the forms moved around based on whether you logged in as an ordinary user or an administrator. (Not my page, so don't blame me :( .)

OT: DataCite Recommends "doi:" Scheme Prefix

(Posted here so I don't forget it and others can find it...)

In the latest DataCite Metadata Kernel document, section "2.2 Citation", DataCite recommends ("prefers" is their term) that original-format DOIs used in citations include the doi: scheme prefix. ("Original format" refers to non-URL DOIs.) Unfortunately, the DataCite Metadata Kernel document does not mention that the string doi: is a scheme prefix, making it hard to find.

An example DO…

Why Puppet is Intrinsically Better Than Chef

Two words: it's declarative.

Longer answer: Puppet lets you specify what configuration you want without worrying about how to get it. In that way, it is similar to SQL (where you specify what data to retrieve) or Nagios (where you specify what you want to monitor on the network). This is a higher level of abstraction than a procedural language like Chef -- kind of like saying, "Climb that mountain" without concerning yourself with the details of what approach to take, what gear to bring, etc. (Matter of fact,

Stupid Moose Tricks: Being Your Own Exception Class

I discovered (by accident) that in Moose you can be your own exception class:

package Local::Iam::MyOwn::Exception;

use Moose;
with 'Throwable';

sub ork {
my ($self, $cow) = @_;

if ($cow ne 'cow') {
$self->throw("Need a 'cow', here!");
}

return ('ork', 'ork', 'ork');
}


package main;

my $lime = Local::Iam::MyOwn::Exception->new();

print join(' .. ', $lime->ork('cow')) . "\n";

print join(' .. ', $lime->ork('horse')) . "\n";

If you run this, you…

About Mark Leighton Fisher

user-pic Perl/CPAN user since 1992.