Packages, as a rule, do not return values (yes, modules must return a true value for require/use to work). Functions return values.
Are you having trouble exporting/importing?
Use strict warnings and diagnosticsuse strict; use warnings; BEGIN { package Wahoo; require Exporter; use vars qw[ @ISA @EXPORT_OK $WA $HOO ]; @ISA = qw[ Exporter ]; @EXPORT_OK = qw[ $WA $HOO ]; $WA = $HOO = 0; sub Wahoo { $WA = $HOO = 4; } $INC{'Wahoo.pm'} = __FILE__; } package main; use Wahoo qw[ $WA $HOO ]; warn "$Wahoo::WA $Wahoo::HOO "; warn "$WA $HOO "; Wahoo::Wahoo(); warn "$Wahoo::WA $Wahoo::HOO "; warn "$WA $HOO "; __END__ 0 0 at - line 16. 0 0 at - line 17. 4 4 at - line 19. 4 4 at - line 20.
In reply to Re^2: Returning the value generated in package/module problem
by Anonymous Monk
in thread Returning the value generated in package/module problem
by Monkomatic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |