Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

rjbs (4671)

rjbs
  (email not shown publicly)
http://rjbs.manxome.org/
AOL IM: RicardoJBSignes (Add Buddy, Send Message)
Yahoo! ID: RicardoSignes (Add User, Send Message)

I'm a Perl coder living in Bethlehem, PA and working Philadelphia. I'm a philosopher and theologan by training, but I was shocked to learn upon my graduation that these skills don't have many associated careers. Now I write code.

Journal of rjbs (4671)

Saturday June 07, 2008
10:52 AM

new distribution: mixin-linewise

[ #36610 ]

I was almost led astray into the den of releasing a module with a name ending in ::Tiny, but then I saved myself.

I found myself implementing these three methods, again:

sub read_handle { ... }

sub read_file   { ... }

sub read_string { ... }

So, the second two translate the input into something the first can understand and business continues as normal. How often have I written this, or something like it? I'm not sure, but pretty often, anyway.

I wrote a very simple hunk of reusable code, stolen from Config-INI (which in turn stole from Config-Tiny), to let you get those two methods built for you. It uses Sub::Exporter, which means you can say what you want the methods to be called (mostly) and what method you want them to call when they've gotten a handle.

Of course, using Sub::Exporter also means pulling in a few more prerequisites, but that doesn't bother me. Once I'm writing non-trivial code, I'm very likely using Sub::Exporter anyway.

Mixin::Linewise is on the CPAN, and has both Reader and Writer modules.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.