Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Enhancements...

  • Loading branch information...
commit 58f90c8568e6b0e725982426ed624f6df19d6217 1 parent aa9e4eb
@kberov authored
Showing with 29 additions and 13 deletions.
  1. +6 −1 Changes
  2. +8 −7 Makefile.PL
  3. +15 −5 lib/Mojolicious/Plugin/DSC.pm
View
7 Changes
@@ -1,4 +1,9 @@
Revision history for Mojolicious::Plugin::DSC
+0.05 2012-08-04 14:50 EEST
+ - Added missing licence in Makefile.PL.
+ - Added _load_classes() to separate logical chuncks of code..
+ - Added missing Changelog.
+
0.04 2012-08-04 10:26 EEST
- - Uploaded first usable version on CPAN
+ - Uploaded first usable version on CPAN.
View
15 Makefile.PL
@@ -4,13 +4,14 @@ use warnings;
use ExtUtils::MakeMaker;
WriteMakefile(
- NAME => 'Mojolicious::Plugin::DSC',
- VERSION_FROM => 'lib/Mojolicious/Plugin/DSC.pm',
+ NAME => 'Mojolicious::Plugin::DSC',
+ VERSION_FROM => 'lib/Mojolicious/Plugin/DSC.pm',
ABSTRACT_FROM => 'lib/Mojolicious/Plugin/DSC.pm',
- AUTHOR => q{Красимир Беров <berov@cpan.org>},
- PREREQ_PM => {'Mojolicious' => '2.0','DBIx::Simple::Class' =>'0.62'},
- test => {TESTS => 't/*.t'},
- dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
- clean => { FILES => 'Mojolicious-Plugin-DSC-*' },
+ AUTHOR => q{Красимир Беров <berov@cpan.org>},
+ LICENSE => 'artistic_2',
+ PREREQ_PM => {'Mojolicious' => '2.0', 'DBIx::Simple::Class' => '0.62'},
+ test => {TESTS => 't/*.t'},
+ dist => {COMPRESS => 'gzip -9f', SUFFIX => 'gz',},
+ clean => {FILES => 'Mojolicious-Plugin-DSC-*'},
);
View
20 lib/Mojolicious/Plugin/DSC.pm
@@ -76,12 +76,20 @@ sub register {
for my $sql (@{$config->{onconnect_do}}) {
$dbix->dbh->do($sql);
}
+
$config->{dbix_helper} ||= 'dbix';
$app->attr($config->{dbix_helper}, sub {$dbix});
$app->helper($config->{dbix_helper}, $app->dbix); #add helper dbix
DBIx::Simple::Class->dbix($app->dbix); #do not forget
+ $self->_load_classes($config);
+ $self->config($config);
+ return $self;
+} #end register
+
+sub _load_classes {
+ my ($self, $config) = @_;
if ($config->{namespace} && @{$config->{load_classes}}) {
my @classes = @{$config->{load_classes}};
my $namespace = $config->{namespace};
@@ -103,11 +111,13 @@ sub register {
$MEx->throw($e) if $e;
}
}
- $self->config($config);
- return $self;
-} #end register
-
-
+ elsif (!$config->{namespace} && @{$config->{load_classes}}) {
+ foreach my $class (@{$config->{load_classes}}) {
+ my $e = Mojo::Loader->load($class);
+ $MEx->throw($e) if $e;
+ }
+ }
+}
1;
__END__
Please sign in to comment.
Something went wrong with that request. Please try again.