[Kc] some stuff I talked a little about at the last meeting

John Judd funkyshu at dark-linux.com
Mon Oct 17 14:42:25 PDT 2011

One of my favorite modules... and its unicode brother
my $file_contents = read_file('somefile');
 doesn't get much easier than that

but if you DO use 'open' 'close' etc...
forces ancient built-ins throw exceptions rather return true or false... no
more silent failures (mostly)


very cool exception class that provides accessors 'message' and 'stacktrace'
(that provides both of those) but will stringify to the message.  By
extending the class you can very easily add more accessors.  for instances,
if for some reason you wanted to know the user who just crashed you awsome

package MyApp::Error

use moose;
extends 'Throwable::Error';

has 'user_id' => (
    is => 'ro'
    isa => 'Int',

Then in you app. (i usually pull my exception class in via a role, then
delegate the classes methods/accessors)

try {
catch {
    $self->throw( {
        message =>  $_,
        user_id => $self->user->id
    } );

fun one-liner stuff with mojolicious

some really nifty method chains in mojo's reimplementation of useragent...
the dom stuff should make web scraping a breeze, especially for one-off
stuff or site monitors, etc..

I know there were some more modules i mentioned but I can't think of them at
the moment.

JQUERY stuff:

provides easy searchable, filterable, sortable tables by just passing it a
hash (json)

decaying, non-blocking ajax poller... so you can provide for instance a min
and max polling interval and a rate of decay
So you can tell it to poll every second for 2 requests then step to 2
seconds for two requests, then 3... and so on up to a max of 10 (for
instance).  And you can set a maximum number of polls...
Also it doesn't trigger the callback function you define unless the results
of the last poll are different than the current one.

-- John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/kc/attachments/20111017/eb02985d/attachment.html>

More information about the kc mailing list