Filter

 view release on metacpan or  search on metacpan

decrypt/decrypt.xs  view on Meta::CPAN

	    /* If the decrypt code needs to tidy up on EOF/error, 
		now is the time  - here is a hook */
	    postDecrypt() ; 

	    filter_del(filter_decrypt);  

 
            /* If error, return the code */
            if (n < 0)
                return n ;

	    /* return what we have so far else signal eof */
	    return (SvCUR(buf_sv)>0) ? SvCUR(buf_sv) : n;
	}

#ifdef FDEBUG
	if (fdebug)
	    warn("  filter_decrypt(%d): sub-filter returned %d: '%.999s'",
		idx, n, SvPV(my_sv,PL_na));
#endif

	/* Now decrypt a block */
	n = Decrypt(ENCRYPT_SV(my_sv), DECRYPT_SV(my_sv)) ;

#ifdef FDEBUG 
	if (fdebug) 
	    warn("Decrypt (%d) returned %d [%.999s]\n", idx, n, SvPVX(DECRYPT_SV(my_sv)) ) ;
#endif 

    }
}


MODULE = Filter::decrypt	PACKAGE = Filter::decrypt

PROTOTYPES:	DISABLE

BOOT:
    /* Check for the presence of the Perl Compiler. B::C[C], B::Deparse. Bytecode works fine */
    if (get_hv("B::C::",0) || get_av("B::NULL::ISA",0)) {
        croak("Aborting, Compiler detected") ;
    }
#ifndef BYPASS
    /* Don't run if this module is dynamically linked */
    if (!isALPHA(SvPV(GvSV(CvFILEGV(cv)), PL_na)[0]))
	croak("module is dynamically linked. Recompile as a static module") ;
#ifdef DEBUGGING
	/* Don't run if compiled with DEBUGGING */
	croak("recompile without -DDEBUGGING") ;
#endif
        
	/* Double check that DEBUGGING hasn't been enabled */
	if (PL_debug)
	    croak("debugging flags detected") ;
#endif


void
import(module)
    SV *	module
    PPCODE:
    {

        SV * sv = newSV(BLOCKSIZE) ;

	/* make sure the Perl debugger isn't enabled */
	if( PL_perldb )
	    croak("debugger disabled") ;

        filter_add(filter_decrypt, sv) ;
	FIRST_TIME(sv) = TRUE ;

        ENCRYPT_GV(sv) = (GV*) newSV(BLOCKSIZE) ;
        (void)SvPOK_only(DECRYPT_SV(sv));
        (void)SvPOK_only(ENCRYPT_SV(sv));
        SET_LEN(DECRYPT_SV(sv), 0) ;
        SET_LEN(ENCRYPT_SV(sv), 0) ;


        /* remember how many filters are enabled */
        FILTER_COUNT(sv) = CORE_FILTER_COUNT ;
	/* and the line number */
	FILTER_LINE_NO(sv) = PL_curcop->cop_line ;

    }

void
unimport(...)
    PPCODE:
    /* filter_del(filter_decrypt); */



( run in 0.564 second using v1.01-cache-2.11-cpan-5511b514fd6 )