in reply to Is Devel::Declare really so much less evil than source filters?

Update: Answered my own question. It has to be Devel::Declare->setup_for(...) not Devel::Declare::setup_for(...)

Does anyone know what do I have to change in this:

package Cswitch; use strict; use warnings; use Devel::Declare; sub import { print "Import called with @_"; my $class = shift; my $caller = caller; Devel::Declare::setup_for( $caller, { switch => { const => \&pSwitch }, case => { const => \&pcase }, } ); no strict; *{ $caller . '::switch' } = sub () { }; *{ $caller . '::case' } = sub () { }; } sub pSwitch { print "pSwitch: @_"; } sub pCase { print "pCase: @_"; } 1;

In order that this would cause the parser subs to be called:

#! perl -slw use strict; use Cswitch; switch 1, { case 1, { print 'Got 1'; }; case 2, { print 'Got 2' }, };

to stop this?

C:\test>t-DevDec.pl Import called with Cswitch Number found where operator expected at C:\test\t-DevDec.pl line 5, ne +ar "switch 1" (Do you need to predeclare switch?) Number found where operator expected at C:\test\t-DevDec.pl line 6, ne +ar "case 1" (Do you need to predeclare case?) Number found where operator expected at C:\test\t-DevDec.pl line 9, ne +ar "case 2" (Do you need to predeclare case?) syntax error at C:\test\t-DevDec.pl line 5, near "switch 1" Execution of C:\test\t-DevDec.pl aborted due to compilation errors.

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"