view release on metacpan or search on metacpan
data/t/attributes/accessor_context.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
is( exception {
package My::Class;
use Moose;
has s_rw => (
is => 'rw',
);
has s_ro => (
data/t/attributes/attr_dereference_test.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
{
package Customer;
use Moose;
package Firm;
use Moose;
use Moose::Util::TypeConstraints;
data/t/attributes/attribute_accessor_generation.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
use Scalar::Util 'isweak';
{
package Foo;
use Moose;
eval {
has 'foo' => (
data/t/attributes/attribute_custom_metaclass.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
{
package Foo::Meta::Attribute;
use Moose;
extends 'Moose::Meta::Attribute';
around 'new' => sub {
my $next = shift;
data/t/attributes/attribute_delegation.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
# -------------------------------------------------------------------
# HASH handles
# -------------------------------------------------------------------
# the canonical form of of the 'handles'
# option is the hash ref mapping a
# method name to the delegated method name
{
data/t/attributes/attribute_does.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
{
package Foo::Role;
use Moose::Role;
use Moose::Util::TypeConstraints;
# if does() exists on its own, then
# we create a type constraint for
# it, just as we do for isa()
data/t/attributes/attribute_inherited_slot_specs.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
{
package Thing::Meta::Attribute;
use Moose;
extends 'Moose::Meta::Attribute';
around illegal_options_for_inheritance => sub {
return (shift->(@_), qw/trigger/);
};
data/t/attributes/attribute_lazy_initializer.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
{
package Foo;
use Moose;
has 'foo' => (
reader => 'get_foo',
writer => 'set_foo',
initializer => sub {
data/t/attributes/attribute_names.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
my $exception_regex = qr/You must provide a name for the attribute/;
{
package My::Role;
use Moose::Role;
::like( ::exception {
has;
}, $exception_regex, 'has; fails' );
data/t/attributes/attribute_reader_generation.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
{
package Foo;
use Moose;
eval {
has 'foo' => (
reader => 'get_foo'
);
data/t/attributes/attribute_required.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
use Test::Moose;
{
package Foo;
use Moose;
has 'bar' => ( is => 'ro', required => 1 );
has 'baz' => ( is => 'rw', default => 100, required => 1 );
has 'boo' => ( is => 'rw', lazy => 1, default => 50, required => 1 );
}
data/t/attributes/attribute_triggers.t view on Meta::CPAN
use strict;
use warnings;
use Scalar::Util 'isweak';
use Test::More;
use Test::Fatal;
{
package Foo;
use Moose;
has 'bar' => (is => 'rw',
isa => 'Maybe[Bar]',
trigger => sub {
my ($self, $bar) = @_;
data/t/attributes/attribute_type_unions.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
{
package Foo;
use Moose;
has 'bar' => (is => 'rw', isa => 'ArrayRef | HashRef');
}
my $foo = Foo->new;
data/t/attributes/attribute_writer_generation.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
use Scalar::Util 'isweak';
{
package Foo;
use Moose;
eval {
has 'foo' => (
data/t/attributes/bad_coerce.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
{
package Foo;
use Moose;
::like(::exception {
has foo => (
is => 'ro',
isa => 'Str',
data/t/attributes/default_class_role_types.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
use Moose::Util::TypeConstraints;
{
package Foo;
use Moose;
has unknown_class => (
is => 'ro',
isa => 'UnknownClass',
data/t/attributes/delegation_target_not_loaded.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
{
package X;
use Moose;
::like(
::exception{ has foo => (
is => 'ro',
isa => 'Foo',
data/t/attributes/illegal_options_for_inheritance.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
{
package Foo;
use Moose;
has foo => (
is => 'ro',
);
has bar => (
data/t/attributes/lazy_no_default.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
{
package Foo;
use Moose;
::like(
::exception{ has foo => (
is => 'ro',
lazy => 1,
);
data/t/attributes/method_generation_rules.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
=pod
is => rw, writer => _foo # turns into (reader => foo, writer => _foo)
is => ro, writer => _foo # turns into (reader => foo, writer => _foo) as before
is => rw, accessor => _foo # turns into (accessor => _foo)
is => ro, accessor => _foo # error, accesor is rw
=cut
data/t/attributes/misc_attribute_coerce_lazy.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
{
package HTTPHeader;
use Moose;
has 'array' => (is => 'ro');
has 'hash' => (is => 'ro');
}
data/t/attributes/misc_attribute_tests.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
{
{
package Test::Attribute::Inline::Documentation;
use Moose;
has 'foo' => (
documentation => q{
The 'foo' attribute is my favorite
data/t/attributes/more_attr_delegation.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
=pod
This tests the more complex
delegation cases and that they
do not fail at compile time.
=cut
{
data/t/attributes/no_slot_access.t view on Meta::CPAN
}
}
{
package Toy;
use Moose;
use Moose::Util::MetaRole;
use Test::More;
use Test::Fatal;
Moose::Util::MetaRole::apply_metaroles(
for => __PACKAGE__,
class_metaroles => { instance => ['MooseX::SomeAwesomeDBFields'] },
);
is( exception {
has lazy_attr => (
is => 'ro',
isa => 'Bool',
data/t/attributes/type_constraint.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Test::Fatal;
{
package AttrHasTC;
use Moose;
has foo => (
is => 'ro',
isa => 'Int',
);
has bar => (
data/t/recipes/basics_bankaccount_methodmodifiersandsubclassing.t view on Meta::CPAN
#!/usr/bin/perl -w
use strict;
use Test::More 'no_plan';
use Test::Fatal;
$| = 1;
# =begin testing SETUP
{
package BankAccount;
use Moose;
data/t/recipes/basics_binarytree_attributefeatures.t view on Meta::CPAN
#!/usr/bin/perl -w
use strict;
use Test::More 'no_plan';
use Test::Fatal;
$| = 1;
# =begin testing SETUP
{
package BinaryTree;
use Moose;
data/t/recipes/basics_company_subtypes.t view on Meta::CPAN
#!/usr/bin/perl -w
use strict;
use Test::More 'no_plan';
use Test::Fatal;
$| = 1;
# =begin testing SETUP
# we have to do this silliness because Test::Inline already added a plan for us.
BEGIN {
if ("$]" <= '5.010') {
diag 'this test requires Regexp::Common (therefore perl 5.010)';
pass;
data/t/recipes/basics_datetime_extendingnonmooseparent.t view on Meta::CPAN
#!/usr/bin/perl -w
use strict;
use Test::More 'no_plan';
use Test::Fatal;
$| = 1;
# =begin testing SETUP
use Test::Requires {
'DateTime' => '0',
'DateTime::Calendar::Mayan' => '0',
'MooseX::NonMoose' => '0.25',
};
data/t/recipes/basics_document_augmentandinner.t view on Meta::CPAN
#!/usr/bin/perl -w
use strict;
use Test::More 'no_plan';
use Test::Fatal;
$| = 1;
# =begin testing SETUP
{
package Document::Page;
use Moose;