The My_Module-module (used in this package) uses Signals::XSIG and sets $XSIG{'WINCH'}[1] = sub { ... };
use warnings;
use 5.014;
package Auto_sid;
use Exporter 'import';
our @EXPORT = qw(something);
use My_Module;
no warnings qw(redefine);
sub My_Module::list_to_big {
my ( @arguments ) = @_;
require Signals::XSIG;
Signals::XSIG->import(%Signals::XSIG::XSIG);
@{$Signals::XSIG::XSIG{'WINCH'}} = ();
no Signals::XSIG;
# ...
# do something that My_Module normaly doesn't do and
# which doesn't work when modified $SIG{'WINCH'}
# ...
}
When I use this I get a lot of error-messages like:
"NUM63" is not exported by the Signals::XSIG module
"ARRAY(0xc23180)" is not exported by the Signals::XSIG module
"TRAP" is not exported by the Signals::XSIG module
"ARRAY(0xc119c8)" is not exported by the Signals::XSIG module
...
When I use use instead of require it works fine.
Why does this not work with require?
Because when you do this:
you’re passing the contents of that hash to the import routine. As
NUM63andTRAPare signal names, and they are not valid exports for Signals::XSIG, you’re getting those errors.You need to do this:
Because it recognizes
Exporterrecognizes the string'%XSIG'as one of the things it does export.