Perl Module using %EXPORT_TAGS -
i'm having trouble using %export_tags in perl module. in solver.pl have:
use matrixfunctions qw(:normal);
then inside matrixfunctions.pm, have:
package matrixfunctions; use strict; use exporter; use vars qw($version @isa @export @export_ok %export_tags); $version = 1.00; @isa = qw(exporter); @export = (); @export_ok = qw(&det &identitymatrix &matrixadd &matrixscalarmultiply &matrixmultiplication); %export_tags = ( det => [qw(&det)], normal => [qw(&det &identitymatrix &matrixadd &matrixscalarmultiply &matrixmultiplication)]);
however works when have @export_ok including methods. if have
@export_ok = ();
i have error:
"matrixscalarmultiply" not exported matrixfunctions module "det" not exported matrixfunctions module "matrixadd" not exported matrixfunctions module "matrixmultiplication" not exported matrixfunctions module "identitymatrix" not exported matrixfunctions module can't continue after import errors @ solver.pl line 6. begin failed--compilation aborted @ solver.pl line 6.
the point of using qw(:normal)
in solver.pl file can have @export_ok empty thought. doing wrong?
perldoc -f exporter
under advanced features section:
e.g., module.pm defines:
@export = qw(a1 a2 a3 a4 a5); @export_ok = qw(b1 b2 b3 b4 b5); %export_tags = (t1 => [qw(a1 a2 b1 b2)], t2 => [qw(a1 a2 b3 b4)]);
note cannot use tags in @export or @export_ok.
names in export_tags must appear in @export or @export_ok.
the bolded section above explains required have functions wish place in %export_tags
in either @export_ok
or @export
a pattern have started using defined want allow exported in @export_ok
, use @export_ok
build `:all' tag:
our @isa = qw(exporter); our @export_ok = qw/raspberry apple/; our %export_tags = ( 'all' => \@export_ok, );
Comments
Post a Comment