NAME

CPAN::InGit::MirrorTree - Subclass of ArchiveTree which automatically mirrors files from upstream

DESCRIPTION

This is a subclass of CPAN::InGit::ArchiveTree which behaves as a pure mirror of an upstream CPAN or DarkPAN. The attribute "autofetch" allows it to import files from the public CPAN on demand.

ATTRIBUTES

upstream_url

This is the base URL from which files will be fetched.

autofetch

If enabled, attempts to access author files which exist on the "upstream_url" and not locally will immediately go download the file and return it as if it had existed all along. These changes are not automatically committed. Use has_changes to see if anything needs committed.

package_details_max_age

Number of seconds to cache the package_details file before attempting to re-fetch it. Defaults to one day (86400). This only has an effect when autofetch is enabled.

METHODS

fetch_upstream_file

$content= $mirror->fetch_upstream_file($path, %options);

# %options:
#   undef_if_404 - boolean, return undef instead of croaking on a 404 error

add_upstream_package_details

$blob= $mirror->add_upstream_package_details;

Fetches modules/02packages.details.txt.gz from upstream, unzips it, adds it to the tree, and returns the Git::Raw::BLOB.

add_upstream_author_file

$blob= $mirror->add_upstream_author_file($author_path, %options);

Fetch the file (relative to authors/id/) from upstream and add it to this tree. Also return the Git::Raw::BLOB.

VERSION

version 0.002

AUTHOR

Michael Conrad <mike@nrdvana.net>

COPYRIGHT AND LICENSE

This software is copyright (c) 2025 by Michael Conrad, and IntelliTree Solutions.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.