BEGIN {
- package Newswriter::Meta::Instance;
+ package Moose::POOP::Meta::Instance;
use strict;
use warnings;
use Moose;
sprintf "%s->{instance}->{%s}", $instance, $slot_name;
}
- package Newswriter::Meta::Class;
+ package Moose::POOP::Meta::Class;
use strict;
use warnings;
use Moose;
if $params{oid};
super();
};
-}
+}
{
- package Newswriter::Base;
+ package Moose::POOP::Object;
use strict;
use warnings;
- use metaclass 'Newswriter::Meta::Class' => (
- ':instance_metaclass' => 'Newswriter::Meta::Instance'
+ use metaclass 'Moose::POOP::Meta::Class' => (
+ ':instance_metaclass' => 'Moose::POOP::Meta::Instance'
);
use Moose;
->get_meta_instance
->get_instance_oid($self);
}
-
+
+}
+{
package Newswriter::Author;
use strict;
use warnings;
use Moose;
- extends 'Newswriter::Base';
+ extends 'Moose::POOP::Object';
has 'first_name' => (is => 'rw', isa => 'Str');
has 'last_name' => (is => 'rw', isa => 'Str');
use DateTime::Format::MySQL;
- extends 'Newswriter::Base';
+ extends 'Moose::POOP::Object';
subtype 'Headline'
=> as 'Str'
}
{ # check the meta stuff first
- isa_ok(Newswriter::Base->meta, 'Newswriter::Meta::Class');
- isa_ok(Newswriter::Base->meta, 'Moose::Meta::Class');
- isa_ok(Newswriter::Base->meta, 'Class::MOP::Class');
+ isa_ok(Moose::POOP::Object->meta, 'Moose::POOP::Meta::Class');
+ isa_ok(Moose::POOP::Object->meta, 'Moose::Meta::Class');
+ isa_ok(Moose::POOP::Object->meta, 'Class::MOP::Class');
- is(Newswriter::Base->meta->instance_metaclass,
- 'Newswriter::Meta::Instance',
+ is(Moose::POOP::Object->meta->instance_metaclass,
+ 'Moose::POOP::Meta::Instance',
'... got the right instance metaclass name');
- isa_ok(Newswriter::Base->meta->get_meta_instance, 'Newswriter::Meta::Instance');
+ isa_ok(Moose::POOP::Object->meta->get_meta_instance, 'Moose::POOP::Meta::Instance');
- my $base = Newswriter::Base->new;
- isa_ok($base, 'Newswriter::Base');
+ my $base = Moose::POOP::Object->new;
+ isa_ok($base, 'Moose::POOP::Object');
isa_ok($base, 'Moose::Object');
- isa_ok($base->meta, 'Newswriter::Meta::Class');
+ isa_ok($base->meta, 'Moose::POOP::Meta::Class');
isa_ok($base->meta, 'Moose::Meta::Class');
isa_ok($base->meta, 'Class::MOP::Class');
is($base->meta->instance_metaclass,
- 'Newswriter::Meta::Instance',
+ 'Moose::POOP::Meta::Instance',
'... got the right instance metaclass name');
- isa_ok($base->meta->get_meta_instance, 'Newswriter::Meta::Instance');
+ isa_ok($base->meta->get_meta_instance, 'Moose::POOP::Meta::Instance');
}
my $article_oid;
);
} '... created my article successfully';
isa_ok($article, 'Newswriter::Article');
- isa_ok($article, 'Newswriter::Base');
+ isa_ok($article, 'Moose::POOP::Object');
lives_ok {
$article->start_date(DateTime->new(year => 2006, month => 6, day => 10));
## check some meta stuff
- isa_ok($article->meta, 'Newswriter::Meta::Class');
+ isa_ok($article->meta, 'Moose::POOP::Meta::Class');
isa_ok($article->meta, 'Moose::Meta::Class');
isa_ok($article->meta, 'Class::MOP::Class');
is($article->meta->instance_metaclass,
- 'Newswriter::Meta::Instance',
+ 'Moose::POOP::Meta::Instance',
'... got the right instance metaclass name');
- isa_ok($article->meta->get_meta_instance, 'Newswriter::Meta::Instance');
+ isa_ok($article->meta->get_meta_instance, 'Moose::POOP::Meta::Instance');
ok($article->oid, '... got a oid for the article');
is($article->status, 'pending', '... got the right status');
}
-Newswriter::Meta::Instance->_reload_db();
+Moose::POOP::Meta::Instance->_reload_db();
my $article2_oid;
my $article2_ref;
);
} '... created my article successfully';
isa_ok($article2, 'Newswriter::Article');
- isa_ok($article2, 'Newswriter::Base');
+ isa_ok($article2, 'Moose::POOP::Object');
$article2_oid = $article2->oid;
$article2_ref = "$article2";
$article = Newswriter::Article->new(oid => $article_oid);
} '... (re)-created my article successfully';
isa_ok($article, 'Newswriter::Article');
- isa_ok($article, 'Newswriter::Base');
+ isa_ok($article, 'Moose::POOP::Object');
is($article->oid, $article_oid, '... got a oid for the article');
isnt($article_ref, "$article", '... got a new article instance');
is($article->status, 'pending', '... got the right status');
}
-Newswriter::Meta::Instance->_reload_db();
+Moose::POOP::Meta::Instance->_reload_db();
{
my $article;
$article = Newswriter::Article->new(oid => $article_oid);
} '... (re)-created my article successfully';
isa_ok($article, 'Newswriter::Article');
- isa_ok($article, 'Newswriter::Base');
+ isa_ok($article, 'Moose::POOP::Object');
is($article->oid, $article_oid, '... got a oid for the article');
isnt($article_ref, "$article", '... got a new article instance');
$article2 = Newswriter::Article->new(oid => $article2_oid);
} '... (re)-created my article successfully';
isa_ok($article2, 'Newswriter::Article');
- isa_ok($article2, 'Newswriter::Base');
+ isa_ok($article2, 'Moose::POOP::Object');
is($article2->oid, $article2_oid, '... got a oid for the article');
isnt($article2_ref, "$article2", '... got a new article instance');