Fwd: [rt-users] Execute Arbitrary Perl Script on resolve
Smylers
smylers at gbdirect.co.uk
Fri May 31 04:06:34 EDT 2002
Yesterday Michael Grubb wrote:
> Anyway if you *REALLY* want to just execute external perl code you
> could do something like this: <snip>
>
> # {{{ sub Prepare
> sub Prepare {
> my $self = shift;
> open(EXTPRG, "<" . $self->Argument()) or return 0;
> while(<EXTPRG>) { $prog_txt .= $_ }
> close(EXTPRG) or return 0;
> return 1;
> }
> # }}}
>
> sub Commit {
> my $self = shift;
> eval $prog_txt;
Surely the above open, while, close, and eval can be simplified to:
do $self->Argument();
Possibly you'd want to make sure the external script always returns true
if it succeeds, so that the return code gets propagated properly.
Smylers
--
GBdirect
http://www.gbdirect.co.uk/
More information about the rt-users
mailing list