in reply to Pass arguments in URL

What freeze does is called serialising. You could serialise using Storable, but you didn't indicate any reason to do that.
use URI qw( ); sub url_freeze { my ($base_url, @args) = @_; return URI->new($base_url, 'http')->query_form(@args); } my $url = url_freeze('/cgi-bin/details', %args);

I may have the exact usage a bit off.

Replies are listed 'Best First'.
Re^2: Pass arguments in URL
by james2vegas (Chaplain) on Aug 23, 2010 at 19:08 UTC
    Usage is more like this:
    use URI; use strict; use warnings; my $hostname = 'localhost'; my $path = '/cgi-bin/details'; my $period = 4; my $vid = 11; my $person = 'abcdef'; my @args = ( period => $period, vid => $vid, person => $person ); my $url = URI->new("http://$hostname/"); $url->path($path); $url->query_form( \@args ); print $url->canonical;
    The URI accessors do not support chaining.

    Update: I misread the parent as using chained accessors, which it wasn't, this is just a little more verbose than that
      You changed
      ->query_form(@args);
      to
      ->query_form(\@args);
      but both are ok. So that leaves the bad return value. Fixed:
      use URI qw( ); sub url_freeze { my $url = URI->new(shift, 'http'); $url->query_form(@_); return $url } my $url = url_freeze('/cgi-bin/details', %args);

      It won't freeze recursively, of course.