From: Gordon Irving Date: Tue, 15 Dec 2009 21:14:20 +0000 (+0000) Subject: dep check to end of module X-Git-Tag: v0.08119~9^2~39 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=417e178451e10e72688582a3790d5398ad4f7538;p=dbsrgits%2FDBIx-Class.git dep check to end of module --- diff --git a/lib/DBIx/Class/Admin.pm b/lib/DBIx/Class/Admin.pm index 03238e1..b1e6020 100644 --- a/lib/DBIx/Class/Admin.pm +++ b/lib/DBIx/Class/Admin.pm @@ -23,12 +23,14 @@ use MooseX::Types::Moose qw/Int HashRef ArrayRef Str Any/; use MooseX::Types::JSON qw(JSON); use MooseX::Types::Path::Class qw(Dir File); use Try::Tiny; + use parent 'Class::C3::Componentised'; -use Data::Dumper; use JSON::Any; +my @_deps = qw(Moose MooseX::Types MooseX::Types::JSON MooseX::Types::Path::Class Try::Tiny parent JSON::Any Class::C3::Componentised); + coerce ArrayRef, from JSON, via { _json_to_data ($_) }; @@ -543,6 +545,23 @@ sub _json_to_data { return $ret; } + +{ # deps check + +my @_missing_deps; +foreach my $dep (@_deps) { + eval "require $dep"; + if ($@) { + push @_missing_deps, $dep; + } +} + +if (@_missing_deps > 0) { + die "The following dependecies are missing " . join ",", @_missing_deps; +} + + +} =head1 AUTHOR Gordon Irving