procmail
[Top] [All Lists]

Re: passing variables to perl

2000-11-22 18:43:21
Collin Park <collin(_at_)cup(_dot_)hp(_dot_)com> writes:
Joel Dudley wrote:
:0
| /path/to/perl-scrip "$VAR1" "$VAR2"

add a semi-colon and tell us if that works:

:0
| /path/to/perl-scrip "$VAR1" "$VAR2" ;

The semicolon will tell procmail to invoke a shell.  VAR1, VAR2 will
be placed in the shell's environment.  When the shell sees $VAR1 and
$VAR2 in the line, it will replace those by the values it finds in the
environment.  

Except for slowing it down, adding the semicolon should have no
effect:  if a shell is not used to execute the action, procmail
performs the variable and command expansion and argument splitting for
itself.


Alternately, if your perl script could look in the environment and see 
what VAR1 and VAR2 have in them (rather than looking for 'em in
parameters) that should work without having to invoke a shell.

This is indeed the better solution.  All normal procmail variables are
exported to the environment and can be accessed from inside a perl script
using the %ENV hash, ala $ENV{VAR1}.


Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>