in reply to Re^4: Abstract Factory
in thread Abstract Factory

I had same problem, Read : bless and shift
package Bug; sub print_me { my ($self) = shift; # The @_ array now stores the arguments passed to &Bug::print_me # The rest of &print_me uses the data referred to by $self # and the explicit arguments (still in @_) } or, better still: package Bug; sub print_me { my ($self, @args) = @_; # The @args array now stores the arguments passed to &Bug::print_m +e # The rest of &print_me uses the data referred to by $self # and the explicit arguments (now in @args) }
$nextbug = { id => "00001", type => "fatal", descr => "application does not compile", }; To turn that anonymous hash into an object of class Bug you write: bless $nextbug, "Bug";