in reply to Extending a class
You're doing the right things. I suggest you pull main out into a separate file - This has caused me grief in the past when writing classes involving inheritance.
This works perfectly for me:
#!/usr/bin/perl use warnings; use strict; package MyPackage; use parent 'SVG'; sub Foo { my ($self, $fooArg) = @_; return $self->rectangle(id => $fooArg, x => 10, y => 10); } sub Bar { my ($self, $barArg) = @_; my $g = $self->group(id => $barArg); return $g->Foo("g$barArg"); } 1;
EDIT: Actually, looking a bit closer, you're doing $g = $self->group... This is returning a SVG::Element object, which of course you cannot call Foo on, as Foo is a function of MyPackage
|
---|