in reply to Using Moo.pm and compilation errors
eval swallows all errors. This is not what you want if you suspect compile-time errors in your code. Instead, use require, especially when using OO-style modules:
... my $class="MHE::" . $opts->{type}; my $filename= $class) =~ s!::!/!g; require "$filename.pm"; ...
Alternatively, you can check $@ after the eval for errors:
eval "use MHE::$opts->{type} qw(sendHeartbeat); 1" or die "Couldn't load 'MHE::$opts->{type}': $@";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using Moo.pm and compilation errors
by Anonymous Monk on Apr 30, 2015 at 10:41 UTC | |
by Corion (Patriarch) on Apr 30, 2015 at 11:35 UTC | |
|
Re^2: Using Moo.pm and compilation errors
by Anonymous Monk on Apr 30, 2015 at 10:33 UTC | |
by walshy (Initiate) on Apr 30, 2015 at 10:53 UTC | |
by choroba (Cardinal) on Apr 30, 2015 at 11:04 UTC |