Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Embed: Using load_module

by BrowserUk (Patriarch)
on May 23, 2006 at 23:13 UTC ( [id://551251]=note: print w/replies, xml ) Need Help??


in reply to Embed: Using load_module

In addition to setting the line number as explained by joannis above, you can also set the filename using the same comment.

#line 1 "yourfile.pm"

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Embed: Using load_module
by sjfloat (Novice) on May 24, 2006 at 14:55 UTC
    Thanks all replicants:

    Firstly, I apologize; I seem to have lied in my original post. I am not using 'warn' but rather 'carp' in the perl module. The 'warn' function honors the '#line <NUM>' comment (and BrowserUk's '#file <NAME>' as well) just fine.

    Of course, being a DRY kinda guy, I'd rather not have to keep these directives synced with the *actual* line number and name. I tried putting a:

    # line 1

    at the top of the page, but apparently, intervening comment lines are not counted, so that the value it winds up using is a bit higher up in the file that it really is. At any rate, I'm using Carp in the module and it does *not* honor these directives.

    What I was really fishing for was a way to use load_module(), allowing the interpreter to search for and load the module in the expected way (have cake) and yet benefit from having used perl_parse()(eat cake). I poked around in the interpreter code a little, wondering if there was a clean way to, perhaps, steal the file name that load_module() determined, but was not obvious to me how I might do that. [please do pardon my parenthetical americanisms].

    Another long shot I tried was to push the arguments to the function of interest onto the stack and then call eval_pv() with *no* parameters, hoping the function would find it's parms waiting for it on the stack. But this did not produce the desired effect.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-25 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found