TheHobbit has asked for the wisdom of the Perl Monks concerning the following question:
and then execute the resulting executable, then:cc -o test test.c -Wall `perl -MExtUtils::Embed -e ccopts -e ldopts`
It seems that $] has value 5,00503 instead of 5.00503...Argument "5,00503" isn't numeric in require at /usr/lib/perl5/5.005/i3 +86-linux/Config.pm line 7.
/*test.c*/ #include <EXTERN.h> /* from the Perl distribution */ #include <perl.h> /* from the Perl distribution */ #include <stdio.h> #include <locale.h> static PerlInterpreter *my_perl; /*** The Perl interpreter ***/ static char *perl_args[] = { "", "-e", "0", "-w" }; static char perl_script[] = { "use IO::Socket;\n" "my $sock = new IO::Socket::INET or die qq/Can't create socket!/;\n" "print qq/Done\n/;" }; extern void xs_init _((void)); extern void boot_DynaLoader _((CV * cv)); void xs_init () { char *file = __FILE__; /* this allows using dynamicaly loaded modules... see perlembed manpage*/ newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); } int main(int argc, char **argv, char **env) { setlocale (LC_ALL, ""); fprintf(stderr,"Locale value for NUMERIC is %s\n",setlocale(LC_NUMER +IC,NULL)); my_perl = perl_alloc(); perl_construct(my_perl); perl_parse(my_perl, xs_init, 4, perl_args, (char **)NULL); perl_eval_pv(perl_script,(I32) NULL); perl_destruct(my_perl); perl_free(my_perl); exit(0); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Embedded Perl, LC_NUMERIC and the $ variable.
by dchetlin (Friar) on Dec 10, 2000 at 22:07 UTC | |
|
Re: Embedded Perl, LC_NUMERIC and the $ variable.
by Fastolfe (Vicar) on Dec 07, 2000 at 00:43 UTC |