Frost

 view release on metacpan or  search on metacpan

t/000_moose_recipes/moose_cookbook_basics_recipe1.t  view on Meta::CPAN

#!/usr/bin/perl -w

use strict;
use warnings;

use lib 't/lib', 'lib';

use Frost::Test;

use Test::More 'no_plan';
use Test::Exception;
use Test::Differences;

$| = 1;

use Frost::Asylum;
use Frost::Util;

$Frost::Util::UUID_CLEAR	= 1;		#	delivers simple 'UUIDs' A-A-A-A-1, -2, -3... for testing

$Data::Dumper::Deparse	= true;

# =begin testing SETUP
{
	package Point;
#	use Moose;
	use Frost;

	has id	=> ( auto_id	=> 1 );

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

	sub clear {
		my $self = shift;
		$self->x(0);
		$self->y(0);
	}

	no Frost;
	__PACKAGE__->meta->make_immutable()		unless $::MAKE_MUTABLE;

	package Point3D;
	use Moose;

	extends 'Point';

	has 'z' => (isa => 'Int', is => 'rw', required => 1);

	after 'clear' => sub {
		my $self = shift;
		$self->z(0);
	};

	no Moose;
	__PACKAGE__->meta->make_immutable()		unless $::MAKE_MUTABLE;

	package main;

	use vars qw($CANVAS);

	$CANVAS = Frost::Asylum->new ( data_root	=> $TMP_PATH );

	# hash or hashrefs are ok for the constructor
	my $point1 = Point->new(x => 5, y => 7, asylum => $CANVAS );
	my $point2 = Point->new({x => 5, y => 7, asylum => $CANVAS });

	my $point3d = Point3D->new(x => 5, y => 42, z => -5, asylum => $CANVAS );

	$CANVAS->close;	#	and save
}



( run in 4.011 seconds using v1.01-cache-2.11-cpan-b301d465b3d )