in reply to Re^2: Transparently inheriting functions from a parent package
in thread Transparently inheriting functions from a parent package
-- t.pm -- package t; use parent qw(t2); sub testing { print "Testing from t.pm\n"; } 1; -- t2.pm -- package t2; sub testing2 { print "Testing from t2.pm\n"; } 1; -- test.pl -- #!/usr/bin/perl use t; t->testing(); t->testing2();
Exporter is what you want if you want static functions:
-- t.pm -- package t; use t2; sub testing { print "Testing from t.pm\n"; } 1; -- t2.pm -- package t2; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(testing2); sub testing2 { print "Testing from t2.pm\n"; } 1; -- test.pl -- #!/usr/bin/perl use t; t::testing(); t::testing2();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Transparently inheriting functions from a parent package
by vaewyn (Novice) on Apr 05, 2011 at 00:48 UTC |