Hi Bob,

You gave me the following answer earlier:

   sub foo {

      local @ARGV = @_;
      GetOptions(...blah...);

      ...
   }

If I run it as a seperate script, commenting out the (local @ARGV = @_;)
line, then it works.  But it does not work when called as a subroutine from
within the main script. I have also tried (my @ARGV = @_;).
Any idea why?

Here is my code now:
=================================================
# Notify recipients via SMTP (email)
# Usage: notify_email -r [EMAIL PROTECTED] -r [EMAIL PROTECTED] -s "Subject 
line" -b
"Message body"
sub notify_email {
  local @ARGV = @_;   # Get the sub's params into the master param array for
GetOpt::Long
  $ENV{"NTsendmail"}  = $conf{'smtp'};
  $sender             = $conf{'smtpsender'};

  GetOptions ("r=s"  => [EMAIL PROTECTED],       # -r [EMAIL PROTECTED] -r 
[EMAIL PROTECTED]
-r [EMAIL PROTECTED]
              "s=s"  => [EMAIL PROTECTED],          # -s "This is the subject
line..."
              "b=s"  => [EMAIL PROTECTED]);            # -b "This is the message
body..."

  $subject    = join(" ", @subject);
  $body       = join(" ", @body);

  foreach $recipient (@recipients) {
    print "$sender, $recipient, $subject, $body\n";
    $mail = new NTsendmail;
    $mail->send($sender, $recipient, $subject, $body);
  }
}
=================================================

__________________________________________________________________________________________________________________________________

Standard Bank Disclaimer and Confidentiality Note

This e-mail, its attachments and any rights attaching hereto are, unless the 
context clearly indicates otherwise, the property of Standard Bank Group 
Limited and/or its subsidiaries ("the Group"). It is confidential, private and 
intended for the addressee only. 

Should you not be the addressee and receive this e-mail by mistake, kindly 
notify the sender, and delete this e-mail, immediately and do not disclose or 
use same in any manner whatsoever. 

Views and opinions expressed in this e-mail are those of the sender unless 
clearly stated as those of the Group. The Group accepts no liability whatsoever 
for any loss or damages whatsoever and howsoever incurred, or suffered, 
resulting, or arising, from the use of this email or its attachments.

The Group does not warrant the integrity of this e-mail nor that it is free of 
errors, viruses, interception or interference. 

Licensed divisions of the Standard Bank Group are authorised financial services 
providers in terms of the Financial Advisory and Intermediary Services Act, No 
37 of 2002 (FAIS).

For information about the Standard Bank Group Limited visit our website 
http://www.standardbank.co.za
___________________________________________________________________________________________________________________________________

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to