<snip...>

> i am writing all the error message as print command on the STDOUT
presently
in my program.
please let me know what is the standard process  to create a log of error
message. whether i will write into a file all the logs and email it to a
address? if so please let me know the commands to open and write some
message into a file and send it to a email address.

If you use warn instead of print to output errors, they will be sent to
STDERR instead of STDOUT.  You can then use standard UNIX redirection
operators to write errors to a log file.  For example:

warn "This is an error";

is how you use warn, and:

foo.pl 2>> error.log

is how you redirect STDERR flows from the perl script "foo.pl" and append
to the error file "error.log".

> b) please also let me know how to catch any NET::FTP error (e.g: The
connection is not open or the FTP had not taken place properly, the get
command didn't executed etc)

You can capture the Net::FTP errors from the $! variable.  For example,
opening a connection to a remote server:

...
my $Hostname = "foo.co.uk";
my $Username = "fred";
my $Password = "Flintstone";
my $Ftp = Net::FTP->new($Hostname, Debug => 1) || warn "Cannot connect to
$Hostname: $!);
$Ftp->login($Username, $Password) || warn "Cannot log on: $!);
...

Setting Debug => 1 will also output useful error messages should something
go wrong.

HTH,

PJM.

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to