in reply to My Code Is Functional...But Not Tidy :(
Oh - use CGI::Lite for your HTML outputting, or, better, use HTML::Template. Always try to separate presentation from logic.# Above all others, add: use strict; # Some stuff here my %connection = ( pop3 => { PeerAddr => 'mail.test.com', PeerPort => 110, }, # Add the others here, like above ); my %socket; while (my ($name, $values) = each %connections) { $socket{$name} = IO::Socket::INET->new( Timeout => 1, Proto => 'tcp', ( map { $_ => $values->{$_} } keys %$values ), ); } my $UP = 'Up'; my $DOWN = 'Down'; my $mail = ($socket{pop3} && $socket{smtp} ? $UP : $DOWN); # Do other checks here
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
|
|---|