I'm currently working using an eval to capture errors in subroutines and this is a very slimmed down version of what i'm doing
#use strict;
use vars qw($AUTOLOAD);
&mysub_('foo','bar');
sub mysub{
#do something...
print "in mysub\n";
return;
}
sub AUTOLOAD{
my @args = @_;
$AUTOLOAD =~ /.*::(.*)_/
my $sub_name = $1;
#no strict 'refs';
eval{&$sub_name(@args)};
#use strict 'refs';
print @;
#do something with $@ to check runtime errors
}
With strict commented out it works exactly as I had hoped but with strict back in $@ contains the messaage
Cant use string ("mysub") as sub routine ref while strict refs in use
I've got round it with turning strict refs on and off (commented out at the moment) but I'm not sure if this is a good way of dealing with the problem.Any ideas