I want to pass only the servers that are online. When doing this I'm lose the information when passing the variable($filelock). If I do a print statement in the first sub I can see the servers that are online, but once I pass the variable $filelock I get nothing. What am I doing wrong?
Thanks
####.pm file####
sub sieve_util_set_flagfile
{
my($relay_dir,$home_dir,$filename,@lock) = @_;
my $filelock;
foreach my $filelock (@lock)
{
if (my $ftp = Net::FTP->new($filelock))
{
#die "Cannot login: $@ "unless $ftp;
# Log into the server
$ftp->login ("$uid", "$pass");
# Change to the right directory
$ftp->cwd ("$relay_dir");
# Change to binary transfer mode
$ftp->binary;
@check_dir = $ftp->ls($relay_dir);
if ($ftp->put($filename,$flag_file))
{
$ftp->quit;
}
else
{
sieve_util_generic_error ("Unable to put $flag_file in $relay
+_dir. The file is not locked from other users.");
}
}
else
{
next;
}
}#end foreach
return ($uid,$pass,$filelock);
}
###.cgi file#####
($uid, $pass,$filelock) = sieve_util_set_flagfile($relay_dir,$home_dir,$filename,@lock);
sieve_util_remove_page($relay, $filename, $int_ext,$filelock);
####.pm file####
sub sieve_util_remove_page
{
my $relay_label;
my ($relay, $filename, $int_ext,$filelock) = @_;
if ($int_ext =~ /^int/i)
{
$relay_label = "Internal Relay: $filelock";
}
else
{
$relay_label = "External Relay: $filelock";
}
print start_html(-title=>"Sieve Filter Administration",),
"<div align=\"center\">\n",
br(br(br(h2(b("Removed!"))))),
h3(b("The file lock on $filelock has been removed!")),
hidden(-name=>"tflag",
-default=>"$int_ext");
print end_html();
exit;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.