Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Undefined value warnings?

Quote Reply
Undefined value warnings?
Alex,

In the 1.x versions, when adding in to the script, and using your own tables, or modified tables and routines, many of the loops in DBSQL.pm gave

[Mon Nov 27 20:18:06 2000] script.cgi: Use of uninitialized value in substitution iterator at admin/Links/Template.pm line 189

or similar warnings when iterating through the HASH of passed in values. I was able to hack around that in some cases by using if (defined ) constructs in DBSQL.pm, and at one point in my script I checked each input hash value, if if existed but not defined, set it to '' so that it didn't generate an error.

What I'm asking is, is this what you fixed up a short while ago in this code? So if a hash is passed in to the database routines, it doesn't "expect" to get a certain set of values, but handles "exceptions" as well?

Forms pass in a lot of "empty" tags, and the database routines need to be able to deal with it. I'm assuming the new methods do.

If this wasn't so new, I'd figure it out for myself <G> But it's easier to ask.



PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Quote Reply
Re: Undefined value warnings? In reply to
Hi pugdog,

The old script was not -w safe. It would generate a lot of "use of unitilized value" warnings (which is ok, this doesn't affect the script).

To get around this, I would recommend turning -w off, or adding a:

local $^W;

to the script to turn it off for that part.

The new version has been developed with -w on, and shouldn't cause warnings.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Undefined value warnings? In reply to
I like "-w" <G>

>> The new version has been developed with -w on, and shouldn't cause warnings.

That's what I wanted to know :).

Turning '-w' off, seems like killing off an old friend that saved me many times.

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Quote Reply
Re: Undefined value warnings? In reply to
Well, in most cases yes. The "use of unitilized value" is a big pain, especially when dealing with database calls that could contain lots of undef values.

I recommend developing under -w, but not running with it.

Cheers,

Alex

--
Gossamer Threads Inc.