Stas Bekman wrote:
>So, next I'm trying to use exception objects with overloaded methods. Here is
>a demo, this time in perl:
>
>package Err;
>
>use overload
> 'bool' => \&num,
> '==' => \&num,
> '0+' => \&num,
> '""' => \&str;
>
>sub str { my $self = shift; $self->{str};}
>sub num { my $self = shift; $self->{num};}
>
>sub new {
> my ($class, $num, $str) = @_;
> bless {
> num => $num,
> str => $str,
> }, __PACKAGE__;
>
>}
>
This is beginning to look a lot like the Exception::Class module. I use
that module myself for exception handling, and it seems pretty good. It
has a couple of operator overloads in it, but not all that you have
above. However, using E::C involves subclassing it: typically, one has
many subclasses, all derived from a single class which is itself derived
from E::C::Base, so you could either add the extra overloads to some
E::C::ModPerl class, or even suggest them as patches to E::C itself.
Just trying to save a bit of wheel re-invention ;)
- Steve
------------------------------------------------
Radan Computational Ltd.
The information contained in this message and any files transmitted with it are
confidential and intended for the addressee(s) only. If you have received this
message in error or there are any problems, please notify the sender immediately. The
unauthorized use, disclosure, copying or alteration of this message is strictly
forbidden. Note that any views or opinions presented in this email are solely those
of the author and do not necessarily represent those of Radan Computational Ltd. The
recipient(s) of this message should check it and any attached files for viruses: Radan
Computational will accept no liability for any damage caused by any virus transmitted
by this email.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]