Front page | perl.perl6.language |
Postings from October 2005
From: Yuval Kogman
October 6, 2005 18:06
Message ID: 20051007010528.GO23889@woobling.org
On Thu, Oct 06, 2005 at 14:27:30 -0600, Luke Palmer wrote:
> On 10/6/05, Yuval Kogman <email@example.com> wrote:
> > when i can't open a file and $! tells me why i couldn't open, i
> > can resume with an alternative handle that is supposed to be the
> > same
> > when I can't reach a host I ask a user if they want to wait any
> > longer
> > when disk is full I ask the user if they want to write somewhere
> > else
> > when a file is unreadable i give the user the option to skip
> I'm not bashing your idea, because I think it has uses. But I'll
> point out that all of these can be easily accompilshed by writing a
> wrapper for open(). That would be the usual way to abstract this kind
> of thing.
Stylistically I would tend to disagree, actually. I think it's
cleaner to use exception handling for this.
Also, this implies that you know that the errors are generated by
open. This is OK for open(), but if the errors are generated from a
number of variants (MyApp::Timeout could come from anywhere in a
moderately sized MyApp), then wrapping is not really an option.
() Yuval Kogman <firstname.lastname@example.org> 0xEBD27418 perl hacker &
/\ kung foo master: /me groks YAML like the grasshopper: neeyah!!!!!!