develooper Front page | perl.module-authors | Postings from June 2008

Name space: throwing exceptions easily

Thread Next
Lutz Gehlen
June 28, 2008 04:53
Name space: throwing exceptions easily
Message ID:
Hello everybody,
I am developing a module to make throwing Exception::Class objects 
easier. The goal is to make the code to throw an exception shorter 
and to make it possible to keep all error messages at some central 

The module works quite similarly to Class::Accessor and provides a 
function mk_exception_functions that puts the required functions 
into a given namespace. For example you can define an exception 
    (messages => {foo => 'Error foo occurred.'},
    exception_class => 'Exception::Class::Mine');

and later just call
foo() if($foo);
instead of
Exception::Class::Mine->throw(message => 'Error foo occurred.')

Currently the module uses the package Exception::Class::EasyThrow 
but I don't know if this is really a good name. It is a bit vague 
and rather refers to the intended use of the module instead of what 
it does.

I would be happy about other suggestions.

Thanks a lot,

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About