NAME
Git::Native::Blob - A libgit2 blob object
VERSION
version 0.005
SYNOPSIS
my $blob = $repo->blob($oid);
say $blob->size;
say $blob->content;
DESCRIPTION
A libgit2 blob, exposing oid, size, content. Freed when the object goes out of scope. Obtained from "blob" in Git::Native::Repository or "object" in Git::Native::Repository; the blob keeps its repository alive for as long as it is itself in scope.
Blobs are created from a Perl scalar with "blob_create_frombuffer" in Git::Native::Repository, which returns the OID rather than a Blob.
oid
say $blob->oid; # full hex
The blob's Git::Native::Oid. Computed on first use from the object handle.
size
say $blob->size; # 6
Size of the blob content in bytes.
content
my $bytes = $blob->content;
The raw blob content as a byte string, copied out of libgit2's buffer, so it stays valid after the Blob goes away. Binary-safe: NUL bytes and non-UTF-8 data survive unchanged, and nothing is decoded — a text file comes back as bytes, not characters. An empty blob yields the empty string.
SEE ALSO
Git::Native::Repository, Git::Native::Tree, Git::Native::Oid
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-git-native/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <getty@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.