in reply to Re: CGI Cookie Inconsistencies
in thread CGI Cookie Inconsistencies

Oh mother!

OBTAINING THE SCRIPT'S URL

print $cgi->redirect( -cookie => $sessionidCookie, -uri => url(-relative=>1).'?a=', );
:D

Replies are listed 'Best First'.
Re^3: CGI Cookie Inconsistencies
by Your Mother (Archbishop) on Nov 05, 2009 at 17:10 UTC

    ./ is likely only be the same directory as the script and not the script's URI so your suggestion is broken (not absolute) and likely to be wrong since most folks don't setup their CGIs to dispatch to "directory" names. :)

      I don't think so.

        And we were just discussing Dunning–Kruger the other day...

        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=
Re^3: CGI Cookie Inconsistencies
by Anonymous Monk on Nov 05, 2009 at 08:20 UTC
    Err, you want -absolute => 1 or
    CGI->new({a =>''})->self_url