Fwd: [rt-users] Execute Arbitrary Perl Script on resolve

Michael Grubb mgrubb at fifthvision.net
Mon Jun 3 12:46:27 EDT 2002


Yes, You could,
I had forgotten the do "function", it would be a better solution.
than the open, while, close, eval. method.
But as I said in my post,
I was in a rush and  I threw that solution together to help.


On Friday 31 May 2002 03:06, Smylers wrote:
> 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





More information about the rt-users mailing list