


WWW::Google::SiUserpContributed PerWWW::Google::SiteMap::Index(3)


NAME
       WWW::Google::SiteMap::Index - Perl extension for managing Google
       SiteMap Indexes

SYNOPSIS
         use WWW::Google::SiteMap::Index;

         my $index = WWW::Google::SiteMap::Index->new(
           file => 'sitemap-index.gz',
         );

         $index->add(WWW::Google::SiteMap::URL->new(
           loc     => 'http://www.jasonkohles.com/sitemap1.gz',
           lastmod => '2005-11-01',
         ));

DESCRIPTION
       A sitemap index is used to point Google at your sitemaps if you have
       more than one of them.

METHODS
       new()
           Creates a new WWW::Google::SiteMap::Index object.

             my $index = WWW::Google::SiteMap::Index->new(
               file => 'sitemap-index.gz',
             );

       read()
           Read a sitemap index in to this object.  If a filename is
           specified, it will be read from that file, otherwise it will be
           read from the file that was specified with the file() method.
           Reading of compressed files is done automatically if the filename
           ends with .gz.

       write([$file]);
           Write the sitemap index out to the file.  If a filename is
           specified, it will be written to that file, otherwise it will be
           written to the file that was specified with the file() method.
           Writing of compressed files is done automatically if the filename
           ends with .gz

       urls()
           Return the WWW::Google::SiteMap::URL objects that make up the
           sitemap index.

       add($item,[$item...]);
           Add the WWW::Google::SiteMap::URL items listed to the sitemap
           index.

           If you pass hashrefs instead of WWW::Google::SiteMap::URL objects,
           it will turn them into objects for you.  If the first item you pass
           is a simple scalar that matches \w, it will assume that the values
           passed are a hash for a single object.  If the first item passed



perl v5.12.2                2011-02-22                          1





WWW::Google::SiUserpContributed PerWWW::Google::SiteMap::Index(3)


           matches m{^\w+://} (i.e. it looks like a URL) then all the
           arguments will be treated as URLs, and WWW::Google::SiteMap::URL
           objects will be constructed for them, but only the loc field will
           be populated.

           This means you can do any of these:

             # create the WWW::Google::SiteMap::URL object yourself
             my $url = WWW::Google::SiteMap::URL->new(
               loc => 'http://www.jasonkohles.com/sitemap1.gz',
             );
             $map->add($url);

             # or
             $map->add(
               { loc => 'http://www.jasonkohles.com/sitemap1.gz' },
               { loc => 'http://www.jasonkohles.com/sitemap2.gz' },
               { loc => 'http://www.jasonkohles.com/sitemap3.gz' },
             );

             # or
             $map->add(
               loc       => 'http://www.jasonkohles.com/sitemap1.gz',
               priority  => 1.0,
             );

             # or even something funkier
             $map->add(qw(
               http://www.jasonkohles.com/
               http://www.jasonkohles.com/software/www-google-sitemap/
               http://www.jasonkohles.com/software/geo-shapefile/
               http://www.jasonkohles.com/software/text-fakedata/
             ));
             foreach my $url ($map->urls) { $url->lastmod('2005-11-01') }

       xml();
           Return the xml representation of the sitemap index.

       file();
           Get or set the filename associated with this object.  If you call
           read() or write() without a filename, this is the default.

       pretty()
           Set this to a true value to enable 'pretty-printing' on the XML
           output.  If false (the default) the XML will be more compact but
           not as easily readable for humans (Google and other computers won't
           care what you set this to).

           If you set this to a 'word' (something that matches /[a-z]/i), then
           that value will be passed to XML::Twig directly (see the XML::Twig
           pretty_print documentation).  Otherwise if a true value is passed,
           it means 'nice', and a false value means 'none'.

           Returns the value it was set to, or the current value if called



perl v5.12.2                2011-02-22                          2





WWW::Google::SiUserpContributed PerWWW::Google::SiteMap::Index(3)


           with no arguments.

MODULE HOME PAGE
       The home page of this module is
       http://www.jasonkohles.com/software/WWW-Google-SiteMap
       <http://www.jasonkohles.com/software/WWW-Google-SiteMap>.  This is
       where you can always find the latest version, development versions, and
       bug reports.  You will also find a link there to report bugs.

SEE ALSO
       WWW::Google::SiteMap

       WWW::Google::SiteMap::Ping

       http://www.jasonkohles.com/software/WWW-Google-Sitemap
       <http://www.jasonkohles.com/software/WWW-Google-Sitemap>

       <https://www.google.com/webmasters/sitemaps/docs/en/protocol.html#sitemapFileRequirements>

AUTHOR
       Jason Kohles, <email@jasonkohles.com>

COPYRIGHT AND LICENSE
       Copyright (C) 2005 by Jason Kohles

       This library is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself, either Perl version 5.8.4 or, at
       your option, any later version of Perl 5 you may have available.





























perl v5.12.2                2011-02-22                          3


