NAME

WWW::Noss::OPML - OPML file reader/writer

USAGE

use WWW::Noss::OPML;

my $opml = WWW::Noss::OPML->from_perl(
    title => 'Name',
    feeds => [ { ... }, ... ],
);

$opml->to_file('path/to/xml');

# Read from file
$opml = WWW::Noss::OPML->from_xml('path/to/xml');

DESCRIPTION

WWW::Noss::OPML is a module that provides an interface for reading and writing OPML files. This is a private module, please consult the noss manual for user documentation.

METHODS

$opml = WWW::Noss::OPML->from_perl(%param)

Creates a new WWW::Noss::OPML object from the parameters supplied via the %param hash.

The following are a list of valid fields for the %param hash. The only required field is title.

title

Title string for the OPML file.

feeds

Array ref of outline feed hashes. The hashes should look something like this:

{
  title    => ..., # required
  xml_url  => ..., # required
  text     => ...,
  html_url => ...,
  groups   => [ ... ],
}
$opml = WWW::Noss::OPML->from_xml($file)

Create WWW::Noss::OPML object from the given OPML file.

$dom = $opml->to_xml([ %param ])

Returns a XML::LibXML::Document DOM object representing the object.

%param is an optional hash of additional parameters to configure the converted XML structure. The following are valid values:

folders

Boolean determining whether to include outline folders in the XML strucutre. Defaults to true.

$file = $opml->to_file($file, [ %param ])

Writes the OPML object's XML structure to $file. Returns $file on success, dies on failure.

%param is an optional hash of additional parameters. Accepts the same options as to_xml().

$fh = $opml->to_fh($fh, [ %param ])

Writes the OPML object's XML structure to the $fh file handle. Returns $fh on success, dies on failure.

%param is an optional hash of additional parameters. Accepts the same options as to_xml().

$title = $opml->title()
$opml->set_title($title)

Getter/setter for the OPML's title attribute.

\@feeds = $opml->feeds()
$opml->set_feeds(\@feeds)

Getter/setter for the OPML's feeds attribute.

$rn = $opml->rename_group($old, $new)

Goes through each feed's group list and renames the group $old to $new. Returns the number of groups renamed.

AUTHOR

Written by Samuel Young, <samyoung12788@gmail.com>.

This project's source can be found on its Codeberg page. Comments and pull requests are welcome!

COPYRIGHT

Copyright (C) 2025 Samuel Young

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

SEE ALSO

XML::LibXML::Document, noss