use strict;
use warnings;
use CGI::Pretty ();
use URI ();
my $cgi = CGI::Pretty->new();
print
$cgi->header(),
$cgi->start_html(),
$cgi->h3("CAN I HAZ PURL?"),
$cgi->h4("YUR DOIN IT RONG"),
$cgi->blockquote( yours($cgi) ),
$cgi->h4("YUR DOIN IT... PRETY GUD AKSHULY"),
$cgi->blockquote( mine($cgi) ),
$cgi->end_html();
exit 0;
sub yours {
my $cgi = shift;
$cgi->url(-relative=>1) . '?a=';
}
sub mine {
my $cgi = shift;
my $uri = URI->new( $cgi->url );
( my $path = $uri->path ) =~ s![^/]+\z!!;
$uri->path( $path || "/" );
$uri->query_form( a => undef );
$uri;
}
CAN I HAZ PURL?
YUR DOIN IT RONG
pm-805175.cgi?a=
YUR DOIN IT... PRETY GUD AKSHULY
http://localhost/cgi/?a=
|