Skip Menu |

This queue is for tickets about the Params-Validate CPAN distribution.

Report information
The Basics
Id: 27241
Status: resolved
Priority: 0/
Queue: Params-Validate

People
Owner: Nobody in particular
Requestors: STEFFENW [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.88
Fixed in: (no value)



Subject: OBJECT check failed (a blessed scalar is an object)
package MyObjectFromScalarReference; sub new { my $class = shift; my scalar; # will be an object return bless \$scalar, class; ); sub my_method { my ($self, ...) = validate_pos(@_, {type => OBJECT}, ...); ... return $self; } --- my $object = MyObjectFromScalarReference->new(); $object->my_method(...); --- Parameter #1 ("MyObjectFromScalarReference=REF(0xd3279f8)") to MyObjectFromScalarReference::my_method was an 'unknown', which is not one of the allowed types: object
From: STEFFENW [...] cpan.org
maybe the fist written simple constructor doesn't create this error: sub new { my $class = shift; my $scalar; # will be an object return bless \$scalar, $class; } but this will create the error: sub new { my $class = shift; my $scalar = \'text'; # will be an object return bless \$scalar, $class; }
Subject: Re: [rt.cpan.org #27241] OBJECT check failed (a blessed scalar is an object)
Date: Tue, 22 May 2007 22:07:50 -0500 (CDT)
To: Steffen Winkler via RT <bug-Params-Validate [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Tue, 22 May 2007, Steffen Winkler via RT wrote: Show quoted text
> sub new { > my $class = shift; > > my $scalar; # will be an object > > return bless \$scalar, $class; > } > > but this will create the error: > > sub new { > my $class = shift; > > my $scalar = \'text'; # will be an object > > return bless \$scalar, $class; > }
I cannot reproduce the error with either code. I tested with both Perl 5.8.8 and 5.6.2, and both worked fine. I've attached the test code I wrote. Can you send a complete example of code that fails? The original example you sent had several typos, but once I fixed them, it worked. I did something similar to the code above, and it worked as well. -dave /*=================================================== VegGuide.Org www.BookIRead.com Your guide to all that's veg. My book blog ===================================================*/
From: STEFFENW [...] cpan.org
Please excuse me for sending this bug report. Plese excuse me for the first sample and all this syntax errors in it. But yesterday the 2nd example realy produce this error message. But to day all is ok. Im realy confused about. But I hered today, that yesterday some updates were running. Maybe this was the reason and an older Params::Validate was running. I don't know. Thank you for your quickly anwer. Steffen