Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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.

In reply to Re: Is Devel::Declare really so much less evil than source filters? (Solved) by BrowserUk
in thread Is Devel::Declare really so much less evil than source filters? by moritz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (1)
As of 2024-04-25 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found