ASP4x-Router
view release on metacpan or search on metacpan
- Properly sets $ENV{QUERY_STRING} when running in a mod_perl2 environment.
2010-04-10 v0.014
- Fixed a bug that caused $Stash->{route} to not always be accessible.
2010-04-08 v0.013
- $r->pnotes(route) is set even if we don't do routing. This makes routing more consistent.
2010-04-06 v0.012
- Handlers are now also covered by the "don't-route-if-the-file-actually-exists"
logic from v0.010-v0.011.
- Added tests to verify the new behavior.
2010-04-06 v0.011
- Finished the whole "don't-route-if-the-file-actually-exists" thing that was
started in v0.010
- Requires ASP4 v1.025 because of a change in the way that $Config->web->router
is setup (now it actually happens inside of ASP4::ConfigNode::Web.
2010-04-05 v0.010
- If /foo/bar.asp is a real file on disk then route-matching will be skipped.
2010-03-27 v0.006
- The TransHandler handler was not passing along $r->args properly.
2010-03-26 v0.005
- The mod_perl handler sets $r->pnotes(__routed => 1), which the ASP4::TransHandler
now checks before performing any additional routing. Otherwise we end up
doing twice the work!
2010-03-26 v0.004
- The logic used for finding/constructing the router is updated.
- Updated POD.
- Downgraded Apache2::RequestRec requirement to a 'recommends'.
- Added dynamic inheritance based on whether requiring ASP4::TransHandler works or not.
- ASP4x::Router now will test for the existence of each matched uri from $router->match(...)
until it finds one that exists on disk.
2010-03-24 v0.003
- Added prereq Apache2::RequestRec since that's needed for ASP4::TransHandler.
2010-03-23 v0.002
inc/Module/Install/Fetch.pm view on Meta::CPAN
require Cwd;
my $dir = Cwd::getcwd();
chdir $args{local_dir} or return if exists $args{local_dir};
if (eval { require LWP::Simple; 1 }) {
LWP::Simple::mirror($args{url}, $file);
}
elsif (eval { require Net::FTP; 1 }) { eval {
# use Net::FTP to get past firewall
my $ftp = Net::FTP->new($host, Passive => 1, Timeout => 600);
$ftp->login("anonymous", 'anonymous@example.com');
$ftp->cwd($path);
$ftp->binary;
$ftp->get($file) or (warn("$!\n"), return);
$ftp->quit;
} }
elsif (my $ftp = $self->can_run('ftp')) { eval {
# no Net::FTP, fallback to ftp.exe
require FileHandle;
my $fh = FileHandle->new;
local $SIG{CHLD} = 'IGNORE';
unless ($fh->open("|$ftp -n")) {
warn "Couldn't open ftp: $!\n";
chdir $dir; return;
}
my @dialog = split(/\n/, <<"END_FTP");
open $host
user anonymous anonymous\@example.com
cd $path
binary
get $file $file
quit
END_FTP
foreach (@dialog) { $fh->print("$_\n") }
$fh->close;
} }
else {
warn "No working 'ftp' program available!\n";
chdir $dir; return;
}
unless (-f $file) {
warn "Fetching failed: $@\n";
chdir $dir; return;
lib/ASP4x/Router.pm view on Meta::CPAN
%>
<a href="<%= $Server->HTMLEncode( $uri ) %>">Edit this Truck</a>
Comes out like this:
<a href="/main/truck/123/edit/">Edit this Truck</a>
=head1 DESCRIPTION
For a gentle introduction to URL Routing in general, see L<Router::Generic>, since
C<ASP4x::Router> uses L<Router::Generic> to handle all the routing logic.
Long story short - URL Routing can help decouple the information architecture from
the actual layout of files on disk.
=head2 How does it work?
C<ASP4x::Router> uses L<Router::Generic> for the heavy lifting. It functions as
both a mod_perl C<PerlTransHandler> and as a L<ASP4::RequestFilter>, providing the
same exact routing behavior for both L<ASP4::API> calls and for normal HTTP requests
handled by the mod_perl interface of your web server.
( run in 1.210 second using v1.01-cache-2.11-cpan-49f99fa48dc )