[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


https://metacpan.org/module/File::Slurp
https://metacpan.org/module/File::Slurp::Unicode
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...
http://search.cpan.org/~pjf/autodie-2.10/lib/autodie
forces ancient built-ins throw exceptions rather return true or false... no
more silent failures (mostly)



https://metacpan.org/module/Throwable::Error

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
app:

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 {
    #SOMETHING AWFUL HAPPENED
    $some_object->fail_method();
}
catch {
    $self->throw( {
        message =>  $_,
        user_id => $self->user->id
    } );
};




http://mojolicio.us/perldoc/ojo
fun one-liner stuff with mojolicious



http://mojolicio.us/perldoc/Mojo/UserAgent
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:

http://datatables.net/
provides easy searchable, filterable, sortable tables by just passing it a
hash (json)

https://github.com/RobertFischer/JQuery-PeriodicalUpdater/
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