exercises for part 1
[gitmo/moose-presentations.git] / moose-class / exercises / t / 00-prereq.t
1 use strict;
2 use warnings;
3
4 my %prereqs = (
5     'Test::More' => '0',
6     'Moose'      => '0.80',
7     'Class::MOP' => '0.85',
8 );
9
10 my @missing;
11 for my $mod ( keys %prereqs ) {
12     eval "require $mod";
13
14     if ($@) {
15         push @missing, "$mod is not installed";
16         next;
17     }
18
19     if ( $mod->VERSION < $prereqs{$mod} ) {
20         push @missing, "$mod must be version $prereqs{$mod} or greater";
21     }
22 }
23
24 if (@missing) {
25     warn "\n# ***********************************************************\n";
26     warn "#\n";
27     warn "# Found the following prereq problems ...\n";
28     warn "#   $_\n" for @missing;
29     warn "#\n";
30     warn "# ***********************************************************\n";
31
32     exit 255;
33 }
34
35 Test::More->import;
36
37 plan( tests => 1 );
38 ok( 'Looks like you have all the prereqs' );
39