ASP4x-Router

 view release on metacpan or  search on metacpan

inc/Module/Install/Makefile.pm  view on Meta::CPAN

sub fix_up_makefile {
	my $self          = shift;
	my $makefile_name = shift;
	my $top_class     = ref($self->_top) || '';
	my $top_version   = $self->_top->VERSION || '';

	my $preamble = $self->preamble
		? "# Preamble by $top_class $top_version\n"
			. $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;

inc/Module/Install/Makefile.pm  view on Meta::CPAN

	$makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m;
	#$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m;

	# Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well.
	$makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g;

	# XXX - This is currently unused; not sure if it breaks other MM-users
	# $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg;

	open  MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
	print MAKEFILE  "$preamble$makefile$postamble" or die $!;
	close MAKEFILE  or die $!;

	1;
}

sub preamble {
	my ($self, $text) = @_;
	$self->{preamble} = $text . $self->{preamble} if defined $text;
	$self->{preamble};
}

sub postamble {
	my ($self, $text) = @_;
	$self->{postamble} ||= $self->admin->postamble;
	$self->{postamble} .= $text if defined $text;
	$self->{postamble}
}

1;

__END__

#line 379

t/010-basic/020-rest-crud.t  view on Meta::CPAN


my $api; BEGIN { $api = ASP4::API->new }

use_ok('ASP4x::Router');

# CreatePage:
my $res = $api->ua->get("/main/truck/create/");
is( $res->content => "CreatePage truck\n", "GET '/main/truck/create/' correct");

# Create handler:
$res = $api->ua->post("/main/truck/create/");
is( $res->content => "Create truck", "POST '/main/truck/create/' correct");

# List via GET
$res = $api->ua->get("/main/truck/list/");
is( $res->content => "List truck page 1\n", "GET '/main/truck/list/' correct");

$res = $api->ua->get("/main/truck/list/2/");
is( $res->content => "List truck page 2\n", "GET '/main/truck/list/2/' correct");

# List via POST
$res = $api->ua->post("/main/truck/list/");
is( $res->content => "List truck page 1\n", "POST '/main/truck/list/' correct");
$res = $api->ua->post("/main/truck/list/2/");
is( $res->content => "List truck page 2\n", "POST '/main/truck/list/2/' correct");

for( 3..300 )
{
  $res = $api->ua->get("/main/truck/list/$_/");
  is( $res->content => "List truck page $_\n", "GET '/main/truck/list/$_/' correct");
}# end for()

# View via GET
$res = $api->ua->get("/main/truck/1/");
is( $res->content => "View truck id 1\n", "GET '/main/truck/1/' correct");

# View via POST
$res = $api->ua->post("/main/truck/1/");
is( $res->content => "View truck id 1\n", "POST '/main/truck/1/' correct");

# EditPage
$res = $api->ua->get("/main/truck/1/edit/");
is( $res->content => "EditPage truck id 1\n", "GET '/main/truck/1/edit/' correct");

# Edit handler
$res = $api->ua->post("/main/truck/1/edit/");
is( $res->content => "Edit truck id 1", "POST '/main/truck/1/edit/' correct");

# Delete handler
$res = $api->ua->post("/main/truck/1/delete/");
is( $res->content => "Delete truck id 1", "POST '/main/truck/1/delete/' correct");


is(
  '/main/truck/create/' =>
  $api->context->config->web->router->uri_for('CreatePage', { type => 'truck' }),
  "Got router and uri_for(...) just fine."
);


t/010-basic/030-non-routed.t  view on Meta::CPAN


ok(
  $res = $api->ua->get("/no-routing/another.asp"),
  "Got /no-routing/another.asp"
);
is( $res->content => "ANOTHER NOT ROUTED
", "/no-routing/another.asp was not routed" );


# Create handler:
$res = $api->ua->post("/main/boat/create/");
is( $res->content => "Non-Routed Boat Create Handler", "POST '/main/boat/create/' correct");

t/conf/asp4-config.json  view on Meta::CPAN

{
  "system": {
    "post_processors": [
    ],
    "libs": [
      "@ServerRoot@/lib"
    ],
    "load_modules": [
    ],
    "env_vars": {
    },
    "settings": {
    }



( run in 0.893 second using v1.01-cache-2.11-cpan-ceb78f64989 )