Quickly finding a quarantined message - was: RE:[Mimedefang]action_discard
Kevin A. McGrail
kmcgrail at pccc.com
Wed May 9 22:30:44 EDT 2007
I have personally had this bite me but perhaps it is simply because I always use & to indicate a function call. As you stated, dropping the & does change the behavior.
The following snippet prints just once for me when most programmers would expect it not to print at all.
&test("testing should not print");
sub test {
my ($test) = @_;
&test2;
&test2();
}
sub test2 {
my ($test2) = @_;
print $test2;
}
In any case, I would still recommend the () but only because I also recommend the &. Thanks for the tip though. It's one of the reasons I like this list.
Regards,
KAM
On Wed, May 09, 2007 at 11:26:38PM +0200, Jan-Pieter Cornet wrote:
> On Wed, May 09, 2007 at 04:00:39PM -0400, Cormack, Ken wrote:
> > > Great idea! One enhancement is I think you might want to call it as
> > > get_quarantine_dir() otherwise I think perl will pass @_ from your current
> > > scope. Currently, the function takes no params but who knows next week...
>
> Err... this is not true. While get_quarantine_dir(); is preferred over
> get_quarantine_dir; they both mean exactly the same: call the function
> with an empty argument list. Using brackets just makes it clearer to
> the read that it's a function call.
>
> If you want to pass the current arguments in @_, you'll have to
> explicitly call it as &get_quarantine_dir; (note: no brackets).
>
> See:
> perldoc -q '&foo'
> man perlsub
More information about the MIMEDefang
mailing list