Hmm this gets me thinking:

<snip>
-----Original Message-----
From: Tony Olekshy [mailto:[EMAIL PROTECTED]]
Or, with try/catch...

    sub openrecord
    {
        for (my $attempt = 0; $attempt < 5; ++$attempt) {
            my $fileName = &GetRecordFileName;
            try { open REC, $fileName; }
            catch "FILE-NO-OPEN" { next; }
            # Work with the file...
            return;
            }
        return undef;
        }
</snip>

In the context of a catch block, if could @_ contain the exception stack,
starting with the current exception, could C<warn> be modified to act of @_
if called in void context with no arguments?

This might give us (from the above example:


            catch "FILE-NO-OPEN" { warn; next; }

where the C<warn> snarfs up the @_, (ie the exception stack) as context for
the warning.

This could of course be done by passing explictly passing an argument
(probably the current exception) to warn for 'stringification', but this has
the advantage of seeming to save us

            my $current_exception = shift;
            catch "FILE-NO-OPEN" { warn $current_exception; next; }

or 

            my @exceptions = @_;
            catch "FILE-NO-OPEN" { warn @exceptions; next; }

-Corwin

Reply via email to