Perl 报告生成模块代码

之前写的,现在用不上了。这个版本的报告比较不好看。。。所以现在不用了。但是代码上还是挺有价值的。

可以用来学习下,在这放出来,让想了解的人了解下。目前我使用的生成报告方式是一个HTML的模板。插入数据到HTML里面。

这个相对就有点你懂的。。

#!/usr/bin/perl

use threads; 
use threads::shared; #用于线程当中共享变量
use Thread::Semaphore;  #这个是线程信号量控制使用的包

share(@ok_list);

$task_domain='www.sohu.com';





#check_return_array("@tool_url",'163.com');
sub check_return_array{
    # 获得数据
    local($url)=shift;
    local($task_url)=shift;
    
    
    
    
##-------------------主调用程序(自定义报告输出名字)---------------
sub html_create{

     local($url)=shift;

     local($output)=shift;

     @report=pang_zhan($url);

     if($output eq undef)
     {
         if (-e "$url.html")
         {
               for my $i(1..10000)
               {
                  if (-e "$url($i).html")
                  {
                     next;
                     open FILE,">$url($i).html";
                  }
                  else
                  {
                     open FILE,">$url($i).html";
                     last;
                  }
                }
          }
          else
          {
              open FILE,">$url.html";
          }
    }
    else
    {
        open FILE,">$output.html";
    }
    
    print FILE "@report";

    close(FILE);
}

##-------------------主调用程序(报告输出根据网站名称)-------------
sub html_create_output{
     local($url)=shift;

     @report=pang_zhan($url);

     if($output eq undef)
     {
         if (-e "$url.html")
         {
               for my $i(1..10000)
               {
                  if (-e "$url($i).html")
                  {
                     next;
                     open FILE,">$url($i).html";
                  }
                  else
                  {
                     open FILE,">$url($i).html";
                     last;
                  }
                }
          }
          else
          {
              open FILE,">$url.html";
          }
    }
    else
    {
        open FILE,">$output.html";
    }
    
    print FILE "@report";

    close(FILE);
}

 

posted @ 2013-05-03 23:58  墨迹哥's  阅读(392)  评论(0编辑  收藏  举报