[Pdx-pm] Musings on operator overloading (was: File-Fu overloading)

Aristotle Pagaltzis pagaltzis at gmx.de
Thu Mar 20 13:45:41 PDT 2008

* Eric Wilhelm <scratchcomputing at gmail.com> [2008-02-24 22:00]:
> # from Aristotle Pagaltzis
> # on Sunday 24 February 2008 07:00:
> >I’ve seen Path::Class used extensively in the context of
> >Catalyst, and one thing that struck me is how often you must
> >explicitly stringify, because there’s this tension between
> >APIs that expect filenames as strings or objects of certain
> >kinds, ...
> Well, they are like strings for anything that doesn't
> understand them as path objects.  If you're passing them to
> code that wants a string but croaks if ref($str), the bug is in
> that code.

I dunno. How often have you seen PODs that say “pass a filename
or filehandle to this sub”? Quite common, no? Well, checking
whether something is filehandle-ish is quite difficult in Perl,
and it’s not unusual for code to try to use anything as a
filehandle that’s a ref.

> >it makes the spot that does something unusual explicit about
> >its unusualness 
> By that principle, shouldn't all lines of perl start with an
> "unusual" keyword?


Aristotle Pagaltzis // <http://plasmasturm.org/>

More information about the Pdx-pm-list mailing list