Firefo...ookmark(3pm)

πŸ“¦ version 1.63, in debian trixie

πŸ’– Firefo...ookmark(3pm) πŸ’–

ok so this is the manual page for Firefox::Marionette::Bookmark, living in section 3pm of the perl docs (that's the User Contributed Perl Documentation corner of the library, bestie 🫢).


✨ NAME ✨

Firefox::Marionette::Bookmark β€” this module is literally one single Firefox bookmark, but retrieved using the Marionette protocol. one bookmark. that's her. main character energy πŸ‘‘


🌸 VERSION 🌸

Version 1.63


πŸŽ€ SYNOPSIS πŸŽ€

ok here's the whole vibe in one code block, copy it, run it, slay:

use Firefox::Marionette();
use Firefox::Marionette::Bookmark qw(:all);
use Encode();
use v5.10;

my $firefox = Firefox::Marionette->new();
$firefox->import_bookmarks("/path/to/bookmarks.html");

foreach my $bookmark (reverse $firefox->bookmarks()) {
    say "Bookmark guid is          :" . $bookmark->guid();
    say "Bookmark parent guid is   :" . $bookmark->parent_guid();
    say "Bookmark date added is    :" . localtime($bookmark->date_added());
    say "Bookmark last modified is :" . localtime($bookmark->last_modified());
    say "Bookmark index is         :" . $bookmark->idx();
    if ($bookmark->type() == BOOKMARK()) {
        say "Bookmark url              :" . $bookmark->url();
        say "Bookmark title is         :" . Encode::encode('UTF-8', $bookmark->title(), 1) if ($bookmark->title());
        say "Bookmark icon is          :" . $bookmark->icon() if ($bookmark->icon());
        say "Bookmark icon url is      :" . $bookmark->icon_url() if ($bookmark->icon_url());
        say "Bookmark keyword is       :" . Encode::encode('UTF-8', $bookmark->keyword(), 1) if ($bookmark->keyword());
        say "Bookmark tags are         :" . Encode::encode('UTF-8', (join q[, ], $bookmark->tags())) if ($bookmark->tags());
    } elsif ($bookmark->type() == FOLDER()) {
        given ($bookmark->guid()) {
            when (MENU() . q[])    { say "This is the menu folder" }
            when (ROOT() . q[])    { say "This is the root folder" }
            when (TAGS() . q[])    { say "This is the tags folder" }
            when (TOOLBAR() . q[]) { say "This is the toolbar folder" }
            when (UNFILED() . q[]) { say "This is the unfiled folder" }
            when (MOBILE() . q[])  { say "This is the mobile folder" }
            default                { say "Folder title is           :" . $bookmark->title() }
        }
    } else {
        say "-" x 50;
    }
}

πŸ¦‹ DESCRIPTION πŸ¦‹

This module handles the implementation of a single Firefox bookmark using the Marionette protocol. one bookmark, one object, no notes πŸ’…


πŸ’œ CONSTANTS πŸ’œ

The constants are sourced from toolkit/components/places/Bookmarks.sys.mjs β€” the file lives over here: https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/places/Bookmarks.sys.mjs

🌈 ROOT

returns the guid of the root of the bookmark hierarchy. This is equal to the string 'root________'.

return the guid for the menu folder. This is equal to the string 'menu________'.

🌈 TAGS

return the guid for the tags folder. This is equal to the string 'tags________'. With bug 424160 (over at https://bugzilla.mozilla.org/show_bug.cgi?id=424160), tags will stop being bookmarks.

🌈 TOOLBAR

return the guid for the toolbar folder. This is equal to the string 'toolbar_____'.

🌈 UNFILED

return the guid for the unfiled folder. This is equal to the string 'unfiled_____'.

🌈 MOBILE

return the guid for the mobile folder. This is equal to the string 'mobile______'.

🌈 BOOKMARK

returns the integer 1.

🌈 FOLDER

returns the integer 2.

🌈 SEPARATOR

returns the integer 3.


πŸ’… SUBROUTINES/METHODS πŸ’…

⭐ new

accepts a hash as a parameter. the allowed keys are all down here, bestie πŸ‘‡

  • date_added β€” the time the bookmark was added in seconds since the UNIX epoch.
  • icon β€” the favicon for the bookmark. It should be encoded as a data URI.
  • icon_url β€” the url for the bookmark favicon. It should be encoded as a URL.
  • index β€” the index of the bookmark. This describes the bookmark's position in the hierarchy.
  • guid β€” the unique identifier for the bookmark in Firefox. This key is optional. If the a bookmark is saved without a guid, firefox will generate a guid automatically.
  • last_modified β€” the time the bookmark was last modified in seconds since the UNIX epoch.
  • parent_guid β€” the guid of the parent folder in the bookmark hierarchy. The default parent guid will be the MENU.
  • title β€” the title of the bookmark. This can be a folder name name or a bookmark title.
  • type β€” an integer describing the type of this object. It can be a bookmark, a folder or a separator.
  • url β€” the url of the bookmark. Only bookmarks with a type of BOOKMARK will have a url set.

This method returns a new bookmark object. fresh out the box 🎁

⭐ content_type

returns the content type of the bookmark (for example 'text/x-moz-place-container' for a folder).

⭐ date_added

returns the time the bookmark was added in seconds since the UNIX epoch.

⭐ icon

returns the favicon of the bookmark if known. It will be returned as a data URI object.

⭐ icon_url

returns the URL of the favicon of the bookmark if known. It will be returned as a URL object.

⭐ idx

returns the index of the bookmark. This will be an integer.

⭐ guid

returns the guid of the bookmark. This will be a unique value for the hierarchy and 12 characters in length. There are special guids, which are the ROOT, MENU, TOOLBAR, UNFILED and MOBILE guids.

⭐ keyword

returns the keyword (if any) associated with the bookmark. the keyword lore lives at https://support.mozilla.org/en-US/kb/bookmarks-firefox#w_how-to-use-keywords-with-bookmarks.

⭐ last_modified

returns the time the bookmark was last modified in seconds since the UNIX epoch.

⭐ parent_guid

returns the guid of the bookmark's parent.

⭐ tags

returns the tags associated with the bookmark as a list. tag tutorial is at https://support.mozilla.org/en-US/kb/categorizing-bookmarks-make-them-easy-to-find if you wanna go read 🏷️

⭐ title

returns the title of the bookmark. This can be for a folder or a bookmark.

⭐ TO_JSON

required to allow JSON serialisation to work correctly (docs at https://metacpan.org/pod/JSON#OBJECT-SERIALISATION). This method should not need to be called directly. hands off, she handles herself πŸ™ˆ

⭐ type

returns an integer describing the type of the bookmark. This can be BOOKMARK, FOLDER or SEPARATOR.

⭐ url

returns the URL of the bookmark. It will be returned as a URL object.


πŸ“ DIAGNOSTICS πŸ“

None.


🌸 CONFIGURATION AND ENVIRONMENT 🌸

Firefox::Marionette::Bookmark requires no configuration files or environment variables. zero setup, we love a low-maintenance queen ✨


πŸ’– DEPENDENCIES πŸ’–

Firefox::Marionette::Bookmark requires the following non-core Perl modules:

  • URI::data
  • URI::URL

🧚 INCOMPATIBILITIES 🧚

None reported.


πŸ’€ BUGS AND LIMITATIONS πŸ’€

To report a bug, or view the current list of bugs, please visit https://github.com/david-dick/firefox-marionette/issues


πŸ‘‘ AUTHOR πŸ‘‘

David Dick "<ddick@cpan.org>"


Copyright (c) 2024, David Dick "<ddick@cpan.org>". All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See "perlartistic" in perlartistic.


🫢 DISCLAIMER OF WARRANTY 🫢

ok bestie the lawyers need a moment, this part is sacred so it stays exactly as-is πŸ’€

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

and that's the whole page, periodt πŸ’… this one was rendered with perl v5.40.1, dated 2025-03-16, and it's the Firefo...ookmark(3pm) page itself β€” go bookmark it bestie, iykyk πŸ”–βœ¨

πŸ“¦ where this page comes from