%# Never call a man a fool; borrow from him. % if ($verbatim) { % $m->print($foo); % } else { <% $foo %> % } <%INIT> use Encode::Guess qw(utf8 big5); require WWW::Mechanize; require URI::Escape; my $ua = WWW::Mechanize->new; my $p4web = "$RT::WebBaseURL:5000"; $URL =~ s,cd=/(?!/depot),cd=/depot/,g; $URL =~ s,\@/(?!/depot),\@/depot/,g; $URL =~ s,//depot//depot,//depot,g; $ua->get($URL || "$p4web/depot/" . $QueueObj->OriginObj->CustomFieldValue('UnixName') . '/' . $Base); my $foo = $ua->content; my $verbatim = 1; if ($URL =~ /sr=1/) { $m->print('
');
    $foo = Encode::decode('Guess', $foo);
    $verbatim = 0;
}
elsif ($URL =~ /ac=64/) {
    $foo =~ s/&#(\d+);/chr($1)/eg;
    $foo = Encode::decode('Guess', $foo);
}
my $base = $1 if $foo =~ //;
$foo =~ s/.*//s;
$foo =~ s!!!s;
$foo =~ s!!!;
$foo =~ s/  
.*//s; $foo =~ s!]+>//!!g; $foo =~ s!]+>depot!!g; $foo =~ s!//depot!!g; $foo =~ s!\((]+>)\w+\)!"($1".loc("Content").")"!eg; $foo =~ s!Type: \w+   !!; $foo =~ s!Client: //.*!!; $foo =~ s!

!!g; $foo =~ s!\s+Client:\s+\w+\s+!!g; $foo =~ s!<[Bb]>([ \w]+):!"".loc($1).":"!eg; $foo =~ s!(#\d+ )(add|delete|edit|branch|integrate)!$1.'('.loc(ucfirst($2)).')'!eg; $foo =~ s!Showing.*:
!!; $foo =~ s//ALT=" ">/g; $foo =~ s{ <%ARGS> $URL => '' $Base => "" $QueueObj