in reply to Stripping part of URL
Just another way to do it:
The problem with this code is that the return value of URI::path_segments() changes if the URI contains a trailing slash or not. You could improve the robustness at the expense of added complexity by using map to squash the return of URI::path_segments() however:use strict; use warnings; use URI; my $uri = URI->new( $ENV{REQUEST_URI} ); my $page = ($uri->path_segments)[-2];
Kinda defeats the purpose of using methods from a module however. ;)my $page = (map $_ ? $_ : (), $uri->path_segments)[-1];
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|