* use that, but for lack of anything better we will use the sub's
* original package to look up $AUTOLOAD.
*/
- varstash = GvSTASH(CvGV(cv));
+ varstash = CvNAMED(cv) ? CvSTASH(cv) : GvSTASH(CvGV(cv));
vargv = *(GV**)hv_fetch(varstash, S_autoload, S_autolen, TRUE);
ENTER;
*bar::is = *is;
*bar::like = *like;
}
-plan 120;
+plan 122;
# -------------------- Errors with feature disabled -------------------- #
),
qr/syntax error/,
'referencing a state sub after a syntax error does not crash';
+{
+ state $stuff;
+ package A {
+ state sub foo{ $stuff .= our $AUTOLOAD }
+ *A::AUTOLOAD = \&foo;
+ }
+ A::bar();
+ is $stuff, 'A::bar', 'state sub assigned to *AUTOLOAD can autoload';
+}
# -------------------- my -------------------- #
),
qr/syntax error/,
'referencing a my sub after a syntax error does not crash';
+{
+ state $stuff;
+ package A {
+ my sub foo{ $stuff .= our $AUTOLOAD }
+ *A::AUTOLOAD = \&foo;
+ }
+ A::bar();
+ is $stuff, 'A::bar', 'my sub assigned to *AUTOLOAD can autoload';
+}
# -------------------- Interactions (and misc tests) -------------------- #