Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: How to syntax-check Catalyst code which throws 'Invalid CODE attributes' errors?

by Your Mother (Archbishop)
on Jun 09, 2021 at 05:50 UTC ( #11133679=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to syntax-check Catalyst code which throws 'Invalid CODE attributes' errors?
in thread How to syntax-check Catalyst code which throws 'Invalid CODE attributes' errors?

You can do that but I think youíre probably going to be happier testing the application itself instead of components; or testing the components from within the application. Controllers need to have a notion of the Catalyst context. Essentially, they donít even properly exist except as part of a request dispatch. A controller endpoint cannot naturally do anything outside of that.

What youíre doing is akin to trying to check subs inside a script instead of the script itself. It can be done but itís weird given the, well, context of the code. Catalyst controllers arenít code that can be run alone, only within and by the app. Side-note: models and views differ here. Catalyst only adds configuration and access affordances for those.

Catalyst testing is really extremely good and flexible. Only Mojo is better, easier. It doesnít require any (system, standalone, external) server or special environment or anything.

  • Comment on Re^3: How to syntax-check Catalyst code which throws 'Invalid CODE attributes' errors?

Replies are listed 'Best First'.
Re^4: How to syntax-check Catalyst code which throws 'Invalid CODE attributes' errors?
by LittleJack (Beadle) on Jun 10, 2021 at 00:50 UTC

    I totally understand your point about not testing one file at a time but I'm in a tricky situation with source control which means I really need to to test things in isolation sometimes. I simply need to test for basic things like typos at one point in the lifecycle. So ... how would I do that?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2022-08-14 21:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?