"The Todo.pm module just has the annotations and no methods!"
If you did get the right code, then you have misunderstood the code. Open the source code up, you see two things:
- The Todo module does have methods defined, for example: optional_unique_properties.
sub optional_unique_properties {
qw(
class completed created description dtstamp
dtstart geo last-modified location organizer
percent-complete priority recurrence-id sequence status
summary uid url
due duration
);
}
If you do:
use Data::Dumper;
use strict;
use Data::ICal::Entry::Todo;
my $vtodo = Data::ICal::Entry::Todo->new();
print Dumper($vtodo->optional_unique_properties());
You get the following, which makes sense.
$VAR1 = 'class';
$VAR2 = 'completed';
$VAR3 = 'created';
$VAR4 = 'description';
$VAR5 = 'dtstamp';
$VAR6 = 'dtstart';
$VAR7 = 'geo';
$VAR8 = 'last-modified';
$VAR9 = 'location';
$VAR10 = 'organizer';
$VAR11 = 'percent-complete';
$VAR12 = 'priority';
$VAR13 = 'recurrence-id';
$VAR14 = 'sequence';
$VAR15 = 'status';
$VAR16 = 'summary';
$VAR17 = 'uid';
$VAR18 = 'url';
$VAR19 = 'due';
$VAR20 = 'duration';
- It is "true" that the Todo module does not have a new() method defined, however, it says:
use base qw/Data::ICal::Entry/;
So it inherits new() from its parent - Entry, which does have new():
sub new {
my $class = shift;
my $self = {
properties => {},
entries => [],
};
bless $self, $class;
return $self;
}
| [reply] [d/l] [select] |
Thank you. I had included the appropriate modules but, did not realize that the method was inherited.
| [reply] |
Hi perl-pearl,
Could you please post some lines of code that genereate your error?
Probably you forgor to use the use or require statement:
#!/usr/bin/perl -w
use strict;
use Data::ICal::Entry::Event;
my $vevent = Data::ICal::Entry::Event->new();
"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
| [reply] [d/l] [select] |
Check to see if you have a new method:
perl -MData::ICal::Entry::Event -le'print grep {m/Event.pm/} values %I
+NC' | xargs egrep 'sub.+new'
or something like that.
Evan Carroll www.EvanCarroll.com
| [reply] [d/l] |