You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Kee Hinckley <na...@somewhere.com> on 2001/04/17 20:45:30 UTC
Feature request: [$ hidden $] in URLs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'd like to be able to say:
<a href="foo.html?bar=1&[$ hidden $]">go there</a>
In a URL context it should result in a set of appropriate & separated
arguments with the fields that aren't currently represented in the
URL. That requires a bit of URL parsing, but it wouldn't have to be
done unless there was a hidden clause in the URL, so the performance
hit shouldn't be big.
If you want a specific example. I'm building a calendar package, and
one piece is a little calendar image, where each day is a link. It's
easy enough to make each link be of the form
"?day=1&month=10&year=2000" and that works fine, until you decide to
add something like searching. Then I'll need to preserve the search
terms across browsing the calendar, so now I need to change all the
links to "?day=1&month=10&year=2000&search=[+$fdat{search}+]". And
then of course some other argument gets added, and I need to add that
to the links... and so on.
So what I'd really like is for [$ hidden $] in a URL context to
expand to all the CGI arguments that don't currently exist in the
URL, but that are in %fdat.
- --
Kee Hinckley - Somewhere.Com, LLC
http://consulting.somewhere.com/consultants.html#kee
I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBOtyPWiZsPfdw+r2CEQLbXACeKLsx2vvjwA+mZEPh1/2nJgkqik8AoPqY
+tBLmQzQsTbi//hEqeIgFzbv
=AJQ3
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Feature request: [$ hidden $] in URLs
Posted by Gerald Richter <ri...@ecos.de>.
>
> After some thought I realized that Perl is interpreting the {}'s as a
> block. This solves problem #2.
>
> [+ my $foo = { %fdat, day => 1, month => 10, year => 2000 } +]
>
[+ scalar ( { %fdat, day => 1, month => 10, year => 2000 }) +]
works also
> However as I suspected, arguments that came into %fdat via duplicate
> entries do not get expanded correctly. The end up going out with a
> tab in them.
Aah, now I understand what you mean by duplicate entries. Yes you are right,
they are not splitted correctly and it only works correct, as longs as the
page that gets the arguments is a Embperl page. I put this on the TODO list.
You could write some code like this
[+ [ map { map { $key => $_ } split (/\t/, $fdat{$key = $_}) } keys
%fdat } ] +]
I don't have tested this great pieces of Perl code ;-), but it should do
it's job. (we use an arrayref instead of a hashref here)
>
> (Frankly, I'd *really* be happier if Embperl had a flag I could set
> to tell it to use array references in cases like that, instead of the
> tab hack. But that's a separate issue, and Embperl's just following
> the CGI convention.)
The "tab hack" is very old and mainly there for compatibility, I think about
it how to do it better...
Gerald
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925131
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Feature request: [$ hidden $] in URLs
Posted by Kee Hinckley <na...@somewhere.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
At 11:37 AM -0400 4/18/01, Kee Hinckley wrote:
>1. By duplicate entries, I mean will that expand a="foo\tbar" (which
>is the result of ?a=foo&a=bar) appropriately?
>2. I can't get that to work at all. It results in "?2000" when I do it.
After some thought I realized that Perl is interpreting the {}'s as a
block. This solves problem #2.
[+ my $foo = { %fdat, day => 1, month => 10, year => 2000 } +]
However as I suspected, arguments that came into %fdat via duplicate
entries do not get expanded correctly. The end up going out with a
tab in them. So long as the page that then processes them does in
fact use Embperl to process the arguments, and thus expects multiple
arguments to be tab-separated, then it will work okay, but I'd be
happier if it automatically expanded it into two arguments.
(Frankly, I'd *really* be happier if Embperl had a flag I could set
to tell it to use array references in cases like that, instead of the
tab hack. But that's a separate issue, and Embperl's just following
the CGI convention.)
- --
Kee Hinckley - Somewhere.Com, LLC
http://consulting.somewhere.com/consultants.html#kee
I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBOt3OVCZsPfdw+r2CEQLtSACfRKpIs9WYmp1evcxluR2N7cVCUQUAn2Fi
gXAzOD0nbozSGdlX3bwMWWTP
=Ienq
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Feature request: [$ hidden $] in URLs
Posted by Kee Hinckley <na...@somewhere.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
At 6:40 AM +0200 4/18/01, Gerald Richter wrote:
> >
>> At 9:50 AM +1000 4/18/01, Angus Lees wrote:
> > >"?[+ { %fdat, day => 1, month => 10, year => 2000 } +]"
>>
>> Neither of those techniques will handle duplicate entries, but they
>> definitely get me closer to a work-around. Thanks.
>
>What's Angus suggest above, is what I also would suggest to you. Why doesn't
>it handle duplicate entries ? The part between { and } is a Perl hash, so it
>will make sure every entry is unique. I think the above piece of code does
>exactly what you want (or I missunderstood your intention)
Two problems.
1. By duplicate entries, I mean will that expand a="foo\tbar" (which
is the result of ?a=foo&a=bar) appropriately?
2. I can't get that to work at all. It results in "?2000" when I do it.
- --
Kee Hinckley - Somewhere.Com, LLC
http://consulting.somewhere.com/consultants.html#kee
I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBOt20riZsPfdw+r2CEQL2/wCfUEb4niwdG1FUyO+513mxc4w9ZvAAn0z0
ZeYuc6LI1cZiPandqY22DA7v
=9Nnc
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Feature request: [$ hidden $] in URLs
Posted by Gerald Richter <ri...@ecos.de>.
>
> At 9:50 AM +1000 4/18/01, Angus Lees wrote:
> >"?[+ { %fdat, day => 1, month => 10, year => 2000 } +]"
>
> Neither of those techniques will handle duplicate entries, but they
> definitely get me closer to a work-around. Thanks.
What's Angus suggest above, is what I also would suggest to you. Why doesn't
it handle duplicate entries ? The part between { and } is a Perl hash, so it
will make sure every entry is unique. I think the above piece of code does
exactly what you want (or I missunderstood your intention)
Gerald
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925131
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Feature request: [$ hidden $] in URLs
Posted by Kee Hinckley <na...@somewhere.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
At 9:50 AM +1000 4/18/01, Angus Lees wrote:
>"?[+ { %fdat, day => 1, month => 10, year => 2000 } +]"
Neither of those techniques will handle duplicate entries, but they
definitely get me closer to a work-around. Thanks.
- --
Kee Hinckley - Somewhere.Com, LLC
http://consulting.somewhere.com/consultants.html#kee
I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBOtz+hiZsPfdw+r2CEQKFtACfQu+KxBV3XVqlc0vOMpxyGUoUlKYAnAhH
5zdBfsBB3EyNoP0Xnqk0s5hw
=9wXa
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Feature request: [$ hidden $] in URLs
Posted by Angus Lees <gu...@switchonline.com.au>.
On Wed, Apr 18, 2001 at 09:39:43AM +1000, Angus Lees wrote:
> On Tue, Apr 17, 2001 at 02:45:30PM -0400, Kee Hinckley wrote:
> > "?day=1&month=10&year=2000&search=[+$fdat{search}+]"
>
> its uglier to do it yourself, but not difficult:
>
> [!
> sub strip {
> my %copy = %fdat;
> delete @copy{@_};
> \%copy;
> }
> !]
>
> "?day=1&month=10&year=2000&[+ strip(qw(day month year)) +]"
alternatively, don't delete those keys, just override them..
"?[+ { %fdat, day => 1, month => 10, year => 2000 } +]"
--
- Gus
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Feature request: [$ hidden $] in URLs
Posted by Angus Lees <gu...@switchonline.com.au>.
On Tue, Apr 17, 2001 at 02:45:30PM -0400, Kee Hinckley wrote:
> "?day=1&month=10&year=2000&search=[+$fdat{search}+]"
its uglier to do it yourself, but not difficult:
[!
sub strip {
my %copy = %fdat;
delete @copy{@_};
\%copy;
}
!]
"?day=1&month=10&year=2000&[+ strip(qw(day month year)) +]"
--
- Gus
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org