SPUG: howdy! (and i've got a question)
DeRykus, Charles E
charles.e.derykus at boeing.com
Sun Jul 31 22:22:05 PDT 2005
> ,----[ makeabookmark.pl ]
> | #!/usr/bin/perl
> | use Netscape::Bookmarks
> | my $now = "A date";
> | my $address = "http://www.perl.org";
> | my $username = "Charles Mauch";
> | my $title = "Link : from $username at $now"; my $description = "Link
> | harvested from email from $username"; my $bookmarks_file =
> | "$ENV{HOME}/testbook.html";
> |
> | my $bookmarks = Netscape::Bookmarks->new($bookmarks_file)
or die "couldn't find/open $bookmarks_file"; #| just in
case....
The constructor probably returns undef and so the bookmarks object
will
have a short, painful life ...:)
> | my $link = new Netscape::Bookmarks::Link {
> | TITLE => $title,
> | DESCRIPTION => $description,
> | HREF => 'http://www.perl.org',
> | ADD_DATE => $epochtime,
> | LAST_VISIT => $epochtime,
> | LAST_MODIFIED => $epochtime,
> | ALIAS_ID => 4
> | };
> |
> | $bookmarks->add($link);
> | print $link->as_string;
> `----
> This snippet results in:
> Can't call method "add" on an undefined value at ./makeabookmark.pl
line 23.
> ...
--
Charles DeRykus
More information about the spug-list
mailing list