Git::Database::Role::Object - Role for objects from the Git object database
version 0.010
package Git::Database::Object::Blob; use Moo; with 'Git::Database::Role::Object'; sub kind { 'blob' } 1;
Git::Database::Role::Object provides the generic behaviour for all Git::Database objects obtained from or stored into the Git object database.
When creating a new object meant to be added to the Git object database (via backend), only the "content" attribute is actually required.
New objects are typically created via Git::Database::Role::ObjectReader's get_object method, rather than by calling new directly. This is when the object data is fetched from the Git object database.
new
The content, size and digest attribute are lazy, and can be computed from the others: size from content, content from digest (if the object exists in the backend store), and digest from content. All attributes have a predicate method.
Additional attributes in some classes may add other ways to compute the content.
Creating a new object with inconsistent kind, size, content and digest attributes can only end in tears. This is also true for additional attributes such as directory_entries, commit_info, and tag_info.
kind
size
content
digest
For now, as soon as the "content" of a Git::Database::Role::Object is needed, it is fully loaded in memory.
A Git::Database::Role::Backend from which the object comes from (or will be stored into). It is typically used by the attribute builders.
If none is provided, a Git::Database::Backend::None is used, which is only able to compute the digest.
The object's actual content.
The size (in bytes) of the object content.
The SHA-1 digest of the object, as computed by Git.
If set at creation time, it is internally converted to lowercase.
Return a string representation of the content.
By default, this is the same as content(), but some classes may override it.
content()
Returns the object "kind".
In Git, this is one of blob, tree, commit, and tag.
blob
tree
commit
tag
Git::Database::Object::Blob, Git::Database::Object::Tree, Git::Database::Object::Commit, Git::Database::Object::Tag.
Philippe Bruhat (BooK) <book@cpan.org>.
Copyright 2013-2016 Philippe Bruhat (BooK), all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Git::Database, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Git::Database
CPAN shell
perl -MCPAN -e shell install Git::Database
For more information on module installation, please visit the detailed CPAN module installation guide.