Menu

#62 N::I::Property $class->_create bug(s)

major
closed
Net-ICal (57)
5
2012-05-22
2001-09-10
Tim Mooney
No

When calling

Net::ICal::Calendar->new_from_ical
with a calendar stream that begins

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Steltor//NONSGML CAPI 2.0//EN
BEGIN:VEVENT
DURATION:P0DT1H15M0S

I receive the following stack trace:

MethodMapper: Can't invoke _create on
Net::ICal::Duration at
/local/lib/site_perl/5.6.1/Net/ICal/Property.pm line
135
Can't call method "restore" on an undefined value at
/local/lib/site_perl/5.6.1/Net/ICal/Property.pm line
178, <FOO> chunk 1.

The second error (the Can't call method "restore")
comes because $self is undef after the $class->_create;
call. This should be tested for, and undef should be
returned if class creation fails for any of the
subclasses.

The first error occurs because there is no _create
method
for Duration (or a few other classes, I think). Should
there
be? It seems so, but I don't know for sure.

For the second error (execution inside the method
continues even after the $class->_create fails), I
tried
wrapping the $class->_create in an eval and then
testing
$@, but that didn't work. Is there a better way to
suppress
the error (so we can generate our own) or should the
error just come out but defined($self) be tested? I
chose
that route for now. Patch is attached.

Discussion

  • Martijn van Beers

    Logged In: YES
    user_id=1366

    I think you forgot the attachment, but this should be fixed
    in cvs already. Could you confirm that?

    thanks,
    Martijn

     
  • Tim Mooney

    Tim Mooney - 2001-09-10

    Logged In: YES
    user_id=36222

    I did forget to check the "Upload & Attach" checkbox.
    Sorry.

    CVS version does fix the problem. $self should probably
    still be checked for undef after the attempt to call
    $class->_create,
    though.

     

Log in to post a comment.

MongoDB Logo MongoDB