> On Dec 1, 2003, at 6:22 AM, Ramprasad A Padmanabhan wrote: > [..] > > Instead Can I just embed this perl code in my c program > > I will be happy if someone can give some links to examples > on the net > > <http://www.perldoc.com/perl5.6/pod/perlembed.html>
That is very very sexxy! I was reading the part at: http://www.perldoc.com/perl5.6/pod/perlembed.html#Adding-a-Perl-interpreter-to-your-C-program Which will let you run perl code/file containing perl code supplied as an argument. Very cool. What I was wondering about was how to execute some perl code *inside* the c program instead of takign it via ARGV. I think eval_pv and eval_sv have somethgin to do with it but I'm a bit cloudy there. Since I don't know hardly anythgin about C I'll illustarte it in Perl. my $perlcode = <<CODE; # instead of getting this via command line argument sub simplepage { my $name = shift || 'world'; use CGI qw(header param); print header() print "I am perl hear me roar $name\n"; print insult(); } sub insult { return "So is ytour mother\n"; } return simplepage(param('name')); CODE printf eval_pv($perldoc); Basically execute bunch of code, from a one liner to a bunch of lines, that basically ends with one return value(an html webpage) and then print that value out. What Id' really like to be able to do is compile it as simplepage.cgi and see if I can get it to do me a little page: http://www.whatever.com/simplepage.cgi Or http://www.whatever.com/simplepage.cgi?name=waldo This is a very cool idea, I'd love to be able to make it work! Am I way off or any ideas?? TIA Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]