Skip Menu |

This queue is for tickets about the autodie CPAN distribution.

Report information
The Basics
Id: 38614
Status: resolved
Priority: 0/
Queue: autodie

People
Owner: PJF [...] cpan.org
Requestors: offer.kaye [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.99
Fixed in: (no value)



Subject: missing newline in output message
Date: Wed, 20 Aug 2008 18:13:40 +0300
To: bug-autodie [...] rt.cpan.org
From: "Offer Kaye" <offer.kaye [...] gmail.com>
Hi, When I try the basic: use autodie; open(my $in_fh , '<' , 'infile'); With 'infile' not existing, the error message that I get is not newline terminated, which is annoying. I realize I can do: use autodie; my $in_fh; eval { open($in_fh , '<' , 'infile'); }; die "$@\n" if $@; But that's a lot of extra code just to get a "\n" at the end of the message (and that kind of defeats for me a major reason to use autodie). Can a "\n" be added by default to the autodie default message? I'm using autodie 1.99 on Perl 5.10. Thanks, -- Offer Kaye
On Wed Aug 20 11:14:28 2008, offer.kaye@gmail.com wrote: Show quoted text
> Can a "\n" be added by default to the autodie default message?
This is what I get for developing with a shell that automatically adds newlines before my prompt. ;) Yes, this is definitely a bug, and yes, it will definitely be fixed. I've just guests drop over, so it may take a couple of hours before I have a patch applied. You'll be notified when that happens. Many thanks for the report, Paul
The dev copy of autodie now contains a patch for this bug, which is also reproduced below. I hope to have the next stable release of autodie out this weekend. If you're eager to have a corrected copy right away then, you can: * Apply the patch below. * Do a 'git clone git://github.com/pfenwick/autodie.git' and build/install from that. It will build as autodie 1.99_01 * Build/install from the tarball (with an ugly name) at http://github.com/pfenwick/autodie/tarball/master It will also build as autodie 1.99_01 The current dev may show a test in basic_exception.t "unexpectedly succeeding" from one of the other bugfixes I'm currently working on. Many thanks again for the bug report! Paul diff --git a/lib/autodie/exception.pm b/lib/autodie/exception.pm index 5111df4..9354491 100644 --- a/lib/autodie/exception.pm +++ b/lib/autodie/exception.pm @@ -328,7 +328,7 @@ Primarily intended for use by format handlers. sub add_file_and_line { my ($this) = @_; - return sprintf(" at %s line %d", $this->file, $this->line); + return sprintf(" at %s line %d\n", $this->file, $this->line); } =head3 stringify
Just a quick note to say that autodie 1.991 is making its way to CPAN right now, and includes the bugfix to ensure newlines are added correctly. Enjoy!