1234567891011121314151617181920212223242526272829303132333435 |
- package SugarTrail::Repo;
- # provide access to STM objects
- #
- # * load_master()
-
- use strict;
- use warnings;
- use Carp;
- use helper;
- use SugarTrail::Template::Master;
-
- # initialize repo
- sub new {
- my $class = shift;
- my $args = { @_ };
- exists($args->{type}) or $args->{type} = 'SugarTrail::Repo::Filesystem';
- $class = $args->{type};
- #TODO: remove use fail
- use SugarTrail::Repo::Filesystem;
- return $class->new(%$args);
- }
-
- sub load_master {
- my $self = shift;
- my $args = { @_ };
-
- my $master = SugarTrail::Template::Master->new();
- $master->{text} = $self->load_text(source => $args->{source})
- or return;
- $master->{source} = $args->{source};
-
- return $master;
- }
-
- 1;
|