Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

How to get comments printed as log statements?

by will_ (Scribe)
on Feb 07, 2011 at 15:50 UTC ( [id://886733]=perlquestion: print w/replies, xml ) Need Help??

will_ has asked for the wisdom of the Perl Monks concerning the following question:

Is there a module that can, when a comment is encountered in the code at run time, print it to a log?

Reason: I'm trying to understand a Mason template that has plenty of comments, but I don't want to waste time adding dozens of warn "got here" lines. I'd prefer to just see the comments logged from parts of the code that got executed

Replies are listed 'Best First'.
Re: How to get comments printed as log statements?
by BrowserUk (Patriarch) on Feb 07, 2011 at 16:08 UTC

    You should be able to tweak Smart::Comments to do this without too much effort.

    Personally, I use Devel::Trace for this sort of thing. It traces out every line of code as it runs, but I think you could fairly easily tweak it to only trace the comments.


    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.
Re: How to get comments printed as log statements?
by toolic (Bishop) on Feb 07, 2011 at 16:04 UTC
    I don't know how to do it without modifying the source code, but Smart::Comments is kinda what you're looking for. You would have to change every '# to '###'.
      A source filter in a mason template? I predict it won't work :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-23 13:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found