[ic] Session Referer not as Expected

Mike Heins interchange-users@interchange.redhat.com
Sat Apr 13 01:57:01 2002


Quoting Orko (orko@eacceleration.com):
> > On Sat, 2002-03-30 at 12:35, Kevin Walsh wrote:
> > > > 
> > > > Is there somewhere central that I could tell IC to reset the referer if
> > > > it has changed, is valid and is not a cart referer?
> > > > 
> > > You could try something like this in your catalog.cfg file:
> > > 
> > >     Autoload <<EOA
> > >         [perl]
> > >             my $r = $Tag->env('HTTP_REFERER');
> > >             if ($r && $r !~ /^($Config->{VendURL}|$Config->{SecureURL})/){
> > >                 $Session->{referer} = $r;
> > >             }
> > >         [/perl]
> > >     EOA
> 
> Thanks again for the code Kevin.  
> 
> I just got to implementing this, and have a question, if anyone could
> answer it.  The docs describe the AutoLoad as:
> 
> <snip>
> 
> 3.7. Autoload
> 
> Sets an action that is automatically performed for every access. It is
> performed before any page parsing occurs, and before the action or page
> is even determined. Can contain ITL tags or a global
> subroutine name. If the return value is true, a normal display of
> $CGI->{mv_nextpage} will occur -- if it returns a false (zero, undef, or
> blank) value, no page will be processed.
> 
> As an example, to remap any mv_nextpage accesses to the private
> subdirectory of pages, set:
> 
> Autoload   [perl] $CGI->{mv_nextpage} =~ s:^private/:public/:; [/perl]
> 
> </snip>
> 
> With the perl that Kevin gave me at the top of this post, what would
> happen differently if I returned a true value from the AutoLoad?

Nothing.

> I'm
> having trouble understanding the phrasing:

Autoload also allows a subroutine reference, which obviates the need
for the ITL parsing. It is much faster.

> 
> "If the return value is true, a normal display of $CGI->{mv_nextpage}
> will occur -- if it returns a false (zero, undef, or blank) value, no
> page will be processed"
> 
> What does "no page will be processed" actually mean?

It means just that. If your routine did not call $Document->write() to
send out some HTML, nothing will be returned to the user.

-- 
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mheins@redhat.com>

Light travels faster than sound. This is why some people appear bright
until you hear them speak. -- unknown