.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Firefox::Marionette::Bookmark 3pm" .TH Firefox::Marionette::Bookmark 3pm 2024-05-15 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Firefox::Marionette::Bookmark \- Represents a Firefox bookmark retrieved using the Marionette protocol .SH VERSION .IX Header "VERSION" Version 1.57 .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 4 \& 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(\*(AqUTF\-8\*(Aq, $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(\*(AqUTF\-8\*(Aq, $bookmark\->keyword(), 1) if ($bookmark\->keyword()); \& say "Bookmark tags are :" . Encode::encode(\*(AqUTF\-8\*(Aq, (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; \& } \& } .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This module handles the implementation of a single Firefox bookmark using the Marionette protocol. .SH CONSTANTS .IX Header "CONSTANTS" Constants are sourced from toolkit/components/places/Bookmarks.sys.mjs . .SS ROOT .IX Subsection "ROOT" returns the guid of the root of the bookmark hierarchy. This is equal to the string 'root_\|_\|_\|_\|_\|_\|_\|_'. .SS MENU .IX Subsection "MENU" return the guid for the menu folder. This is equal to the string 'menu_\|_\|_\|_\|_\|_\|_\|_'. .SS TAGS .IX Subsection "TAGS" return the guid for the tags folder. This is equal to the string 'tags_\|_\|_\|_\|_\|_\|_\|_'. With bug 424160 , tags will stop being bookmarks. .SS TOOLBAR .IX Subsection "TOOLBAR" return the guid for the toolbar folder. This is equal to the string 'toolbar_\|_\|_\|_\|_'. .SS UNFILED .IX Subsection "UNFILED" return the guid for the unfiled folder. This is equal to the string 'unfiled_\|_\|_\|_\|_'. .SS MOBILE .IX Subsection "MOBILE" return the guid for the mobile folder. This is equal to the string 'mobile_\|_\|_\|_\|_\|_'. .SS BOOKMARK .IX Subsection "BOOKMARK" returns the integer 1. .SS FOLDER .IX Subsection "FOLDER" returns the integer 2. .SS SEPARATOR .IX Subsection "SEPARATOR" returns the integer 3. .SH SUBROUTINES/METHODS .IX Header "SUBROUTINES/METHODS" .SS new .IX Subsection "new" accepts a hash as a parameter. Allowed keys are below; .IP \(bu 4 date_added. the time the bookmark was added in seconds since the UNIX epoch. .IP \(bu 4 icon \- the favicon for the bookmark. It should be encoded as a data URI. .IP \(bu 4 icon_url \- the url for the bookmark favicon. It should be encoded as a URL. .IP \(bu 4 index \- the index of the bookmark. This describes the bookmark's position in the hierarchy. .IP \(bu 4 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. .IP \(bu 4 last_modified \- the time the bookmark was last modified in seconds since the UNIX epoch. .IP \(bu 4 parent_guid \- the guid of the parent folder in the bookmark hierarchy. The default parent guid will be the MENU. .IP \(bu 4 title \- the title of the bookmark. This can be a folder name name or a bookmark title. .IP \(bu 4 type \- an integer describing the type of this object. It can be a bookmark, a folder or a separator. .IP \(bu 4 url \- the url of the bookmark. Only bookmarks with a type of BOOKMARK will have a url set. .PP This method returns a new bookmark object. .SS content_type .IX Subsection "content_type" returns the content type of the bookmark (for example 'text/x\-moz\-place\-container' for a folder). .SS date_added .IX Subsection "date_added" returns the time the bookmark was added in seconds since the UNIX epoch. .SS icon .IX Subsection "icon" returns the favicon of the bookmark if known. It will be returned as a data URI object. .SS icon_url .IX Subsection "icon_url" returns the URL of the favicon of the bookmark if known. It will be returned as a URL object. .SS idx .IX Subsection "idx" returns the index of the bookmark. This will be an integer. .SS guid .IX Subsection "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. .SS keyword .IX Subsection "keyword" returns the keyword (if any) associated with the bookmark. .SS last_modified .IX Subsection "last_modified" returns the time the bookmark was last modified in seconds since the UNIX epoch. .SS parent_guid .IX Subsection "parent_guid" returns the guid of the bookmark's parent. .SS tags .IX Subsection "tags" returns the tags associated with the bookmark as a list. .SS title .IX Subsection "title" returns the title of the bookmark. This can be for a folder or a bookmark. .SS TO_JSON .IX Subsection "TO_JSON" required to allow JSON serialisation to work correctly. This method should not need to be called directly. .SS type .IX Subsection "type" returns an integer describing the type of the bookmark. This can be BOOKMARK, FOLDER or SEPARATOR. .SS url .IX Subsection "url" returns the URL of the bookmark. It will be returned as a URL object. .SH DIAGNOSTICS .IX Header "DIAGNOSTICS" None. .SH "CONFIGURATION AND ENVIRONMENT" .IX Header "CONFIGURATION AND ENVIRONMENT" Firefox::Marionette::Bookmark requires no configuration files or environment variables. .SH DEPENDENCIES .IX Header "DEPENDENCIES" Firefox::Marionette::Bookmark requires the following non-core Perl modules .IP \(bu 4 URI::data .IP \(bu 4 URI::URL .SH INCOMPATIBILITIES .IX Header "INCOMPATIBILITIES" None reported. .SH "BUGS AND LIMITATIONS" .IX Header "BUGS AND LIMITATIONS" To report a bug, or view the current list of bugs, please visit .SH AUTHOR .IX Header "AUTHOR" David Dick \f(CW\*(C`\*(C'\fR .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" Copyright (c) 2024, David Dick \f(CW\*(C`\*(C'\fR. All rights reserved. .PP This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See "perlartistic" in perlartistic. .SH "DISCLAIMER OF WARRANTY" .IX Header "DISCLAIMER OF WARRANTY" 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. .PP 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.