Posted on 2005-02-14 08:47:19-08 by tonydonker
use of uninitialized value
Hello, I am using the JCombobox module. All of the time, when I select an option from the combox, I receive the message:

'Use of uninitialized value in pattern match (m//) at ../JComboBox.pm line 567'

I have tried thousands of things, but nothing seem to work. Is there anyone who has an idea?
Thanks in advance,
Ton
Direct Responses: 117 | 122 | Write a response
Posted on 2005-02-15 11:55:00-08 by rcseege in response to 109
Re: use of uninitialized value
Hi,

If you tell me which version of JComboBox you're using and send a small snippet of code that fails, then I'll see if I can't fix the problem and update the module.

Thanks
Rob
Direct Responses: Write a response
Posted on 2005-02-16 02:06:52-08 by rcseege in response to 109
Re: use of uninitialized value

No further feedback? No matter... I'm guessing that you must be using the older version (0.01-0.02) because that's the only thing that makes sense after reviewing each release and checking out the line.

First of all, yes, this is a bug, and should be corrected. There are at least two ways in which it might be done, but first you should consider upgrading to 1.02 -- that is the newest version and the problem has been corrected (much of that section has been completely rewritten). Even should the following fixes work, I'm sure there are still one or two other bugs lurking in the older code.

You don't want to upgrade or patch the module:

Ensure that you always set the -validate option. Set it to "none" during creation if you don't wish to use validation.

Fixing the module itself:

The problem has to do with the -validate option not being initialized. The method in question can be fixed with the following:

my $mode = $cw->cget('-validate') || "none";

This will assume that "none" is a default value if nothing else is set. Possibly a BETTER fix would be to modify the code on line 207 instead to:

-validate => [qw/METHOD validate Validate none/],

This will ensure that -validate uses "none" as a default value if no other is set.

My advice: Upgrade to 1.02 if possible.

Rob
Direct Responses: 123 | Write a response
Posted on 2005-02-16 08:45:18-08 by tonydonker in response to 122
Re: use of uninitialized value
Hi Rob,
you have to rewrite the JCombobox.pm.
See perlmonks.com (http://www.perlmonks.com/index.pl?node=jcombobox&go_button=Search)

Ton
Direct Responses: 127 | Write a response
Posted on 2005-02-16 10:59:44-08 by rcseege in response to 123
Re: use of uninitialized value

Thanks, I did happen to see that earlier today. I've only rarely visited perlmonks in the past, and its never occurred to me to search on JComboBox before. It seems a little strange that the number of places that questions get asked is growing. It makes it tough to keep up with the various forums, mailing lists, and newsgroups, and email.

I'm glad that you were able to find a solution to the problem.

Rob
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.