-use strict;
-use warnings;
use Module::Build;
-my $builder = Module::Build->new(
- module_name => 'MooseX::Storage',
- license => 'perl',
- dist_author => 'Chris Prather <perigrin@cpan.org>, Stevan Little <stevan@iinteractive.com>',
- dist_version_from => 'lib/MooseX/Storage.pm',
- requires => {
- 'Test::More' => 0,
- 'Moose' => 0,
- 'JSON::Any' => 0,
+use strict;
+
+my $build = Module::Build->new(
+ module_name => 'MooseX::Storage',
+ license => 'perl',
+ requires => {
+ 'Moose' => '0.20',
+ # you should have at least one
+ # serialization format
+ 'JSON::Any' => '0',
+ 'Best' => '0', # << this if for loading YAML
+ # and the ability to save the
+ # file to disk
+ 'IO::File' => '0',
},
- add_to_cleanup => [ 'MooseX-Storage-*' ],
+ optional => {
+ 'IO::AtomicFile' => '0',
+ # these are only used in the
+ # test, I recommend them, but
+ # there is no need to force
+ # them on people :)
+ 'Test::YAML::Valid' => '0',
+ 'Test::JSON' => '0',
+ },
+ build_requires => {
+ 'Test::More' => '0.62',
+ 'Test::Exception' => '0.21',
+ },
+ create_makefile_pl => 'traditional',
+ recursive_test_files => 1,
+ add_to_cleanup => [
+ 'META.yml', '*.bak', '*.gz', 'Makefile.PL',
+ ],
);
-$builder->create_build_script();
+$build->create_build_script;
+
Build.PL
Changes
-MANIFEST
-META.yml # Will be created by "make dist"
+META.yml
Makefile.PL
+MANIFEST
+MANIFEST.SKIP
README
+TODO
lib/MooseX/Storage.pm
+lib/MooseX/Storage/Basic.pm
lib/MooseX/Storage/Engine.pm
+lib/MooseX/Storage/Engine/IO/AtomicFile.pm
lib/MooseX/Storage/Engine/IO/File.pm
lib/MooseX/Storage/Format/JSON.pm
+lib/MooseX/Storage/Format/YAML.pm
+lib/MooseX/Storage/IO/AtomicFile.pm
lib/MooseX/Storage/IO/File.pm
+lib/MooseX/Storage/Meta/Attribute/DoNotSerialize.pm
+t/000_load.t
t/001_basic.t
+t/002_basic_w_subtypes.t
+t/003_basic_w_embedded_objects.t
+t/004_w_cycles.t
+t/010_basic_json.t
+t/020_basic_yaml.t
+t/100_io.t
+t/101_io_atomic.t
t/pod-coverage.t
t/pod.t
--- /dev/null
+^_build
+^Build$
+^blib
+~$
+\.bak$
+^MANIFEST\.SKIP$
+CVS
+\.svn
+\.DS_Store
+cover_db
+\..*\.sw.?$
+^Makefile$
+^pm_to_blib$
+^MakeMaker-\d
+^blibdirs$
+\.old$
+^#.*#$
+^\.#
+^TODO$
\ No newline at end of file
+++ /dev/null
-use strict;
-use warnings;
-use ExtUtils::MakeMaker;
-
-WriteMakefile(
- NAME => 'MooseX::Storage',
- AUTHOR => 'Chris Prather <perigrin@cpan.org>, Stevan Little <stevan@iinteractive.com>',
- VERSION_FROM => 'lib/MooseX/Storage.pm',
- ABSTRACT_FROM => 'lib/MooseX/Storage.pm',
- PL_FILES => {},
- PREREQ_PM => {
- 'Test::More' => 0,
- 'Moose' => 0,
- 'JSON::Any' => 0,
- },
- dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
- clean => { FILES => 'MooseX-Storage-*' },
-);
DEPENDENCIES
-Moose!!!!!!!
+ Moose
+ JSON::Any
+ Best (in order to load a YAML file)
+ IO::Fole
+
+OPTIONAL DEPENDENCIES
+
+ IO::AtomicFile
+ Test::YAML::Valid
+ Test::JSON
COPYRIGHT AND LICENCE
--- /dev/null
+---------------------------------------------------------------------
+:NOTES:
+---------------------------------------------------------------------
+
+purely functional means we don't have to reinstantiate Engine each time,
+and IMHO there's no need even without big changes.
+
+We can do something like this:
+
+ sub collapse_object {
+ my $self = shift;
+ my %storage;
+ $self->map_attributes(sub { $self->collapse_attribute(\%storage, @_) });
+ }
+
+or we can make collapse_attribute return KVPs (I think that's nicer and more reusable):
+
+ sub collapse_object {
+ my $self = shift;
+ return {
+ $self->map_attributes('collapse_attribute'),
+ __class__ => $self->object->meta->name,
+ };
+ }
+
+I 100% agree, the instantiation of Engine was actually a leftover from an
+early version, so I can make this more functional without too much trouble.
+
+---------------------------------------------------------------------
+
+I am not going to do this quite yet, I think there might actually still be value to
+keeping it the way it is. I want to attempt an engine extension first, before i do this.
+
+
+
+
use strict;
use warnings;
-use Test::More no_plan => 1;
+use Test::More tests => 1;
BEGIN {
use_ok('MooseX::Storage');
use strict;
use warnings;
-use Test::More no_plan => 1;
+use Test::More tests => 11;
BEGIN {
use_ok('MooseX::Storage');
use strict;
use warnings;
-use Test::More no_plan => 1;
+use Test::More tests => 11;
BEGIN {
use_ok('MooseX::Storage');
use strict;
use warnings;
-use Test::More no_plan => 1;
+use Test::More tests => 47;
BEGIN {
use_ok('MooseX::Storage');
use strict;
use warnings;
-use Test::More no_plan => 1;
+use Test::More tests => 12;
use Test::Exception;
BEGIN {
use strict;
use warnings;
-use Test::More no_plan => 1;
-use Test::JSON;
+use Test::More;
BEGIN {
+ eval "use Test::JSON";
+ plan skip_all => "Test::JSON is required for this test" if $@;
+ plan tests => 12;
use_ok('MooseX::Storage');
}
my $json = $foo->freeze;
- is_valid_json($json);
+ is_valid_json($json, '.. this is valid JSON');
is_json(
$json,
use strict;
use warnings;
-use Test::More no_plan => 1;
-use Test::YAML::Valid;
+use Test::More;
BEGIN {
+ eval "use Test::YAML::Valid";
+ plan skip_all => "Test::YAML::Valid is required for this test" if $@;
+ plan tests => 12;
use_ok('MooseX::Storage');
}
use strict;
use warnings;
-use Test::More no_plan => 1;
+use Test::More tests => 10;
BEGIN {
use_ok('MooseX::Storage');
use strict;
use warnings;
-use Test::More no_plan => 1;
+use Test::More;
BEGIN {
+ eval "use IO::AtomicFile";
+ plan skip_all => "IO::AtomicFile is required for this test" if $@;
+ plan tests => 10;
use_ok('MooseX::Storage');
}