leocharre has asked for the wisdom of the Perl Monks concerning the following question:

I was trying out Netscape::Bookmarks and I can't get it to do much.. I made uber sure that I didn't have an empty bookmarks file.

Does anyone have any suggestions other then trying Bookmarks::Parser? I kinda wanted to use Netscape::Bookmarks, it was written by brian d foy (smiley here)

A test script.. Maybe someone can try this out see if it works for them?

#!/usr/bin/perl -w use strict; use warnings; use Netscape::Bookmarks; use Smart::Comments '###'; my $abs_bookmarks = '/home/myself/bookmarks.html'; my $b = Netscape::Bookmarks->new($abs_bookmarks); ### $b ## maybe thingy should have something in it? my $categories = $b->categories; ### $categories my $elements = $b->elements; ### $elements my $as_string = $b->as_string; ### $as_string ## prints virgin bookmarks file

update

Ended up using Bookmarks::Parser Which really was a pain in the ass for me with the deps. Had to force install WWW::Mechanize on a FC4 i386 machine... etc.

Replies are listed 'Best First'.
Re: Netscape::Bookmarks not working for me
by webfiend (Vicar) on Dec 29, 2006 at 18:09 UTC
Re: Netscape::Bookmarks not working for me
by Anonymous Monk on Dec 29, 2006 at 06:14 UTC
    Try without Smart::Comments
Re: Netscape::Bookmarks not working for me
by Anonymous Monk on Dec 29, 2006 at 10:11 UTC
    The problem seems to be $b. The results, according to Smart::Comments, is: ### $b: undef
      That may be because your target file does not exist or is empty. Or maybe you don't have Netscape::Bookmarks - or maybe you're not using the script I gave you- maybe have strict off.
Re: Netscape::Bookmarks not working for me
by Anonymous Monk on Dec 29, 2006 at 22:10 UTC
    It works for me. How many failing tests did you get when you installed it?
Re: Netscape::Bookmarks not working for me
by Anonymous Monk on Dec 29, 2006 at 06:27 UTC

      That's what ### does. Look up Smart::Comments - It's really wild.

      The use Smart::Comments '###'; line is specifying that any comment preceded by three pound signs will print to screen. If you wanted every comment with three and two pound signs, you would do: use Smart::Comments '###', '##';.

      The module does much more. If modules were drugs- Smart::Comments would be weed.