in reply to Re^2: Variables in Common parent class
in thread Variables in Common parent class
Organise the code like this:
File main.pl:
#! perl use strict; use warnings; use MyModule; use YourModule; # ... as before ...
File SuperModule.pm:
#! perl package SuperModule; # ... as before ... 1;
File MyModule.pm:
#! perl package MyModule; use strict; use warnings; use SuperModule; our @ISA = qw( SuperModule ); # ... as before ... 1;
File YourModule.pm:
#! perl package YourModule; use strict; use warnings; use SuperModule; our @ISA = qw( SuperModule ); # ... as before ... 1;
Note that a standalone module (i.e., a file with a .pm extension) must return true on success. Hence the common practice of ending each module with 1; on a line by itself. See Perl Modules in perlmod.
This scheme assumes that the four files are in the same directory. If they’re not, you will need to investigate the use lib pragma. See lib.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|