Yes but i was trying to trap a syntax error in the expression such as a typo
(eg when Perl compiles the expression rather then evaluates it) such as...
(notice the D)...
host = perl_eval_pv("usDe Sys::Hostname; my $t = hostname; $t =~
s/\\..*$//; $t", FALSE) ;
Which is a totally different case.
Thanks for your suggestion though.
Rich
-----Original Message-----
From: Stanley Hopcroft [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 27, 2003 11:53 AM
To: rwilding
Cc: 'Nick Ing-Simmons'; '[EMAIL PROTECTED]'
Subject: Re: Embedded perl question
Dear Sir,
This fragment
host = perl_eval_pv("use Sys::Hostname; my $t = hostname; $t =~
s/\\..*$//; $t", FALSE) ;
if ( SvTRUE(ERRSV) ) {
warn("SambaPtr::my_hostname() died somewhere in
eval_pv(..hostname): %s", ERRSV) ;
return NULL ;
}
seems to happily trap any run-time errors (when Sys::Hostname failes to
return) in a variety of Perl5s.
>From the 5.005_03 man page, perlguts
perl_eval_pv
Tells Perl to eval the given string and return an
SV* result.
SV* perl_eval_pv (char* p, I32
croak_on_error)
There is no mention of the string having to contain its own eval ''.
HTH.
Yours sincerely.
--
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------
'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'
from Meditation 17, J Donne.