Skip Menu |

This queue is for tickets about the CGI-Application-Plugin-ConfigAuto CPAN distribution.

Report information
The Basics
Id: 11367
Status: resolved
Priority: 0/
Queue: CGI-Application-Plugin-ConfigAuto

People
Owner: MARKSTOS [...] cpan.org
Requestors: william [...] knowmad.com
Cc:
AdminCc:

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



Subject: Gracefully handling empty config files
Hey Mark, I've been exercising your module lately and have a request. I use a perl format for my config files. If I mess up the syntax, the following error will appear the next time I try to run my application: Can't use an undefined value as a HASH reference at /loader/0x82501f0/CGI/Application/Plugin/ConfigAuto.pm line 121, line 887. Line 121 combines previously loaded config files with new ones: %combined_cfg = (%combined_cfg, %$cfg); I have no idea what the reference to line 887 is (my config file is only 450 lines). I can run perl -cw <config-file> to find out where I've made the mistake and get back to work. However, the first time that error came up, it wasn't very clear the problem. A simple test such as the following would make my life easier (esp. the next time this happens and I've forgotten about this problem): die "No configuration found. Check your config file (check the syntax if this is a perl format)." unless keys %combined_cfg; I'm kinda surprised that Config::Auto isn't throwing an error when it tries to eval the invalid code. Perhaps there's an eval{} somewhere that I'm overlooking. William
Date: Thu, 3 Feb 2005 13:58:15 -0500
From: Mark Stosberg <mark [...] summersault.com>
To: Guest via RT <bug-CGI-Application-Plugin-ConfigAuto [...] rt.cpan.org>
Subject: Re: [cpan #11367] Gracefully handling empty config files
RT-Send-Cc:
On Thu, Feb 03, 2005 at 01:43:41PM -0500, Guest via RT wrote: Show quoted text
> > I've been exercising your module lately and have a request. I use a perl format for my config files. If I mess up the syntax, the following error will appear the next time I try to run my application: > > Can't use an undefined value as a HASH reference at /loader/0x82501f0/CGI/Application/Plugin/ConfigAuto.pm line 121, line 887. > > Line 121 combines previously loaded config files with new ones: > > %combined_cfg = (%combined_cfg, %$cfg); > > I have no idea what the reference to line 887 is (my config file is only 450 lines). > > I can run perl -cw <config-file> to find out where I've made the mistake and get back to work. However, the first time that error came up, it wasn't very clear the problem. A simple test such as the following would make my life easier (esp. the next time this happens and I've forgotten about this problem): > > die "No configuration found. Check your config file (check the syntax if this is a perl format)." unless keys %combined_cfg;
Sounds reasonable. I would accept a patch for this, or I'll get it eventually myself. Thanks for the report. Mark
Subject: Gracefully handling empty config files (pending Release)
[guest - Thu Feb 3 13:43:40 2005]: Show quoted text
> Hey Mark, > > I've been exercising your module lately and have a request. I use a > perl format for my config files. If I mess up the syntax, the > following error will appear the next time I try to run my > application: > > Can't use an undefined value as a HASH reference at > /loader/0x82501f0/CGI/Application/Plugin/ConfigAuto.pm line 121, > line 887. > > Line 121 combines previously loaded config files with new ones: > > %combined_cfg = (%combined_cfg, %$cfg); > > I have no idea what the reference to line 887 is (my config file is > only 450 lines). > > I can run perl -cw <config-file> to find out where I've made the > mistake and get back to work. However, the first time that error > came up, it wasn't very clear the problem. A simple test such as > the following would make my life easier (esp. the next time this > happens and I've forgotten about this problem): > > die "No configuration found. Check your config file (check the > syntax if this is a perl format)." unless keys %combined_cfg; > > I'm kinda surprised that Config::Auto isn't throwing an error when it > tries to eval the invalid code. Perhaps there's an eval{} somewhere > that I'm overlooking. > > > William
William, I've implemented this in my darcs archive, and it is pending release now. http://mark.stosberg.com/darcs_hive/cgi-app-cfg/ Thanks for the suggestion. Mark