Git Product home page Git Product logo

cpan-cache's Introduction

NAME
    CPAN::Cache - Abstract locally-cached logical subset of a CPAN mirror

DESCRIPTION
    There have been any number of scripts and modules written that contain
    as part of their functionality some form of locally stored partial
    mirror of the CPAN dataset.

    CPAN::Cache does the same thing, except that in addition it has the
    feature that the downloading and storage of CPAN data is all that it
    does, so it should not introduce any additional dependencies or bloat,
    and should be much easier to reuse that existing modules, which
    generally are more task-specific.

    The intent is that this module will be usable by everything that is in
    the business of pulling modules from CPAN, storing them locally, and
    doing something with them.

    In this way, it really does little other than mirror data from a remote
    URI, except that CPAN::Cache also provides some additional intelligence
    about which files are and are not static (will never change) which
    aren't, and is typed specifically as a mirror of CPAN, instead of any
    other sort of mirror.

    By building this module as a seperate distribution, it is hoped we can
    improve seperation of concerns in the CPAN-related modules and ensure
    cleaner, smaller, and more robust tools that interact with the CPAN in
    the most correct ways.

METHODS
  new
      my $cache = CPAN::Cache->new(
          remote_uri => 'http://search.cpan.org/CPAN/',
          local_dir  => '/tmp/cpan',
          );

  remote_uri
    The "remote_uri" accessor returns a URI object for the remote CPAN
    repository.

  local_dir
    The "local_dir" accessor returns the filesystem path for the root root
    directory of the CPAN cache.

  file path/to/file.txt
    The "file" method takes the path of a file within the repository, and
    returns a URI::ToDisk object representing it's location on both the
    server, and on the local filesystem.

    Paths should always be provided in unix/web format, not the local
    filesystem's format.

    Returns a HTML::ToDisk or throws an exception if passed a bad path.

  get path/to/file.txt
    The "get" method takes the path of a file within the repository, and
    fetches it from the remote repository, storing it at the appropriate
    local path.

    Paths should always be provided in unix/web format, not the local
    filesystem's format.

    Returns the URI::ToDisk for the file if retrieved successfully, false
    false if the file does not exist within the repository, or throws an
    exception on error.

  mirror path/to/file.txt
    The "mirror" method takes the path of a file within the repository, and
    mirrors it from the remote repository, storing it at the appropriate
    local path.

    Using this method if preferable for items like indexs for which want to
    ensure you have the current version, but do not want to freshly download
    each time.

    Paths should always be provided in unix/web format, not the local
    filesystem's format.

    Returns the URI::ToDisk for the file if mirrored successfully, false if
    the file did not exist in the repository, or throws an exception on
    error.

  static
    The "static" method determines whether a given path within CPAN is able
    to change or not.

    In the CPAN, some files such as index files and checksum can change,
    while other files such as the tarball files will be static, and once
    committed to the repository will never be changed (altough they may be
    deleted).

    In a caching scenario, this means that if the file exists locally, we
    will never need to return to the server to check for a new version, we
    enables additional optimisations for CPAN-related algorithms.

    Returns true if the file will never change, false if not, or throws an
    exception on error.

TO DO
    - Write a proper test suite, not just a compile test (even though this
    was taken from working JSAN code)

SUPPORT
    Bugs should be reported via the CPAN bug tracker

    <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CPAN-Cache>

    For other issues, contact the author.

AUTHOR
    Adam Kennedy <[email protected]>

SEE ALSO
    CPAN::Index, CPAN::Mini, DBIx::Class

COPYRIGHT
    Copyright 2006 Adam Kennedy.

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

    The full text of the license can be found in the LICENSE file included
    with this module.

cpan-cache's People

Contributors

adamkennedy avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.