From: Don Armstrong Date: Wed, 20 Jun 2007 18:00:44 +0000 (+0100) Subject: Add maint_decode function to Debbugs::CGI X-Git-Tag: release/2.6.0~542^2~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=22137ecc7c8d9fc0417df2d281ba44e82e329d7c;p=debbugs.git Add maint_decode function to Debbugs::CGI --- diff --git a/Debbugs/CGI.pm b/Debbugs/CGI.pm index 3d1f2c4..13e4557 100644 --- a/Debbugs/CGI.pm +++ b/Debbugs/CGI.pm @@ -63,10 +63,11 @@ BEGIN{ util => [qw(cgi_parameters quitcgi), qw(getpseudodesc) ], + misc => [qw(maint_decode)], #status => [qw(getbugstatus)], ); @EXPORT_OK = (); - Exporter::export_ok_tags(qw(url html util)); + Exporter::export_ok_tags(qw(url html util misc)); $EXPORT_TAGS{all} = [@EXPORT_OK]; } @@ -554,6 +555,36 @@ sub bug_linklist{ } +=head1 misc + +=cut + +=head2 maint_decode + + maint_decode + +Decodes the funky maintainer encoding. + +Don't ask me what in the world it does. + +=cut + +sub maint_decode { + my @input = @_; + return () unless @input; + my @output; + for my $input (@input) { + my $decoded = $input; + $decoded =~ s/-([^_]+)/-$1_-/g; + $decoded =~ s/_/-20_/g; + $decoded =~ s/^,(.*),(.*),([^,]+)$/$1-40_$2-20_-28_$3-29_/; + $decoded =~ s/^([^,]+),(.*),(.*),/$1-20_-3c_$2-40_$3-3e_/; + $decoded =~ s/\./-2e_/g; + $decoded =~ s/-([0-9a-f]{2})_/pack('H*',$1)/ge; + push @output,$decoded; + } + wantarray ? @output : $output[0]; +} 1;