perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leon Brocard <le...@iii.co.uk>
Subject Dynamic URI query strings
Date Wed, 07 Jun 2000 11:10:17 GMT
Heya,

I coming across a problem and I'm hoping that someone has solved it
in a slightly cleaner way than I have.

We have Embperl pages which include Embperl "components". These
components need to link to the same pages but with additional parameters
(intended for the component) passed in the URL. [The components
are done with Execute($name, \%conf)]

ie the page is called with:
/investment/detail.epl?code=FOO&display=WOTSIT&it=BAR
but the component wants to link to:
/investment/detail.epl?code=007&display=WOTSIT&it=BAR&new=YES

The way I have done it is for the page to pass the component
a "prefix" URI, which the component then manipulates. I haven't
found a Perl module which'll do what I want, so I've had to come
up with the following which uses the CGI and URI modules:

my $uriprefix = '/investment/detail.epl?code=FOO&display=WOTSIT&it=BAR';
my $uri = URI->new($uriprefix);
$uriprefix = $uri->query();
my $q = CGI->new($uriprefix);
$q->param('code', '007');
$q->param('new', 'YES');
$uriprefix = $uri->path . '?' . $q->query_string;
print $uriprefix, "\n";

Have I missed something? Is there a module on CPAN which makes this
manipulation easier? Should there be?

Cheers, Leon
--
Leon Brocard   |   perl "programmer"   |   leon.brocard@iii.co.uk

Mime
View raw message