Archive for the ‘Perl’ Category

Hope for Perl on App Engine

Wednesday, July 23rd, 2008

Finally, after months of users begging Google to support Perl on Google App Engine (GAE), there looks to be a positive response as Brad explains.

The majority of the work will have to be done by the Perl community, but Google is giving Brad and other Google developers “20%” of their time to be devoted to this “pet project“.

When launched I played with GAE briefly and once I saw the support for Django I took another look. Since I don’t program daily in Python it takes me longer to the most basic things I as spend my time writing pseudo code when unsure and looking up syntax later. I’ve yet to test the sample Django app out on GAE, but hope to someday soon.

Catalyst moves away from YAML

Thursday, July 10th, 2008

It appears that to the Catalyst community YAML isn’t the best config file format any longer as they’ve chosen to switch in favor of Config::General - which defaults to the "apache config format"

From Config::General’s POD:

The format of config files supported by Config::General is inspired by the well known apache config format, in fact, this module is 100% compatible to apache configs, but you can also just use simple name/value pairs in your config files.

Catalyst::Plugin::DebugCookie even provides the updated configuration style in it’s POD:

 <Plugin::DebugCookie>
    secret_key 001A4B28EE3936
    cookie_name my_secure_debug_cookie
 </Plugin::DebugCookie>

The following command can be used to dump an existing Catalyst app’s config into an Apache style conf file. You’ll definitely have to edit the resulting file, but at least it’s a start.

perl -Ilib -e 'use MyApp; use Config::General; Config::General->new->save_file("myapp.conf", MyApp->config);'

Transform password into digest inside a DBIx::Class model

Wednesday, May 28th, 2008

I’m working on a project using Catalyst , and I initially coded the password hashing (compare the passwords then build the digest, used during the signup and change password processes) directly into my controller (could be placed in a Utils package) and passed the digest to the create/update like so:

my $pass = $c->req->param("password");
my $digest = Digest->new('MD5')->add($pass)->digest;
...
$c->user->password($digest);

Reading the Catalyst mailing list I learned about store_column(), part of DBIx::Class::Row .

Upon storage of a row (an update or create), it allows you to override the default "store this value" and manipulate the value into whatever you’d like.

Using the code below I was able to move this logic out of the controller/Utils package and into the model where it belongs.

sub store_column {
    my( $self, $col, $val ) = @_;
    $val = Digest->new('MD5')->add($val)->digest
              if $col eq 'password';
    return $self->next::method( $col, $val );
}

This technique can also be used to perform calculations .

CPAN via a Pipe

Sunday, March 30th, 2008

I’ve tried to monitor the CPAN recent feed to keep up with updates to modules I use and find other useful modules, but the volume of updates has gotten to much to handle. While it’s great to see so many updates, I simply don’t have the time to look through them all.

Apparently, I’m not the only one with the problem as a while back NotiCPAN was created to notify users of updates to specific modules. Problem is you must select each individual module you’d like to watch.

In the sprit of being lazy, I thought up a way to monitor what I’d like via a Yahoo Pipe. With it I’m able to enter the types of modules I’m interested in and subscribe to it in Google Reader. I like the fact that I can watch all Catalyst modules by simply specifying that I want “Catalyst” in the title or if I specify “YAML::Tiny” it’ll watch that one module for now and if others enter that namespace it’ll automatically pick those up.

It’s a very simple concept, but has helped me a great deal.

Feel free to check out the pipe and I’d love to hear of other uses.

Perl is not dead; It’s Pot Roast

Monday, November 19th, 2007

When I think of Perl I’m reminded of a Slow Cooker, in that it is what it says. Perl is Practical. Sometimes practicality takes time (hence the months and years between releases - Pot Roast takes time). Extraction and Reporting are self explanatory. Perl is a Language.

According to Wikipedia:

Languages live, die, move from place to place and change with time. Any language that stops changing begins to die; any language that is a living language is a language in a state of continuous change.

When I look around at the various frameworks, existing expansions, continued development, community involvement, published works, plethora of jobs, news and evangelism I simply cannot see anything but a thriving language.

Critics have and will continue to have the debate whether Perl is alive or dead, but in the meantime, we continue to develop and innovate with Perl, ever so effortlessly adapting to the new “concept on the block”.

Web Services, API’s, frameworks, blogs (read the about page if you’re wondering why I use Wordpress), social networking, scripting, etc. - Perl can do it all. Just like any other language.

Sure, competition and collaboration are great. They are what spawn new ideas and solutions. I’m reminded of the jQuery vs PrototypeJS war. jQuery pioneered the concept of using CSS selectors to get to DOM Elements. Brilliant. Now, these and many other libraries have that functionality. But it took time - like Pot Roast.