G'day p6l and p5p,

I'm currently working on the 'autodie' pragma for Perl 5, which is essentially 'Fatal' but with lexical scope. It's similar to the 'fatal' pragma described in S04/Exceptions.

autodie is implementing an exception hierarchy for in-built functions. Essentially we have a tree that looks like:

  :all
      :USER
      :CORE
          :math
              atan2
          :io
              :file
                  open
                  close
              :filesys
                  opendir
              :socket
                  accept
                  bind
                  connect
                  ...

Currently, when testing exceptions from autodie, we can use:

        given ($@) {
                when (undef)   { say "No errors here" }
                when ('open')  { say "Open died" }
                when (':file') { say "Some sort of file error" }
                when (':io')   { say "Some other error" }
                when (':CORE') { say "Some other CORE error" }
                when (':USER') { say "A non-CORE error" }
                when (':all')  { say "Any autodie exception at all." }
                default        { say "Not an autodie exception." }
        }

There's a 5 minute presentation on what autodie is and how it currently works at:

        http://pjf.id.au/blog/?position=540

This also looks very similar to what I remember is the desired plan for P6 exception handling, although my memory may be playing tricks on me as I can't seem to find the document where I read this.

So, why does p6l care? Well, if there's already a p6 exception hierarchy designed for built-ins, I'd like to use it. It saves me work, and saves surprises for the developers. If there isn't a p6 exception hierarchy yet, then I'd like for p6 to have the option of stealing mine, for essentially the same reasons.

Questions I'm seeking answers to are:

* Is there a document that describes the current p6l exception hierarchy? My searching skills seem to be impaired today.

* Does anyone have any input they'd like to make before I start fleshing out the hierarchy for p5 autodie?

* Is this an appropriate question for p6l? While it relates to a p5 pragma, I hope to make the behaviour as compatible with p6 as possible.

Many thanks,

        Paul

--
Paul Fenwick <[EMAIL PROTECTED]> | http://perltraining.com.au/
Director of Training                   | Ph:  +61 3 9354 6001
Perl Training Australia                | Fax: +61 3 9354 2681

Reply via email to