Plack-App-SeeAlso
view release on metacpan or search on metacpan
my $app = Plack::App::SeeAlso->new(
Query => sub {
my $id = shift;
return unless $id =~ /:/;
push_seealso [ uc($id) ], "1:$id", "2:$id", "3:$id";
},
# Stylesheet => 1,
);
sub read_file { do { local( @ARGV, $/ ) = $_[0] ; <> } }
test_psgi $app, sub {
my $cb = shift;
my $res = $cb->(GET "/?id=a:b&format=seealso");
is( $res->code, 200, 'found');
is( $res->content, '["A:B",["1:a:b"],["2:a:b"],["3:a:b"]]', 'found' );
$res = $cb->(GET "/?id=ab&format=seealso");
is( $res->code, 200, 'not found, but 200');
t/options.t view on Meta::CPAN
use parent 'Plack::App::SeeAlso';
our $ShortName = 'The ShortName is truncated';
our $Contact = 'admin@example.com';
}
my $app = Foo->new(
Developer => 'admin@example.org',
);
sub read_file { do { local( @ARGV, $/ ) = $_[0] ; <> } }
test_psgi $app, sub {
my $cb = shift;
my $res = $cb->(GET "/?format=opensearchdescription");
is( $res->content, read_file('t/osd1.xml'), 'OSD XML' );
$res = $cb->(GET "/");
like( $res->content, qr{<\?xml-stylesheet}, 'has stylesheet' );
};
( run in 0.790 second using v1.01-cache-2.11-cpan-49f99fa48dc )