perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Richter" <rich...@ecos.de>
Subject RE: returning errors from Execute
Date Thu, 16 Feb 2006 15:23:34 GMT
> 
> On 2/12/06, Kathryn Andersen <kat_lists@katspace.homelinux.org> wrote:
> > Why is that hard to parse?  Use perl regular expressions, 
> that's one 
> > of the things it is good at.
> >
> > You'd just have to go
> >
> > foreach (@errors) {
> >    if (/FIXME/) {
> >      # respond to this error
> >    }
> > }
> >
> > That should enable you to respond to all the "FIXME" errors.
> 
> I agree that this is easy to do in the case of errors which 
> are simply strings.  However I would like to be able to 
> return hash references as errors, such as
> with: croak \%error
> 
> The way that Execute returns errors right now, all I end up 
> with is the string representation HASH=0xdeadbeef.
> 

Sorry, but Embperl converts it to a string. There is currently no chance to
get the hash back.

Of course you can store the hash else where and return only a string and
retrive the hash from this other location.

E.g.

[-

$hashstore::error = \%hash ;
die "FIXME" ;

-]


And

foreach (@errors) {
    if (/FIXME/) {
      # respond to this error
	$hashstore::error -> holds the error
    }
}

That is not quite as elegant as returning hashs directly, but it should
work.

Gerald


 
** Virus checked by BB-5000 Mailfilter ** 


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message