> Since i got so much help from here i decided to send out this script so you can look 
>at it. This script works for me, only on NT4+w2k though.
> 
> What it does is it prints an HTML page with all checkouts, for our clearcase system. 
>And the HTML is probably really bad written, since i just took it from a page i found 
>on the internet (but it works), all i wanted was the table. I want tips, on 
>optimizing, and things that can be done smaller and better. Changes goes inside the 
>box.
> 
> thanks for tips.
> 
> //Dave
> 
> use strict;
> my (@vobs,$vob,$view,$text,@views,@sviews,$viewname,$viewinfo);
> #########################################################
> my $errors = "F:\\temp\\checkouts.txt";
> my $html = "F:\\temp\\checkouts.html";
> my $webservershare = "\\\\server\\share";
> my $place = "Location";
> #########################################################
> $a = localtime(time);
> `del $errors`;
> open (HTML,">$html") or die "error: $!";
> print HTML "<html>\n<head>\n<title>ClearCase Views with checkouts</title>\n";
> print HTML "<meta http-equiv\=\"Content-Type\" content\=\"text/html\; 
>charset\=iso-8859-1\">\n";
> print HTML 
>"<style>\n\t.header{\n\tcolor:white;\n\tfont-weight:bold;\n\tfont-family:Arial, 
>sans-serif;\n\tfont-size:100%;\n\tbackground:black;\n\t}\n";
> print HTML "BODY{\nfont-family:Tahoma, Arial, 
>sans-serif;\n}\n\tTD{\n\tfont-size:11;\n\t}\n";
> print HTML "</style>\n<title> ClearCase views in $place with 
>checkouts</title>\n</head>\n<p style\=\"font-weight: bold;\">ClearCase views in 
>$place with checkouts\n";
> print HTML "<p> All clearcase views that have references (checkouts) in any vobs 
>vill be listed here<br>\n<p>This page was created $a<br>\n";
> print HTML "<p>\n<table border\=\"1\" cellpadding\=\"1\" cellspacing\=\"0\">\n<tr 
>class\=header>\n<td>View name\t\t</td>\n<td>View Type\t\t</td>\n<td>Vob 
>Name\t\t</td>\n";
> print HTML "<col><col><col align\=\"left\"><col align\=\"left\">\n";
> @vobs = `cleartool lsvob -s`;
> foreach $vob (@vobs)
> {
>     chomp $vob;
>     print "checkin $vob\n";
>     open (A, "cleartool desc -l vob:$vob |");
>     while (<A>)
>     {
>         if ($_ =~ /.uuid./i)
>         {
>             chomp $_;
>             $_ =~ s/.*\[uuid (.*)\]/$1/;
>             $view = `cleartool lsview -s -uuid $_ 2>&1`;
>             chomp $view;
>           if ($view =~ /.Error:./)
>                     {
>                         open (LOGFILE, ">>$errors") or die  "cant open $!";
>                         print LOGFILE "ERROR IN $vob:  $view\n";
>                     }
>                 else
>                     {
>                         $text = "$view $vob\n";
>                         push (@views,$text);
>                     }
>             }
>         }
>     }
>         @sviews = sort {lc $a cmp lc $b}@views;
>         print "Printing HTML to $html\n";
>         foreach $view (@sviews)
>         {
>             ($viewname, $vob) = split (/\s+/, $view);
>             $viewinfo = `cleartool lsview -l $viewname`;
>             if ($viewinfo =~ /snapshot/)
>                 {
>                     print HTML "<tr>\n\t<tr 
>bgcolor\=\"\#FFFF99\">\n\t<td>$viewname</td>\n\t<td>Snapshot</td>\n\t<td>$vob</td>";
>                 }
>                 else
>                 {
>                     print HTML "<tr>\n\t<tr 
>bgcolor\=\"\#FFFF99\">\n\t<td>$viewname</td>\n\t<td>Dynamic</td>\n\t<td>$vob</td>";
>                 }
>             }
>         
> close HTML;
> close LOGFILE;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to