Discussion:
Exporting symbols
(too old to reply)
Jeffrey Ratcliffe
2008-11-09 20:33:48 UTC
Permalink
I'm not sure I'm following you correctly, but it sounds like you're
just looking for symbols in the wrong package. If the symbols exist in
package 'Foo', then they're not going to exist in package 'Foo::Bar'
unless you put them there somehow.
Does accessing a constant as Foo::ConstantName work? If so, then it's
No. In the example I posted, if I have a sub in lib/XS/Test.pm, which
only has one package:

sub test {
return XS::Test::XST_ENUM_1;
}

(where XST_ENUM_1 is pulled in successfully by ExtUtils::Constant, as
the tests otherwise show), make test gives me

# Error: Bareword "XS::Test::XST_ENUM_1" not allowed while "strict subs"

Equally

return XST_ENUM_1;

gives me

# Error: Bareword "XST_ENUM_1" not allowed while "strict subs"

But removing the sub, and tests like

is(XST_ENUM_1, 0);

pass OK.

Regards

Jeff
Jeffrey Ratcliffe
2008-11-10 20:17:18 UTC
Permalink
It works. Thanks!

But I don't understand why it is necessary in the .pm, but not outside it.

Regards

Jeff

Loading...