ASP4x-Router
view release on metacpan or search on metacpan
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-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
- Changed the email address in the config.
- Updated the POD with examples and more description.
2010-03-23 v0.001
--- #YAML:1.0
name: ASP4x-Router
version: 0.022
abstract: URL Routing for your ASP4 web application.
author:
- John Drago <jdrago_999@yahoo.com>
license: perl
distribution_type: module
test_requires:
Test::More: 0
requires:
Carp: 0
ASP4: 1.080
Router::Generic: 0.016
recommends:
Apache2::RequestRec: 0
no_index:
directory:
- t
Makefile.PL view on Meta::CPAN
use strict;
use warnings;
use inc::Module::Install;
use 5.008005;
name 'ASP4x-Router';
perl_version '5.008001';
license 'perl';
all_from 'lib/ASP4x/Router.pm';
test_requires 'Test::More' => '0';
requires 'ASP4' => '1.080';
requires 'Router::Generic' => '0.016';
recommends 'Apache2::RequestRec';
tests_recursive();
WriteAll();
inc/Module/Install/Makefile.pm view on Meta::CPAN
sub prompt {
shift;
# Infinite loop protection
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing, always use defaults
if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
}
}
sub makemaker_args {
my $self = shift;
inc/Module/Install/Makefile.pm view on Meta::CPAN
my $self = shift;
my $libs = ref $_[0] ? shift : [ shift ];
$self->makemaker_args( LIBS => $libs );
}
sub inc {
my $self = shift;
$self->makemaker_args( INC => shift );
}
my %test_dir = ();
sub _wanted_t {
/\.t$/ and -f $_ and $test_dir{$File::Find::dir} = 1;
}
sub tests_recursive {
my $self = shift;
if ( $self->tests ) {
die "tests_recursive will not work if tests are already defined";
}
my $dir = shift || 't';
unless ( -d $dir ) {
die "tests_recursive dir '$dir' does not exist";
}
%test_dir = ();
require File::Find;
File::Find::find( \&_wanted_t, $dir );
$self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir );
}
sub write {
my $self = shift;
die "&Makefile->write() takes no arguments\n" if @_;
# Make sure we have a new enough
require ExtUtils::MakeMaker;
# MakeMaker can complain about module versions that include
inc/Module/Install/Makefile.pm view on Meta::CPAN
# for details.
$self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ );
# Generate the
my $args = $self->makemaker_args;
$args->{DISTNAME} = $self->name;
$args->{NAME} = $self->module_name || $self->name;
$args->{VERSION} = $self->version;
$args->{NAME} =~ s/-/::/g;
if ( $self->tests ) {
$args->{test} = { TESTS => $self->tests };
}
if ($] >= 5.005) {
$args->{ABSTRACT} = $self->abstract;
$args->{AUTHOR} = $self->author;
}
if ( eval($ExtUtils::MakeMaker::VERSION) >= 6.10 ) {
$args->{NO_META} = 1;
}
if ( eval($ExtUtils::MakeMaker::VERSION) > 6.17 and $self->sign ) {
$args->{SIGN} = 1;
inc/Module/Install/Makefile.pm view on Meta::CPAN
. $self->preamble
: '';
my $postamble = "# Postamble by $top_class $top_version\n"
. ($self->postamble || '');
local *MAKEFILE;
open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
my $makefile = do { local $/; <MAKEFILE> };
close MAKEFILE or die $!;
$makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /;
$makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g;
$makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g;
$makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m;
$makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m;
# Module::Install will never be used to build the Core Perl
# Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks
# PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist
$makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m;
#$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m;
inc/Module/Install/Metadata.pm view on Meta::CPAN
@ISA = qw{Module::Install::Base};
}
my @scalar_keys = qw{
name
module_name
abstract
author
version
distribution_type
tests
installdirs
};
my @tuple_keys = qw{
configure_requires
build_requires
requires
recommends
bundles
resources
inc/Module/Install/Metadata.pm view on Meta::CPAN
die("Unsupported reserved lowercase resource '$name'");
}
$self->{values}{resources} ||= [];
push @{ $self->{values}{resources} }, [ $name, $value ];
}
$self->{values}{resources};
}
# Aliases for build_requires that will have alternative
# meanings in some future version of META.yml.
sub test_requires { shift->build_requires(@_) }
sub install_requires { shift->build_requires(@_) }
# Aliases for installdirs options
sub install_as_core { $_[0]->installdirs('perl') }
sub install_as_cpan { $_[0]->installdirs('site') }
sub install_as_site { $_[0]->installdirs('site') }
sub install_as_vendor { $_[0]->installdirs('vendor') }
sub sign {
my $self = shift;
lib/ASP4x/Router.pm view on Meta::CPAN
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.
When a request comes in to Apache, mod_perl will know that C<ASP4x::Router> might
make a change to the URI - so it has C<ASP4x::Router> take a look at the request. If
any changes are made (eg - C</foo/bar/1/> gets changed to C</pages/baz.asp?id=1>)
then the server handles the request just as though C</pages/baz.asp?id=1> had been
requested in the first place.
For testing - if you run this:
$api->ua->get('/foo/bar/1/');
C<ASP4x::Router> will "reroute" that request to C</pages/baz.asp?id=1> as though you
had done it yourself like this:
$api->ua->get('/pages/baz.asp?id=1');
=head2 What is the point?
( run in 0.771 second using v1.01-cache-2.11-cpan-87723dcf8b7 )