Angel has asked for the wisdom of the Perl Monks concerning the following question:
sub get_function my $self = shift; my $function = shift; my @arguments = @_; my $argument; my $result; my $code = '$result = $self->' . $self->{object_methods}{$function +} . '('; my $has_arguments; foreach $argument ( @arguments ) { $has_arguments = 1; $code .= "\'$argument\',"; } if( $has_arguments ) { chop $code; } $code .= ");"; print $code; eval $code; if( $@ ) { $self->{'error_type'} = "mail_merge_function error"; $self->{'error_string'} = "mail_merge_function error $@"; return( undef ); } else { return $result; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: eval inside an object
by ikegami (Patriarch) on Apr 27, 2005 at 16:47 UTC | |
Re: eval inside an object
by salva (Canon) on Apr 27, 2005 at 16:43 UTC | |
by dave_the_m (Monsignor) on Apr 27, 2005 at 17:47 UTC | |
Re: eval inside an object
by sir.shz (Novice) on Apr 27, 2005 at 18:00 UTC | |
by ikegami (Patriarch) on Apr 27, 2005 at 19:52 UTC | |
Re: eval inside an object
by g0n (Priest) on Apr 28, 2005 at 09:34 UTC | |
Re: eval inside an object
by eyepopslikeamosquito (Archbishop) on Apr 28, 2005 at 12:29 UTC | |
Re: eval inside an object
by moot (Chaplain) on Apr 27, 2005 at 16:34 UTC |