View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Ivor Williams > VCS-Lite-Repository-0.09 > VCS::Lite::Store



Annotate this POD

View/Report Bugs
Module Version: 0.02   Source   Latest Release: VCS-Lite-Repository-0.12


VCS::Lite::Store - Base class for repository persistence stores


  package mystore;
  use base qw/VCS::Lite::Store/;

  my $newstore = mystore->new( user => 'fred', password => 'bloggs'...);
  my $rep = VCS::Lite::Repository->new( path => 'src/myfile.c',
                                        store => $newstore );


The VCS::Lite::Repository version control system offers a choice of back end storage mechanism. It is architected such that new back end stores can be written, that will plug in with the existing classes. The store is used as an object persistence mechanism for VCS::Lite::Repository and VCS::Lite::Element objects. The store can also potentially act as a proxy, giving access to repositories that live on another machine, or even in another type of version control system.

The store object is passed to the element and repository constructors VCS::Lite::Repository->new and VCS::Lite::Element->new as the optional parameter store. Note that this parameter can take a class name instead, see "In Situ Stores" below.



The constructor takes a varying list of option value pairs. The exact list depends on which store class used. These may, for example, include a DBI connect string, username and password. Here are the ones inplemented in the base class for use by the YAML and Storable classes:


  $store->retrieve( $path);

This is the call which is made by the VCS::Lite::Element and VCS::Lite::Repository constructors, to retrieve an existing object from the store. Return undef if the object does not exist.


  $store->create( $proto);

This call writes an object to the store. If this object already exists, it is overwritten. $proto is a prototype object, with a path and a few other members populated, already blessed into the right class. The call returns a persisted, fully populated object.


  $store->retrieve_or_create( $proto);

Perform a retrieve based on the path attribute of the prototype, or create a persisted object if it does not already exist in the store.



Apply updates to persist the object. This method is virtual, i.e. the subclass is expected to provide the save method.



Load an object from a persistance store. This method is virtual, i.e. the subclass is expected to provide the load method.


This method is internal to flat file stores. It is used to convert between the path of a file or directory being version controlled, and the path for the corresponding store. store_path returns a list of two scalars, which are a directory and a file. There is an optional parameter of the file type used by VCS::Lite::Element::Binary; this is passed over to repos_name.


Passed an element name or the empty string, this is a virtual method that turns this into the filename used to persist the element or repository.

There is also an optional file type parameter, which overrides the default one for the type of store.

In Situ Stores ^

As an alternative to an object as a store, VCS::Lite::Repository and VCS::Lite::Element can be passed a class name. These use a more limited type of store that lives in situ inside the directory tree of the files being versioned. The class name can be shortened by missing off the VCS::Lite::Store:: from the front.

The store lives under 'hidden' directories called .VCSLite or in the case of VMS _VCSLITE (dots are not permitted in the directory name syntax).

syntax highlighting: