Zen has asked for the wisdom of the Perl Monks concerning the following question:
sand_kidA.pm#!/usr/bin/perl use sand_kidA qw(get_a); use sand_kidB qw(get_b); print get_a(); print get_b();
sand_kidB.pm#!/usr/bin/perl use strict; use warnings; package sand_kidA; BEGIN { our @ISA = qw( Exporter ); our @EXPORT_OK = qw(set_a get_a print_b); # symbols to export on +request require Exporter; } use sand_kidB qw(get_b); my $a = 5; sub print_b { print get_b(); } sub set_a { my $val = shift; $a = $val; } sub get_a { return $a; } 1;
#!/usr/bin/perl use strict; use warnings; package sand_kidB; BEGIN { our @ISA = qw( Exporter ); our @EXPORT_OK = qw(set_b get_b print_a); # symbols to export on +request require Exporter; } use sand_kidA qw(get_a); my $b = 6; sub print_a { print get_a(); } sub set_b { my $val = shift; $b = $val; } sub get_b { return $b; } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Exporter module help/example
by ikegami (Patriarch) on Nov 26, 2007 at 17:59 UTC | |
by Zen (Deacon) on Nov 26, 2007 at 18:15 UTC | |
by ikegami (Patriarch) on Nov 26, 2007 at 18:26 UTC | |
by Zen (Deacon) on Nov 26, 2007 at 18:29 UTC |