The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MooseX::Storage::IO::GitStore - Save Moose objects in your GitStore

VERSION

version 0.17

SYNOPSIS

  package Point;
  use Moose;
  use MooseX::Storage;

  with Storage( format => 'YAML', io => 'GitStore');

  has 'x' => (is => 'rw', isa => 'Int');
  has 'y' => (is => 'rw', isa => 'Int');

  1;

  my $p = Point->new(x => 10, y => 10);

  ## methods to load/store a class
  ## on the file system

  $p->store('my_point', git_repo => './store');

  my $p2 = Point->load('my_point', git_repo => './store');

ATTRIBUTES

The role adds two attributes to the class, git_repo and gitstore.

git_repo

The optional path to the git repository where the object will be stored.

gitstore

The GitStore object used by the storage system. If not specified, it will be created using git_repo, and will have autocommit set to 1.

METHODS

load ($filename, git_repo = $path)>

Load the object associated with $filename. $path can be omited if used from an object instead of as a class method.

store ($filename, git_repo = $path)>

Save the object as $filename. $path can be omited if used from an object instead of as a class method.

SEE ALSO

MooseX::Storage

AUTHORS

  • Fayland Lam <fayland@gmail.com>

  • Yanick Champoux <yanick@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Fayland Lam <fayland@gmail.com>.

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