vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:
Package
package MYCALC; use Exporter; our @EXPORT = (); our @ISA = qw(Exporter); our @EXPORT_OK = qw(addition multi); our %EXPORT_TAGS = (DEFAULT => [qw(&addition)],Both => [qw(&addition & +multi)]); sub addition { return $_[0] + $_[1]; } sub multi { return $_[0] * $_[1]; } 1;
Program:
use strict; use warnings; my @list = qw (2 2); use Module qw(:DEFAULT); print addition(@list),"\n";
Above coding is my module MYCALC and the program which using this module, I have not exported any function using @EXPORT, but I have used the DEFAULT in %EXPORT_TAGS with the function addition, when I call this function from the main it says the error as,
Undefined subroutine &main::addition called at Module.pl line 25.
Why the addition function not getting called?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Module problem
by shmem (Chancellor) on Mar 09, 2009 at 09:30 UTC | |
|
Re: Module problem
by Bloodnok (Vicar) on Mar 09, 2009 at 11:34 UTC | |
|
Re: Module problem
by boom (Scribe) on Mar 10, 2009 at 03:31 UTC | |
|
Re: Module problem
by ig (Vicar) on Mar 10, 2009 at 08:30 UTC |