On Dec 11, 10:52 am, rvtol+use...@isolution.nl (Dr.Ruud) wrote:
> C.DeRykus wrote:
> > Dr.Ruud:
> >> C.DeRykus:
> >>> eval { asub() };
> >>> die $@ if $@;
>
> >> You need to test the return of eval itself to be sure.
>
> ...
> perl -wle '
>
> die "An error: ", $@ || "whoopy"
> i
C.DeRykus wrote:
Dr.Ruud:
C.DeRykus:
eval { asub() };
die $@ if $@;
You need to test the return of eval itself to be sure.
Example:
perl -wle '
die "An error: ", $@ || "whoopy"
if !eval{ asub(); 1 };
sub asub{ my $x = bless {}, "main"; 1 / 0 }
sub DESTROY{ $@ =
On Dec 10, 1:21 pm, rvtol+use...@isolution.nl (Dr.Ruud) wrote:
> C.DeRykus wrote:
> > On Dec 8, 1:57 am, dery...@gmail.com (C.DeRykus) wrote:
> >> On Dec 8, 12:08 am, an...@melerit.se (Anders Hartman) wrote:
> >> Also, in this case, I'd write the eval for compile-time and check
> >> for errors:
>
>
On Dec 10, 12:57 pm, shawnhco...@gmail.com (Shawn H Corey) wrote:
> C.DeRykus wrote:
> > On Dec 8, 1:57 am, dery...@gmail.com (C.DeRykus) wrote:
> >> On Dec 8, 12:08 am, an...@melerit.se (Anders Hartman) wrote:
>
> >>> ...
>
> >> ...
> >> Also, in this case, I'd write the eval for compile-time and
C.DeRykus wrote:
On Dec 8, 1:57 am, dery...@gmail.com (C.DeRykus) wrote:
On Dec 8, 12:08 am, an...@melerit.se (Anders Hartman) wrote:
Also, in this case, I'd write the eval for compile-time and check
for errors:
eval { asub() };
die $@ if $@;
No, sorry, that's a "useless use of
C.DeRykus wrote:
> On Dec 8, 1:57 am, dery...@gmail.com (C.DeRykus) wrote:
>> On Dec 8, 12:08 am, an...@melerit.se (Anders Hartman) wrote:
>>
>>> ...
>
>> ...
>> Also, in this case, I'd write the eval for compile-time and check
>> for errors:
>>
>> eval { asub() };
>> die $@ if $@;
>>
>
On Dec 8, 1:57 am, dery...@gmail.com (C.DeRykus) wrote:
> On Dec 8, 12:08 am, an...@melerit.se (Anders Hartman) wrote:
>
>> ...
> ...
> Also, in this case, I'd write the eval for compile-time and check
> for errors:
>
> eval { asub() };
> die $@ if $@;
>
No, sorry, that's a "useless us
On Dec 8, 12:08 am, an...@melerit.se (Anders Hartman) wrote:
> Hello,
>
> I which to use eval to execute subroutines dynamically.
>
> The following code snippet fails:
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> sub asub {
> our $abc;
> print $abc;
>
> }
>
> my $abc = "abc\n";
> e
pa...@arcor.de wrote:
> Well, the OP said the method name is changing during the running time, so he
> want to eval the method name.
> So a AUTOLOAD method is right for him as far as I can think.
AUTOLOAD introduces the possibility of code injection. So does eval.
If the code is running on a ser
- Original Nachricht
Von: Shlomi Fish
An: beginners@perl.org
Datum: 08.12.2009 12:08
Betreff: Re: Eval scoping question
> On Tuesday 08 Dec 2009 12:18:10 Jeff Pang wrote:
> > Shlomi Fish:
> > > On Tuesday 08 Dec 2009 11:46:59 Jeff Pang wrote:
On Tuesday 08 Dec 2009 12:18:10 Jeff Pang wrote:
> Shlomi Fish:
> > On Tuesday 08 Dec 2009 11:46:59 Jeff Pang wrote:
> >> Shlomi Fish:
> >>> Regarding using string eval "" - you can do the same using
> >>> UNIVERSAL::can, which would be safer in this case:
> >>>
> >>>
> >>> __PACKAGE__->can("a
Shlomi Fish:
On Tuesday 08 Dec 2009 11:46:59 Jeff Pang wrote:
Shlomi Fish:
Regarding using string eval "" - you can do the same using
UNIVERSAL::can, which would be safer in this case:
__PACKAGE__->can("asub")->(@params);
or define a package and use AUTOLOAD method?
How will the AUTOL
On Tuesday 08 Dec 2009 11:46:59 Jeff Pang wrote:
> Shlomi Fish:
> > Regarding using string eval "" - you can do the same using
> > UNIVERSAL::can, which would be safer in this case:
> >
> >
> > __PACKAGE__->can("asub")->(@params);
>
> or define a package and use AUTOLOAD method?
>
How will
Shlomi Fish:
Regarding using string eval "" - you can do the same using UNIVERSAL::can,
which would be safer in this case:
__PACKAGE__->can("asub")->(@params);
or define a package and use AUTOLOAD method?
--
Jeff Pang
http://home.arcor.de/pangj/
--
To unsubscribe, e-mail: beginner
2009/12/8 Anders Hartman :
>>> Hello,
>>> I which to use eval to execute subroutines dynamically.
>>> The following code snippet fails:
>>>
>>> #!/usr/bin/perl
>>>
>>> use strict;
>>> use warnings;
>>>
>>> sub asub {
>>> our $abc;
>>> print $abc;
>>> }
>>>
>>> my $abc = "abc\n";
>>> eval "asub";
On Tuesday 08 Dec 2009 11:03:44 Anders Hartman wrote:
> Jeff Pang skrev:
> > Anders Hartman:
> >> Hello,
> >>
> >> I which to use eval to execute subroutines dynamically.
> >>
> >> The following code snippet fails:
> >>
> >>
> >> #!/usr/bin/perl
> >>
> >> use strict;
> >> use warnings;
> >>
> >> su
Jeff Pang skrev:
Anders Hartman:
Hello,
I which to use eval to execute subroutines dynamically.
The following code snippet fails:
#!/usr/bin/perl
use strict;
use warnings;
sub asub {
our $abc;
print $abc;
}
my $abc = "abc\n";
eval "asub";
exit 0;
I don't think you want an eval here
Anders Hartman:
Hello,
I which to use eval to execute subroutines dynamically.
The following code snippet fails:
#!/usr/bin/perl
use strict;
use warnings;
sub asub {
our $abc;
print $abc;
}
my $abc = "abc\n";
eval "asub";
exit 0;
I don't think you want an eval here.
use strict;
use
Hello,
I which to use eval to execute subroutines dynamically.
The following code snippet fails:
#!/usr/bin/perl
use strict;
use warnings;
sub asub {
our $abc;
print $abc;
}
my $abc = "abc\n";
eval "asub";
exit 0;
with the error:
Use of uninitialized value in print at ...
asub shoul
19 matches
Mail list logo