Skip Menu |

This queue is for tickets about the Chart CPAN distribution.

Report information
The Basics
Id: 411
Status: resolved
Priority: 0/
Queue: Chart

People
Owner: dbonner [...] cs.bu.edu
Requestors: pgoffin [...] baltimore.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.0.1
Fixed in: (no value)



Subject: $fh problem with Bugzilla
When trying to get a chart output with Bugzilla 2.14, I get this error reported from "Chart": Can't use an undefined value as a symbol reference at /usr/local/ActivePerl-5.6/lib/site_perl/5.6.1/Chart/Base.pm line 174. This is in someway related to the value of "$fh" in the sub routine. The apache error log adds the following information: "(F) A value used as either a hard reference or a symbolic reference must be a defined value. This helps to delurk some insidious errors."
From: pgoffin [...] baltimore.com
[guest - Tue Mar 26 09:46:22 2002]: The problem is with Bugzilla - it's all down to permissions on the "graphs" subdirectory. though it could be helped if "Chart" checked the return values of "Filehandle->new" were non-null. Paul. Show quoted text
> When trying to get a chart output with Bugzilla 2.14, I get this error > reported from "Chart": > > Can't use an undefined value as a symbol reference at > /usr/local/ActivePerl-5.6/lib/site_perl/5.6.1/Chart/Base.pm line 174. > > This is in someway related to the value of "$fh" in the sub routine. > > The apache error log adds the following information: > > "(F) A value used as either a hard reference or a symbolic reference > must > be a defined value. This helps to delurk some insidious errors." >
Subject: Open image files more carefully
From: Geoff Richards <qef [...] ungwe.org>
[guest - Tue Mar 26 11:15:57 2002]: Show quoted text
> The problem is with Bugzilla - it's all down to permissions > on the "graphs" subdirectory. though it could be helped > if "Chart" checked the return values of "Filehandle->new" > were non-null.
I had this same problem. My fault it occurred, but Chart::Base should be checking the return value when calling FileHandle->new(). Also, I think it is safer to pass the filename and the open mode separately. Attached is a patch to do both of these, against Chart-2.2. The tests still work for me after applying this.
diff -ur Chart-2.2.orig/Chart/Base.pm Chart-2.2/Chart/Base.pm --- Chart-2.2.orig/Chart/Base.pm 2003-02-14 15:14:53.000000000 +0000 +++ Chart-2.2/Chart/Base.pm 2003-10-30 17:30:04.000000000 +0000 @@ -218,7 +218,8 @@ # a filehandle or a file name if ((ref \$file) eq 'SCALAR') { # they gave me a file name - $fh = FileHandle->new (">$file"); + $fh = FileHandle->new ($file, 'w') + or croak "error opening file '$file': $!"; } elsif ((ref \$file) =~ /^(?:REF|GLOB)$/) { # either a FileHandle object or a regular file handle @@ -325,7 +326,8 @@ # a filehandle or a file name if ((ref \$file) eq 'SCALAR') { # they gave me a file name - $fh = FileHandle->new (">$file"); + $fh = FileHandle->new ($file, 'w') + or croak "error opening file '$file': $!"; } elsif ((ref \$file) =~ /^(?:REF|GLOB)$/) { # either a FileHandle object or a regular file handle