Permalink
Browse files

using Class::Load

  • Loading branch information...
Zbigniew Lukasiak
Zbigniew Lukasiak committed Nov 14, 2010
1 parent 40c9551 commit 653c9118192c3ec6cb90e54436a2804b3f56beb8
Showing with 4 additions and 5 deletions.
  1. +4 −5 lib/WebNano/FindController.pm
@@ -6,7 +6,7 @@ package WebNano::FindController;
use Exporter 'import';
our @EXPORT_OK = qw(find_nested);
-use Try::Tiny;
+use Class::Load 'try_load_class';
sub find_nested {
my( $sub_path, $search_path ) = @_;
@@ -15,13 +15,12 @@ sub find_nested {
my @path = @$search_path;
for my $base ( @path ){
my $controller_class = $base . '::Controller' . $sub_path;
- eval "require $controller_class";
- if( $@ ){
+ if( ! try_load_class( $controller_class ) ){
my $file = $controller_class;
$file =~ s{::}{/}g;
$file .= '.pm';
- if( $@ !~ /Can't locate \Q$file\E in \@INC/ ){
- die $@;
+ if( $Class::Load::ERROR !~ /Can't locate \Q$file\E in \@INC/ ){
+ die $Class::Load::ERROR;
}
};
return $controller_class if $controller_class->isa( 'WebNano::Controller' );

0 comments on commit 653c911

Please sign in to comment.