On Thu, 5 Apr 2012 11:17:10 +0100
David Cantrell <da...@cantrell.org.uk> wrote:

> On Mon, Mar 26, 2012 at 03:52:37PM -0400, Steve Scaffidi wrote:
> > So, recently I ended up having to write a whole lot of shell (bash),
> > and it sucked. However, it seemed like a necessity for that task
> > because bash (and most other ksh-family shells) has a killer feature -
> > process substitution.
> > 
> >   cat /some/huge/file \
> >   | tee \
> >     >(gzip -c /some/huge/file.gz) \
> >     >(md5 > /home/huge/file.md5) \
> >     >(shasum -a 256 > /home/huge/file.sha) \
> >   >/dev/null
> 
> This feature is incredibly useful and one of my favourite tools.
> 

It has recently become one of mine as well.

> > At some point I went looking on the CPAN for something that would let
> > me do this sort of thing easily in Perl, but sadly, to no avail...
> >
> > So.. I now have a working implementation! However, I'm not sure about
> > the interface/API I've created.
> 
> Nor am I :-) but I'm struggling to come up with something that doesn't
> suck horribly.
> 
> > So, I'm looking for comments on the API, and what others would like to
> > see.
> 
> I don't think it matters what the API looks like, provided that it's
> complete.  People who don't like your API can always roll their own
> wrapper around it, like what File::Find::Rule does for File::Find.  I
> can imagine circumstances when I'd want an OO-ish interface and others
> when I'd want a functional stylee interface, so I suggest that you write
> a nasty old *procedural* interface and then provide Some::Module::OO
> and Some::Module::Functional wrappers in the same distribution.  Or just
> leave those for other people to write, of course.

Well, the problem with a procedural interface is that it often becomes
impossible to properly instantiate. This is one of the inherent limitations
of the File::Find API, which despite its OOP sugar, File::Find::Rule still
suffers from. I've written a blog post about this here:

http://shlomif-tech.livejournal.com/29315.html

(“What you can do with File-Find-Object (that you can't with File::Find)”)

So I suggest that the original poster creates a clean OOP interface first that
is capable of being instantiated (and won't exhibit any other philosophical
limitations that he can think of), and only then prepare some procedural
wrappers. I also don't think that Functional Programming and
Object-Oriented-Programming are dichotomous, and in Perl 5 and in other
languages, you can create APIs that combine both to an even greater advantage.

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Rethinking CPAN - http://shlom.in/rethinking-cpan

We have nothing to fear but fear itself. Fear has nothing to fear but XSLT.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

_______________________________________________
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to