Hi, Good advice has been given on how to get around your code issue, but what I just want to point out here is that as a general rule, if the module is trying to be object oriented as it is, then export nothing so,
package coolobject; use strict; our @ISA = qw/Exporter/; our @EXPORTER = qw/new/; sub new{ my $class = shift; my $self; $self->{name} = 'new'; bless ($self); if ($self->loaddata()){ return $self; }else{ $! = "Error loading data!"; undef $self; return undef; } }
could still be written as
package coolobject; use strict; sub new{ my $type = shift; my $class = ref($type)|| $type; my $self; $self->{name} = 'new'; bless ($self,$class); if ($self->loaddata()){ return $self; ...... }
And later called as with new() as occassion demands.
Please check: perldoc Exporter
In reply to Re: How do I report an error back to the user of my object?
by 2teez
in thread How do I report an error back to the user of my object?
by SomeNetworkGuy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |