Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^4: Doubts of a perl beginner on PERLEMBED

by jithoosin (Scribe)
on Dec 17, 2005 at 11:40 UTC ( [id://517470]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Doubts of a perl beginner on PERLEMBED
in thread Doubts of a perl beginner on PERLEMBED

Hi

The reason for not combining 2 different files is that they are for different functionality.One for extracting html tags from a html file anc checking whether which all browser version supports them and other file is for checking the html error in they file using "TIDY". And i donot believe in combining 2 different files which provides entirely different functionalities to complicate matters.

Actually previously these 2 files have been called by "system" command in C and "popen" was used for passing and getting arguments between C and perl.But this reduced speed of execution. So i am trying to increase the speed by embedding perl in C

Any way THANKS for all your replies and suggestion & helping novices like me.Always keep this good mind with you.
  • Comment on Re^4: Doubts of a perl beginner on PERLEMBED

Replies are listed 'Best First'.
Re^5: Doubts of a perl beginner on PERLEMBED
by robin (Chaplain) on Dec 17, 2005 at 15:25 UTC
    If you're calling the Perl code repeatedly from the C, that's a reasonable thing to do, because you need only compile it once.

    The best way to do it is probably to make sure all your Perl code is in subroutines (so running the script from the command-line) doesn't actually do anything), and that you don't have any name clashes between the two files. (Use separate packages if necessary.)

    Then load both the files in, by parsing (perl_parse) and executing (perl_run) a one-liner that requires them both, as I indicated earlier. Once you've done that, you can call your subs using one of the call_* functions described in perlcall.

    Good luck! Embedding perl is a pretty “advanced” topic for a self-described perl beginner. Good for you for not being afraid to try! But don't expect it to be particularly easy or clearly documented...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-19 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found