sawyer@gnubuntu:~/some/unknown/folder$ perl eg.pl
String found where operator expected at Whatever.pm line 27, near "croak "Couldn't construct template: $Text::Template::ERROR\n""
(Do you need to predeclare croak?)
String found where operator expected at Whatever.pm line 32, near "croak "Couldn't fill in template: $Text::Template::ERROR\n""
(Do you need to predeclare croak?)
Could not load class (Whatever) because : syntax error at Whatever.pm line 27, near "croak "Couldn't construct template: $Text::Template::ERROR\n""
syntax error at Whatever.pm line 32, near "croak "Couldn't fill in template: $Text::Template::ERROR\n""
Compilation failed in require at/usr/local/lib/perl/5.8.8/Class/MOP.pm line 151.
at/usr/local/lib/perl/5.8.8/Class/MOP.pm line 133
Class::MOP::load_first_existing_class('Whatever') called at/usr/local/lib/perl/5.8.8/Class/MOP.pm line 157
Class::MOP::load_class('Whatever') called at/usr/local/share/perl/5.8.8/Moose/Util.pm line 83
Moose::Util::apply_all_roles('Moose::Meta::Class=HASH(0x8745734)', 'Whatever') called at/usr/local/share/perl/5.8.8/Moose.pm line 70
Moose::with('Whatever::Internal', 'Whatever') called at/usr/local/share/perl/5.8.8/Moose/Exporter.pm line 201
Moose::with('Whatever') called at Whatever/Internal.pm line 3
require Whatever/Internal.pm called at eg.pl line 9
main::BEGIN() called at Whatever/Internal.pm line 0
eval {...} called at Whatever/Internal.pm line 0
Compilation failed in require at eg.pl line 9.
BEGIN failed--compilation aborted at eg.pl line 9.
This was so simple it hurt that it took me a few minutes of going back and forth between the error message and the code to see what's wrong. I imagine that if I used diagnostics, it would be much bigger.
When asked in an interview "what would you do if you explain something to someone and they don't understand?" the answer shouldn't be "say the exact same thing, only louder", but should be "say the (possibly exact) same thing, only much slower and see where I lose them."
Andy Lester might disagree and I would automatically have to forfeit to whatever he suggests (good luck with the book, by the way!), but this is the first impression I would apply in my situation here.
The error message's first line is what the error is (compile-wise) and the second part of it (in the second line) is what perl thinks the problem is. It's an educated guess but perl is particularly smart (has anyone seen the configuration script for perl?) so there's a good chance it hit the nail on it, and it did.
I forgot to copy the declaration of Carp
Figuring out error msgs is difficult sometimes REVISITED 0 Comments More | Login | Reply /