Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Is Devel::Declare really so much less evil than source filters? (Solved)

by BrowserUk (Patriarch)
on Apr 05, 2010 at 16:35 UTC ( [id://832852]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://832852]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-25 13:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found