[32624] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3898 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 11 16:09:37 2013

Date: Mon, 11 Mar 2013 13:09:03 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 11 Mar 2013     Volume: 11 Number: 3898

Today's topics:
    Re: message forwarding in perl <ben@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 11 Mar 2013 18:12:31 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: message forwarding in perl
Message-Id: <fdj11a-bs6.ln1@anubis.morrow.me.uk>


Quoth Rainer Weikusat <rweikusat@mssgmbh.com>:
> Ben Morrow <ben@morrow.me.uk> writes:
> > Quoth Rainer Weikusat <rweikusat@mssgmbh.com>:
> >> Another trivial thing I'm actually using: Can be implemented via
> >> AUTOLOAD. The fact that UNIVERSAL->can and AUTOLOAD don't play nice
> >> with each other is actually documented. Again, one has to wonder why
> >> someone asks for this and specifically mentions a documented technical
> >> limitation of the obvious answer to the question.
> >
> > Yup, it's easy to do badly, and rather difficult to do well.
> 
> At least for suitable definitions of 'done badly' and 'done well'. I'm
> using this to attach somewhat 'enhanced' functionality to the DBI
> database and statement classes. In both cases, the original DBI
> object is stored in an instance variable of the object (Again an
> an array reference.

I frequently use arrayrefs for small objects. I don't see anything wrong
with that. For a proxy like this I would probably start with by using a
scalar ref to the (ref to the) DBI object.

> "One million flies can't be wrong[*]" isn't an
> argument except if one is aspiring to become the lord of the flies by
> election) and if a method the replacement object doesn't implement is
> called, AUTOLOAD compiles a 'delegation method' of the same name which
> invokes the method on the DBI object with the same arguments and calls
> that.
> 
> That's a perfectly working solution to the problem which needed to be
> solved in this case. It is very likely not a 'perfectly working' (or
> any kind of) solution for a lot of other problems which are more or
> less related to the situation I had to deal with, however, that's no
> concern of mine at the moment.

Incomplete solutions are useful, yes, especially when one is trying to
get things done quickly, but they are inherently fragile. It's only a
matter of time before you pass one of these delegation objects to
something like Storable which expects ->can to work properly, or
something which expects ->isa or (worse) UNIVERSAL::isa to give the
right answers. Did you know, for instance, that overload plays some
nasty tricks with ->can and roll-your-own->can which can make this sort
of delegation very difficult to get right? (Did you know that method
names don't have to match /\w/?)

> A certain kind of (recreational) programmers (or people with
> software-related jobs who have no real problems to deal with and way
> to much time on their hands) is convinced that the combined
> washer-dryer-lawnmower-bicycle-tophat-eggwarmer-hovercraft-theodolite
> would be the pinnacle of 'good software design', however, that's not
> how things are constructed in the real world and there are good reason
> for that (such as usability [complicated solutions to simple problems
> are a pain in the ass] and reliabiliy [complicated stuff breaks more
> often than simple stuff and in much more complicated ways]).

Solutions which have been thought through and tested to the point of
being essentially complete can be relied upon in ways which solutions
that were just designed to solve the problem at hand cannot. Yes, a
complete solution takes more thought and more testing to get right; but
once that has been done it need not be done again, whereas an incomplete
solution requires you to keep bearing in mind the ways in which it is
incomplete.

> [*] I'm unsure if this is a well-known idiom outside of the small
> German country town I was born in, so I'll include it here: "Scheisse
> schmeckt gut. Millionen Fliegen koennen nicht irren." In English, that
> would be "Poo must be tasty. Millions of flies can't be wrong".

That's not the translation I would have used for 'scheiße'... There is
an equivalent English expression, though the phrase 'Lord of the Flies'
calls up different associations.

Ben



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 3898
***************************************


home help back first fref pref prev next nref lref last post