package Git::Database; $Git::Database::VERSION = '0.007'; use strict; use warnings; use Module::Runtime qw( use_module ); use Moo::Object (); use namespace::clean; sub new { my $args = Moo::Object::BUILDARGS(@_); # store: an object that gives actual access to a git repo if ( my $store = delete $args->{store} ) { if ( !ref $store || -d $store ) { require Git::Database::Backend::Git::Sub; return Git::Database::Backend::Git::Sub->new( store => $store ); } else { return use_module( "Git::Database::Backend::" . ref $store ) ->new( store => $store ); } } # some really basic default return use_module('Git::Database::Backend::None')->new; } 1; __END__ =pod =head1 NAME Git::Database - Provide access to the Git object database =head1 VERSION version 0.007 =head1 SYNOPSIS # get a store my $r = Git::Repository->new(); # build a backend to access the store my $db = Git::Database::Backend::Git::Repository->new( store => $r ); # or let Git::Database figure it out by itself my $db = Git::Database->new( store => $r ); =head1 DESCRIPTION Git::Database provides access from Perl to the object database stored in a Git repository. It can use any supported Git wrapper to access the Git object database maintained by Git. Git::Database is actually a factory class: L returns L instances. =head1 METHODS =head2 new my $r = Git::Repository->new; # $db is-a Git::Database::Backend::Git::Repository my $db = Git::Database->new( store => $r ); Return a L object, based on the class of the L object. =head1 BACKEND METHODS The backend methods are split between several roles, and not all backends do all the roles. Therefore not all backend objects support all the following methods. =head2 From L This is the minimum required role to be a backend. Hence this method is always available. =over 4 =item L =back =head2 From L =over 4 =item L =item L =item L =item L =item L =back =head2 From L =over 4 =item L =back =head2 From L =over 4 =item L =item L =item L =back =head2 From L =over 4 =item L =item L =back =head1 SEE ALSO =over 4 =item Objects L, L, L, L. =item Backend roles L, L, L, L, L. =item Backends L, L. =back =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Git::Database You can also look for information at: =over 4 =item * RT: CPAN's request tracker L =item * CPAN Ratings L =item * Search CPAN L =item * MetaCPAN L =back =head1 AUTHOR Philippe Bruhat (BooK) . =head1 COPYRIGHT Copyright 2013-2016 Philippe Bruhat (BooK), all rights reserved. =head1 LICENSE This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut