X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole%2FCLI.pm;h=b2c6e911d545885147fff1e872ad3f1837482d21;hb=5c199c0e9cd05a00bfc04d9688982979a41f3ee8;hp=b40dc0f1d1b2f9db5a68878c7c6ec4538cddc71e;hpb=fb48746a79e660e7f5df5a22269ca9e22519eaa5;p=maypole.git diff --git a/lib/Maypole/CLI.pm b/lib/Maypole/CLI.pm index b40dc0f..b2c6e91 100644 --- a/lib/Maypole/CLI.pm +++ b/lib/Maypole/CLI.pm @@ -1,6 +1,7 @@ package Maypole::CLI; use UNIVERSAL::require; use URI; use URI::QueryParam; +use Maypole::Constants; use strict; use warnings; @@ -31,7 +32,7 @@ sub send_output { $buffer = shift->{output} } # Do it! CHECK { if ((caller(0))[1] eq "-e") { - $package->handler() and print $buffer; + $package->handler() == OK and print $buffer; } } 1; @@ -83,16 +84,17 @@ For instance, a test script could look like this: use Test::More tests => 5; use Maypole::CLI qw(BeerDB); + use Maypole::Constants; $ENV{MAYPOLE_TEMPLATES} = "t/templates"; # Hack because isa_ok only supports object isa not class isa isa_ok( (bless {},"BeerDB") , "Maypole"); @ARGV = ("http://localhost/beerdb/"); - is(BeerDB->handler, 200, "OK"); + is(BeerDB->handler, OK, "OK"); like($Maypole::CLI::buffer, qr/frontpage/, "Got the front page"); @ARGV = ("http://localhost/beerdb/beer/list"); - is(BeerDB->handler, 200, "OK"); + is(BeerDB->handler, OK, "OK"); like($Maypole::CLI::buffer, qr/Organic Best/, "Found a beer in the list");