http://qs321.pair.com?node_id=836566


in reply to Re^3: Simple inheritance question
in thread Simple inheritance question

Yeah, $self->test will work (altho this still does not require a constructor for One, seems like a red herring):
#!/usr/bin/perl -w use strict; { package One; sub test { my $x = pop; print "$x\n"; } } { package Two; use base "One"; sub new { my $self = {}; bless($self); } sub eg { my $self = shift; $self->test(pop); } } my $obj = new Two(); $obj->eg("hello");
I guess this is starting to seem a little finnicky, but I would like to use test() as if it were a function internal to Two, not requiring an object.

Basically, I have two classes that share a bunch of such internal functions (no object required, it's just string parsing), so I thought the best thing would be to have a base class containing those.

In fact Exporter does work, see my reply to jethro.