Skip to main content.
home | support | download

Back to List Archive

Re: Arguments to test_url

From: Peter Karman <peter(at)>
Date: Wed Feb 23 2005 - 17:10:10 GMT
I'll take a stab.

The short answer to your question is 'no', as it is, test_url() is not passed 
more than the uri and the server object as arguments. See about line 1309.
test_url() is called from within check_user_function() (around line 1054).

here's what actually gets passed to test_url() in check_user_function()

   eval { $ret = $sub->( $uri, $server, @_ ) };

so it looks like any other argument passed into check_user_function(), beyond 
the subref, the uri, and the server object, also gets passed on to &subref.

so you might do this, around line 1313:

-    return unless check_user_function( 'test_url', $u, $server );

+    return unless check_user_function( 'test_url', $u, $server. $base );

where $u is the url, $server is the object, and $base is the page you're on (I 
think). Add $base and check for it in your test_url code. Remember it's the 3rd 
param, so you'd have to do something like:

sub my_test_url
   my ($u, $server, $base) = @_;
  # etc...



Cliff Addy scribbled on 2/23/05 6:56 AM:
> I'm sure this has been asked before, but the archive search function seems
> to be broken ...
> Are there any arguments other that $uri passed to the test_url callback?
> Specifically, I'd like to know the current document that $uri was parsed
> from.
> The exact problem I'm trying to solve is looping around in a dynamic
> document area.  The document is a cgi with particular month/year arguments
> and links to the same cgi with next and previous months arguments are
> generated. is essentially following an infinite set of links,
> when I stopped it it had reached May 3752.
> My thinking is to skip a uri of .pl, .cgi, etc if the argument is a call
> to itself or at least skip links from a dynamic document to another one.
> However, to attempt that, I need to know what the current URL is.
> Cliff

Peter Karman  .  .  peter(at)
Received on Wed Feb 23 09:10:21 2005