1、
File::Basename modules: 根据路径分离出文件的路径名、文件名或者扩展名。
use File::Basename;
($filename, $directories, $suffix) = fileparse($path);
2、
File::Spec modules: 与File::Basename相反, 将文件名和目录名结合以取得文件的全名。
use File::spec;
##which returns 'a/b/c' under Unix
$x=File::Spec->catfile('a', 'b', 'c');
3、CGI.pm
4、Net::smtp modules: 发送邮件
5、Tie::File module: Access the lines of a disk file via a Perl array
通过perl数组来访问文件的每行
%7Emjd/Tie-File-0.96/lib/Tie/File.pm#___top
6 Date::Manip: 日期操作模块。
my $date=&DateCalc("today","-1 days", 0);#获取昨天的日期;
7 use MIME::Lite
use Net::SMTP ##发送邮件所使用的模块,并且可以发送各种类型的附件,指定发件人和收件人。
my $from_address = 'xx@163.com';
my $to_address = 'xx@sina.com';
my $mail_host = 'mail.server.net';
my $result=' access';##body
### Adjust subject and body message
my $subject = 'check';
### Adjust the filenames
my $my_file_html = 'index.html';
my $your_file_html = 'index.html';
### Create the multipart container
$msg = MIME::Lite->new (
From => $from_address,
To => $to_address,
Subject => $subject,
Type =>'multipart/mixed'
) or die "Error creating multipart container: $!\n";
### Add the text message part
$msg->attach (
Type => 'TEXT',
Data => $result,
) or die "Error adding the text message part: $!\n";
### Add the html file
$msg->attach (
Type => 'HTML',
Path => $my_file_html,
Filename => $your_file_html,
Disposition => 'html'
) or die "Error adding $file_html: $!\n";
### Send the Message
MIME::Lite->send('smtp', $mail_host, Timeout=>60);
$msg->send;
阅读(485) | 评论(0) | 转发(0) |