package Mytest; use 5.008008; #use strict; use warnings; use Errno; use AutoLoader; use Carp; require Exporter; our @ISA = qw(Exporter); our %EXPORT_TAGS = ( 'all' => [ qw( ) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); #Buch: our @EXPORT_OK = qw/ myfunc /; our @EXPORT = qw( ); our $VERSION = '0.01'; require XSLoader; XSLoader::load('Mytest', $VERSION); #im Buch so beschrieben, klappt aber nicht sub myfunc { my $arg = shift; return $arg; } sub AUTOLOAD { my $sub = $AUTOLOAD; (my $constname = $sub) =~ s/.*:://; my $val =constant($constname); if ($! != 0) { if ($! =~ /Invalid/ || $!{EINVAL}) { $AutoLoader::AUTOLOAD = $sub; goto &AutoLoader::AUTOLOAD; } else { croak "Your vendor has not defined constant $constname"; } no strict 'refs'; *$sub = sub () { $val }; } goto &$sub; } 1; __END__ # Below is stub documentation for your module. You'd better edit it!