in reply to is this a perversion of OO principles?
Using an inheritance trick, polymorphism, you could subclass each of the specific MessageLibrary objects so that instead of having different methods in one class, you have many classes with a common overloaded method:
But, as far as i can tell you with my current knowledge of such problems - all you are doing is moving code from one position to another, you aren't eliminating code.my $file_error = Error::FileOpen->new(); open MYFILE, $myfile or die $file_error->handle($myfile);
I think i'd just rather use:
because you don't need to worry about adding code to tailor an error - unless you really need that, don't worry about it. ;)open MYFILE, $myfile or die $error_messages->generate_message( 'file_open_failed', $myfile );
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR F--F--F--F--F--F--F--F-- (the triplet paradiddle)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (jeffa) Re: is this a perversion of OO principles?
by seattlejohn (Deacon) on Jan 07, 2002 at 03:00 UTC |