perl -MO=Deparse,-p yourscript.pl "?
this should put a _lot_ of parentheses...
| [reply] |
That's somewhat odd. What does mysub{} do? Deparse is actually returning the interpreter's version of your code to you, so it will have some amount of inlining performed and a few other things specific to the state of your code when you deparsed it. In other words, your code will be slightly optimized and you should beware of early optimization. Perhaps I should have phrased my earlier statement:
The deparser, when it works, returns (more or less) your code in a pretty format. | [reply] |
mysub{} prints HTML code. Just one of life's mysteries, I guess.
I read that in Perl the parentheses surrounding a subroutine's arguments are completely optional, so it should not matter whether I use parentheses to call subroutines in my prettified code, but it does.
| [reply] |
Wrong! Those parentheses are not "completely optional!" Parentheses are required when clarification is required. For example, if you don't prototype your subroutine, then you must use either an ampersand & or parentheses to tell Perl that its a user defined subroutine. You are probably not using strict or warnings, so the bareword message probably slipped past you unnoticed. I'm not sure why the deparser would drop the parentheses, but it makes sense that you would need them.
| [reply] |
Sounds like Deparse could use a patch, though I don't think it ever was intended to be used as a pretty printer. I bet you'll run into other output from Deparse that isn't working code as well.
-
tye
(but my friends call me "Tye")
| [reply] |