Acme-RequireModule

 view release on metacpan or  search on metacpan

RequireModule.xs  view on Meta::CPAN


SV* my_hint_key;
U32 my_hint_key_hash;

Perl_check_t my_old_ck_require;

static OP*
my_pp_require(pTHX){
	dVAR; dSP;

	if(PL_op->op_flags & OPf_SPECIAL && PL_op->op_type == OP_REQUIRE){
		SV* const sv = sv_newmortal();
		char* pv;
		const char* end;

		sv_copypv(sv, POPs);
		pv  = SvPV_nolen(sv);
		end = SvEND(sv); /* ptr to the last character */

		while(pv != end){
			if(*pv == ':' && *(pv+1) == ':'){

RequireModule.xs  view on Meta::CPAN


static OP*
my_ck_require(pTHX_ OP* o){
	HE* he = hv_fetch_ent(GvHV(PL_hintgv), my_hint_key, FALSE, my_hint_key_hash);

	if( he && SvTRUE(HeVAL(he)) ){
		SVOP * const kid = (SVOP*)cUNOPo->op_first;

		/* require $foo or "Foo", not require BareWord */
		if( !(kid->op_private & OPpCONST_BARE) ){
			o->op_flags |= OPf_SPECIAL;
			o->op_ppaddr = my_pp_require;
		}
	}
	return my_old_ck_require(aTHX_ o);
}


MODULE = Acme::RequireModule	PACKAGE = Acme::RequireModule

PROTOTYPES: DISABLE



( run in 0.369 second using v1.01-cache-2.11-cpan-94b05bcf43c )