use Errno qw(EINVAL);
use Tie::Scalar;
####
sub AUTOLOAD {
my $constname;
($constname = $AUTOLOAD) =~ s/.*:://;
croak "& not defined" if $constname eq 'constant';
my $val = constant($constname, @_ ? $_[0] : 0);
if ($! != 0) {
if ($! =~ /Invalid/ || $!{EINVAL}) {
print "just before AUTOLOAD\n";
$AutoLoader::AUTOLOAD = $AUTOLOAD;
goto &AutoLoader::AUTOLOAD;
} else {
croak "Your vendor has not defined MMA macro $constname";
} }
print "just before eval\n";
eval "sub $AUTOLOAD { $val }";
goto &$AUTOLOAD;
}
####
$ make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/6_tiedScalars....1/18 Undefined subroutine &IPC::MMA::Scalar::TIESCALAR called at t/6_tiedScalars.t line 42.
# Looks like you planned 18 tests but ran 4.
# Looks like your test exited with 255 just after 4.
t/6_tiedScalars.... Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 14/18 subtests
Test Summary Report
-------------------
t/6_tiedScalars (Wstat: 65280 Tests: 4 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 18 tests but ran 4.
Files=1, Tests=4, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.05 cusr 0.00 csys = 0.09 CPU)
Result: FAIL
Failed 1/1 test programs. 0/4 subtests failed.
*** Error code 255
Stop in /build/IPC-MMA-0.5.
$ t/6_tiedScalars.t
1..18
ok 1 - created shared mem
ok 2 - read available mem
ok 3 - make scalar
ok 4 - effect on available mem is -16
Undefined subroutine &IPC::MMA::Scalar::TIESCALAR called at t/6_tiedScalars.t line 42.
# Looks like you planned 18 tests but ran 4.
# Looks like your test exited with 255 just after 4.
$
####
ok (tie(my $tiedScalar, 'IPC::MMA::Scalar', $scalar), "tie scalar");