Skip to main content.
home | support | download

Back to List Archive

Re: test_url query string and path

From: Bill Moseley <moseley(at)>
Date: Wed Jun 07 2006 - 20:48:41 GMT
On Wed, Jun 07, 2006 at 01:35:46PM -0700, Jes Constantine wrote:
> my current test_url subroutine is:
> test_url => sub { $_[0]->path !~ 
> /(cms|staff|techstaff|groupnotes|search|webstat|usage|print=yes)$/ }

Won't work.

> after reading and 
> I learned that my pages made for print (with print=yes in a query 
> string) weren't being ignored because I was looking for print=yes in the 
> path and not the query.

(Use CSS for printing).

> So will putting $_[0]->query =~ /print=yes/ in my test_url subroutine  
> return  0 for something like: 
> If so, can someone help me with the syntax for adding to the subroutine? 
> (I'm a swish-e & perl beginner)

Here's one hint that might be helpful:

    test_url => sub {
        my $uri = shift;

        warn "Path is [", $uri->path, "]\n";


The $uri variable is a URI object.  So typing "perldoc URI" will explain the

Path is the path, not the query part:

$ perl -MURI -wle '$uri = URI->new(""); print $uri->path; '

You have a few options:

$ perl -MURI -wle '$uri = URI->new(""); print $uri->query'

$ perl -MURI -wle '$uri = URI->new(""); print $uri->query'

$ perl -MURI -wle '$uri = URI->new(""); %param = $uri->query_form; print $param{print}'

But using CSS for print is probably the best solution. ;)

Bill Moseley

Unsubscribe from or help with the swish-e list:

Help with Swish-e:
Received on Wed Jun 7 13:48:41 2006