[dancer-users] Why do warnings cause Dancer to fail?
David Cantrell
david at cantrell.org.uk
Tue May 6 12:59:30 BST 2014
On Mon, May 05, 2014 at 09:13:57AM -0600, Warren Young wrote:
> I've found that most of the time, the "fatal warnings" you get when you
> follow this practice are just silly things. Mostly, it's complaints
> about uninitialized variables used in strings:
>
> my $foo;
> ...then later...
> debug "Lorem ipsum $foo dolor sic amet"
>
> Dancer stops the whole world, as though this has a real consequence,
Debugging information like that is most useful when it is accurate, so
rather than just blindly interpolating, I'd write that code something
like this, so that when I'm looking at it later I can distinguish
between undef and the empty string ...
debug join(' ',
"Lorem ipsum",
(defined($foo) ? "'$foo'" : '[undef]'),
"dolor sic amet"
);
Or if I were feeling really paranoid:
{
use Data::Dumper; local $Data::Dumper::Indent = 1;
debug "Lorem ipsum dolor sic amet".Dumper($foo);
}
--
David Cantrell | even more awesome than a panda-fur coat
fdisk format reinstall, doo-dah, doo-dah;
fdisk format reinstall, it's the Windows way
More information about the dancer-users
mailing list