[Jifty-commit] r2939 - in jifty/trunk: lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Mar 9 19:35:22 EST 2007


Author: jesse
Date: Fri Mar  9 19:35:22 2007
New Revision: 2939

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/ClassLoader.pm

Log:
 r53245 at 99:  jesse | 2007-03-09 16:37:14 -0500
 * minor refactoring in advance of support for plugin actions


Modified: jifty/trunk/lib/Jifty/ClassLoader.pm
==============================================================================
--- jifty/trunk/lib/Jifty/ClassLoader.pm	(original)
+++ jifty/trunk/lib/Jifty/ClassLoader.pm	Fri Mar  9 19:35:22 2007
@@ -116,14 +116,13 @@
     $module =~ s/.pm$//;
     $module =~ s{/}{::}g;
 
-    # The quick check
+    # The quick check. We only want to handle things for our app
     return undef unless $module =~ /^$base/;
 
-    if ( $module =~ m!^(?:$base)$! ) {
-        return $self->return_class(
-            "package " . $base . ";\n");
+    if ( $module =~ /^(?:$base)$/ ) {
+        return $self->return_class( "package " . $base . ";\n");
     }
-    elsif ( $module =~ m/^(?:$base)::(Record|Collection|Notification|
+    elsif ( $module =~ /^(?:$base)::(Record|Collection|Notification|
                                       Dispatcher|Bootstrap|Upgrade|
                                       Handle|Event|Event::Model|
                                       Action::Record::\w+)$/x ) {
@@ -131,23 +130,23 @@
                   "package $module;\n"
                 . "use base qw/Jifty::$1/; sub _autogenerated { 1 };\n"
             );
-    } elsif ( $module =~ m!^(?:$base)::View$! ) {
+    } elsif ( $module =~ /^(?:$base)::View/ ) {
         return $self->return_class(
                   "package $module;\n"
                 . "use base qw/Jifty::View::Declare::Helpers/; sub _autogenerated { 1 };\n"
             );
-    } elsif ( $module =~ m!^(?:$base)::CurrentUser$! ) {
+    } elsif ( $module =~ /^(?:$base)::CurrentUser$/ ) {
         return $self->return_class(
                   "package $module;\n"
                 . "use base qw/Jifty::CurrentUser/; sub _autogenerated { 1 };\n"
             );
-    } elsif ( $module =~ m!^(?:$base)::Model::(\w+)Collection$! ) {
+    } elsif ( $module =~ /^(?:$base)::Model::(\w+)Collection$/ ) {
         return $self->return_class(
                   "package $module;\n"
                 . "use base qw/@{[$base]}::Collection/;\n"
                 . "sub record_class { '@{[$base]}::Model::$1' }\n"
             );
-    } elsif ( $module =~ m!^(?:$base)::Event::Model::([^\.]+)$! ) {
+    } elsif ( $module =~ /^(?:$base)::Event::Model::([^\.]+)$/ ) {
         my $modelclass = $base . "::Model::" . $1;
         Jifty::Util->require($modelclass);
 
@@ -159,7 +158,8 @@
                 . "sub record_class { '$modelclass' };\n"
                 . "sub autogenerated { 1 };\n"
             );
-    } elsif ( $module =~ m!^(?:$base)::Action::(Create|Update|Delete|Search)([^\.]+)$! ) {
+    } elsif ( $module =~ /^(?:$base)::Action::
+                        (Create|Update|Delete|Search)([^\.]+)$/x ) {
         my $modelclass = $base . "::Model::" . $2;
 
         Jifty::Util->require($modelclass);


More information about the Jifty-commit mailing list