[ic] help pulling info from URL

Kevin Walsh interchange-users@icdevgroup.org
Fri Nov 1 14:25:01 2002


Grant [listbox@email.com]
> 
> Racke and Duncan:
> I've got both of your setups set up and neither one is coming through for
> me.  I'm sure I'm messing up some mundane detail but I don't know what it
> is.  Here's my code:
> 
> [data session last_url]
> <br />
> 
> [perl]
> ($Scratch->{$pstn2}, $Scratch->{$pstn3}) = (split("/",
> $Session->{last_url}))[2,
> 3];
> [/perl]
> 
> [perl]
> $lasturl = '[data session last_url]';
> @parts = split ("/", $last_url);
> $Scratch->($pagename) = $parts[2];
> $Scratch->($pagenumber) = $parts[3];
> [/perl]
> 
> [scratch pagename], [scratch pagenumber]
> <br />
> [scratch pstn2], [scratch pstn3]
> 
> and here's my output:
> 
> /category/posters/p1.html
> 2 ,
> ,
> 
Have you considered using "$Scratch->{somekey}" rather than
"$Scratch->{$somekey}"?  (Note the spurious '$' characters in
your code.)

Try this instead:

[calc]
    ($Scratch->{pstn2},$Scratch->{pstn3}) = (split('/',$Session->{last_url}))[2,3];
    undef;
[/calc]
pstn2 = [scratch pstn2]<br>
pstn3 = [scratch pstn3]<br>

Just like other examples, that one is untested.  You'll be wanting
to buy a Perl book soon. :-)

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/