[Catalyst] script/create.pl -mech controller (patch)
Carl Franks
fireartist at gmail.com
Fri Mar 3 16:14:03 CET 2006
On 03/03/06, Sebastian Riedel <sri at oook.de> wrote:
> Ok, we could make it a optional prereq (our packagers will hate me
> once again) and eval check for mechanize in the tests.
Ok, here's an updated patch.
The current behaviour is:
When running create.pl - the program will die with an appropriate
error message if T-W-M-C isn't installed.
When running the test suite - all tests will be skipped if T-W-M-C
isn't installed.
There's also a patch for the Makefile.PL prereqs attached.
Note: I've chosen the following method for the test skip
our $test_count;
BEGIN { $test_count = 2 }
use Test::More tests => $test_count;
SKIP: {
eval "use Test::WWW::Mechanize::Catalyst 'myapp'";
skip 'Test::WWW::Mechanize::Catalyst required', $test_count if $@;
...
}
This is because I find if you try hard-coding the test count twice, as
below, they can get out of sync. (I've found this problem on a module
on cpan before).
use Test::More tests => 3;
SKIP: {
eval "use Test::WWW::Mechanize::Catalyst 'myapp'";
skip 'Test::WWW::Mechanize::Catalyst required', 3 if $@;
...
}
It's also preferable to having 'no_plan', because if any further tests
are added by the app developer, a test count is 'a good thing' :)
Cheers,
Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile.PL.patch
Type: application/octet-stream
Size: 351 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060303/1774a167/attachment-0002.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Helper.pm.patch
Type: application/octet-stream
Size: 1763 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060303/1774a167/attachment-0003.obj
More information about the Catalyst
mailing list