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

Being new to embedded Perl, I attempted to try the example posted on cpan.org. Everything compiles and runs well until I get to perl_parse(). Tells me it can't find my file to parse. Odd... to make things easy I just stuck it in the executable's path and provided the file name in argv (just like the example). Is a full path needed or any other env vars?

For those not familar with the cpan posting. http://search.cpan.org/~nwclark/perl-5.8.6/pod/perlembed.pod#Adding_a_Perl_interpreter_to_your_C_program

Replies are listed 'Best First'.
Re: Embedded Perl
by Thelonius (Priest) on Apr 11, 2005 at 13:20 UTC
    I assume that it will act as if you type "perl foo.pl" on the command line--i.e. look for "foo.pl" in the current working directory.

    If you are starting your program some way other than the command line (e.g., from IDE or double-clicking), you'll have to figure out what the CWD is or change it with chdir().

Re: Embedded Perl
by polettix (Vicar) on Apr 11, 2005 at 13:32 UTC
    Can you post the exact code you're using, including the configuration of the env vars? If you're on Win32, try to see if it's a trivial backslashes problem (i.e. a backslash has to be inserted as "\\" instead of a simple "\", due to the fact that it's used for escaping chars in C).

    Flavio (perl -e "print(scalar(reverse('ti.xittelop@oivalf')))")

    Don't fool yourself.