diff options
author | Steffen Mueller <smueller@cpan.org> | 2011-10-11 18:20:06 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-10-11 18:20:51 -0700 |
commit | 120b7a08b6eec7ddfe4a829dd2b2ec5ed8612ec1 (patch) | |
tree | ded5dfe0c81dcc16364d7b6ce5500e2d8d897458 /ext/XS-APItest/APItest.xs | |
parent | 3403a50add1cbdbb8ddebb8cb75bc80559f0188f (diff) | |
download | perl-120b7a08b6eec7ddfe4a829dd2b2ec5ed8612ec1.tar.gz |
TODO test for $AUTOLOAD with XS AUTOLOAD
If an AUTOLOAD sub is an XSUB, $AUTOLOAD won't be set. This is intended
as an optimization, but $AUTOLOAD *was* set back in 5.6.0, so this is
a regression.
Committer’s note: I modified the commit message and the comments, as
the original author did not know about the autoload mechanism setting
CvSTASH. For that matter, neither did I till yesterday.
Diffstat (limited to 'ext/XS-APItest/APItest.xs')
-rw-r--r-- | ext/XS-APItest/APItest.xs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs index a83830a9b2..5736a7b398 100644 --- a/ext/XS-APItest/APItest.xs +++ b/ext/XS-APItest/APItest.xs @@ -3242,6 +3242,31 @@ OUTPUT: RETVAL +MODULE = XS::APItest PACKAGE = XS::APItest::AUTOLOADtest + +int +AUTOLOAD(...) + INIT: + SV* comms; + STRLEN len; + SV* class_and_method; + SV* tmp; + CODE: + class_and_method = get_sv("AUTOLOAD", 0); + comms = get_sv("main::the_method", 1); + if (class_and_method == NULL) { + RETVAL = 1; + } else if (!SvOK(class_and_method)) { + RETVAL = 2; + } else if (!SvPOK(class_and_method)) { + RETVAL = 3; + } else { + SvPV_set(comms, SvPV(class_and_method, len)); + RETVAL = 0; + } + OUTPUT: RETVAL + + MODULE = XS::APItest PACKAGE = XS::APItest::Magic PROTOTYPES: DISABLE |