Sign in to PrePAN



GitHub: torbjorn PAUSE ID: TORBJORN Bitbucket: lindahl

User's Modules

Test2::Tools::Path Test tools for checking paths

Pretty self explanatory

A set of tools for testing paths.

Should also include:

  • file_exists
  • file_readable
  • file_writable

same with dir:

  • dir_exists
  • dir_writable (has w)
  • dir_accesible (has r and x) #?

And all of the above with '!'

torbjorn@github 1 comment

MooX::TwoWayAttribute Allow attributes to know who owns them

This dist would consist of two modules

MooX::TwoWayRelations - adds the has_two_way function to set up an two-way attribute.

Moo::BrightChild::Role - a child that knows who it's parents is/are.

I'm clueless on implementation details. Thought I'd throw the idea out there (and also hear if it exists). I would not know what names to search for.

torbjorn@github 0 comments

Util::one small function to make sure there is only one result

The module provides the function 'one' which assures there is only one element returned in list context from the preceding expression.

I repeat this pattern again and again, checking if the outcome provides only the one thing I search for, where finding none or two or more will be an error, repeating the same checks and the same error messagse over and over. 'one' solves that.

torbjorn@github 4 comments

Die::Eventually Gathers multiple deaths - in scope - to be executed going out of scope

The idea is to avoid this pattern:

my @errors;

push @errors, "foo" if bar();

push @errors, "bar" if baz();

die join "\n", @errors if @errors;

It's not a dramatic reduction in code lines, but it is a nice reduction in programmer brain usage on mundane everyday boring things.

torbjorn@github 1 comment

File::Copy::NoClobber Rename copied files safely if destionation exists

Wrappers around copy() and move() in File::Copy that check if destionation exists, and if so changes the destination name to something available.

torbjorn@github 2 comments

App::Git::AutoVersion Use git's smudge and clean filters to automatically update version strings

This dist will provide a script that sets up automatic version string generation for source code, using a template. $AUTOVERSION$ is proposed.

Whenever $AUTOVERSION$ is encountered, it gets substituted with git describe --tags minus the trailing shasum, eg v0.9.1.0. A safe fallback is set up incase no tags exist.

An added bonus is that every commit following a tag, will append a running number to the versionstring, ie next commit it will be v0.9.1.0-1, then -2, etc. until next tag.

The dist would also provide scripts to do the actual filtering, to be used by the filers.

torbjorn@github 2 comments

File::Parser::Role A small but convenient framework for parsing files

A role that accepts a single filename or a normal hash[ref] to constructor with a file argument

It requires and runs $self->parse after construction.

It provides a fh method that gives a file handle seek'ed to 0 (when it's seekable), which is nice to have in sub parse.


  • if given a local file resource: checks that the file exists and is readable
  • also accepts a file handle
  • also accepts a scalar ref to some content to be parsed
  • accepts url's

In short - all those boring tedious things that you have to re-do every time you want to parse a file.

With this shiny role you can skip all that and get straight to the fun bit: The parsing.

torbjorn@github 0 comments

POE::Component::GPIO Hook up GPIO pins to POE

The synapsis is pretty self-explanatory, using POE::XS::Loop::EPoll, or similar, provide state changes and pin control on GPIO pins to POE.

Essentially integrate GPIO pin operations as easily as possible into your project, simple as that. In an ideal world.

torbjorn@github 0 comments

Sudo::Lexical Lexcically scope code with elevated permissions

Lexically scope elevated code, as the example shows. This will most likely mean invoking the system's sudo in one way or another. Typically a password prompt. With a fatal error if it fails.

I don't see 100% how to pull this off, localizing $> most likely, and invoking system's sudo to do so.

EDIT: Changed it from a label (SUDO:) to a sub SUDO (&)

torbjorn@github 0 comments

POE::Component::Client::WWW::Mechanize Provides nonblocking use of WWW::Mechanize

Usage is near identical to POE::Component::Client::HTTP only WWW::Mechanize is used internally to massage the request before submit, and is fed the response back to keep track of cookies etc. as if W::M had sent the request itself.

Uses WWW::Mechanized and PoCo::Client::HTTP internally.

torbjorn@github 1 comment