博客首页 注册 建议与交流 排行榜 加入友情链接
推荐 投诉 搜索: 帮助

系统※网络技术实验室

System & Databses & Networking & Security & Services
evegl.cublog.cn
自己写了一个base64的程序
#!/usr/bin/perl -w
use Getopt::Long;
use MIME::Base64;
use strict;
sub usage ();
sub print_help ();
sub process_arguments ();
sub usage()
{
  print STDERR << "EOF";
Missing arguments!
Usage:base64 [OPTION] [STRINGS]
-e, --encode          Encode data.
-d, --decode          Decode data.
-h, --help            Display this help and exit.
EOF
   exit 1;
}
sub print_help()
{
  print STDOUT << "EOF";
Usage:base64 [OPTION] [STRINGS]
-e, --encode          Encode data.
-d, --decode          Decode data.
-h, --help            Display this help and exit.
EOF
   exit 0;
}
my ($status,$encode,$decode,$help);
sub process_arguments() {
   GetOptions(
        "e=s" => \$encode,"encode" => \$encode,
        "d=s" => \$decode,"decode" => \$decode,
        "h"   => \$help,"help" => \$help
   );
   print_help() if $help;
  
}
if (@ARGV == 0) {
   usage();
}
process_arguments();
print encode_base64("$encode") if $encode;
print decode_base64("$decode") if $decode;
print "\n";
exit 0;

发表于: 2008-01-18,修改于: 2008-01-18 15:02,已浏览232次,有评论0条 推荐 投诉

给我留言
版权所有 ChinaUnix.net 页面生成时间:2.47392