[Moose-commits] r7409 - in Moose/branches/moose-manual: . lib
lib/Moose lib/Moose/Cookbook/Extending lib/Moose/Error
lib/Moose/Meta lib/Moose/Meta/Method lib/Moose/Meta/Role
lib/Moose/Meta/Role/Application lib/Moose/Meta/Role/Method
lib/Moose/Meta/TypeCoercion lib/Moose/Meta/TypeConstraint
lib/Moose/Util lib/Moose/Util/TypeConstraints lib/Test
t/030_roles t/040_type_constraints t/100_bugs t/600_todo_tests
autarch at code2.0beta.co.uk
autarch at code2.0beta.co.uk
Wed Jan 28 19:07:07 GMT 2009
Author: autarch
Date: 2009-01-28 11:07:05 -0800 (Wed, 28 Jan 2009)
New Revision: 7409
Added:
Moose/branches/moose-manual/t/040_type_constraints/030_class_subtypes.t
Moose/branches/moose-manual/t/040_type_constraints/031_subtype_auto_vivify_parent.t
Moose/branches/moose-manual/t/100_bugs/020_super_recursion.t
Removed:
Moose/branches/moose-manual/MANIFEST
Moose/branches/moose-manual/t/040_type_constraints/030-class_subtypes.t
Modified:
Moose/branches/moose-manual/
Moose/branches/moose-manual/Changes
Moose/branches/moose-manual/Makefile.PL
Moose/branches/moose-manual/README
Moose/branches/moose-manual/lib/Moose.pm
Moose/branches/moose-manual/lib/Moose/Cookbook/Extending/Recipe2.pod
Moose/branches/moose-manual/lib/Moose/Error/Confess.pm
Moose/branches/moose-manual/lib/Moose/Error/Croak.pm
Moose/branches/moose-manual/lib/Moose/Error/Default.pm
Moose/branches/moose-manual/lib/Moose/Exporter.pm
Moose/branches/moose-manual/lib/Moose/Meta/Attribute.pm
Moose/branches/moose-manual/lib/Moose/Meta/Class.pm
Moose/branches/moose-manual/lib/Moose/Meta/Instance.pm
Moose/branches/moose-manual/lib/Moose/Meta/Method.pm
Moose/branches/moose-manual/lib/Moose/Meta/Method/Accessor.pm
Moose/branches/moose-manual/lib/Moose/Meta/Method/Augmented.pm
Moose/branches/moose-manual/lib/Moose/Meta/Method/Constructor.pm
Moose/branches/moose-manual/lib/Moose/Meta/Method/Delegation.pm
Moose/branches/moose-manual/lib/Moose/Meta/Method/Destructor.pm
Moose/branches/moose-manual/lib/Moose/Meta/Method/Overriden.pm
Moose/branches/moose-manual/lib/Moose/Meta/Role.pm
Moose/branches/moose-manual/lib/Moose/Meta/Role/Application.pm
Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/RoleSummation.pm
Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/ToClass.pm
Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/ToInstance.pm
Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/ToRole.pm
Moose/branches/moose-manual/lib/Moose/Meta/Role/Composite.pm
Moose/branches/moose-manual/lib/Moose/Meta/Role/Method.pm
Moose/branches/moose-manual/lib/Moose/Meta/Role/Method/Required.pm
Moose/branches/moose-manual/lib/Moose/Meta/TypeCoercion.pm
Moose/branches/moose-manual/lib/Moose/Meta/TypeCoercion/Union.pm
Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint.pm
Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Class.pm
Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Enum.pm
Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Parameterizable.pm
Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Parameterized.pm
Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Registry.pm
Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Role.pm
Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Union.pm
Moose/branches/moose-manual/lib/Moose/Object.pm
Moose/branches/moose-manual/lib/Moose/Role.pm
Moose/branches/moose-manual/lib/Moose/Util.pm
Moose/branches/moose-manual/lib/Moose/Util/MetaRole.pm
Moose/branches/moose-manual/lib/Moose/Util/TypeConstraints.pm
Moose/branches/moose-manual/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm
Moose/branches/moose-manual/lib/Test/Moose.pm
Moose/branches/moose-manual/lib/oose.pm
Moose/branches/moose-manual/t/030_roles/003_apply_role.t
Moose/branches/moose-manual/t/030_roles/004_role_composition_errors.t
Moose/branches/moose-manual/t/030_roles/007_roles_and_req_method_edge_cases.t
Moose/branches/moose-manual/t/030_roles/011_overriding.t
Moose/branches/moose-manual/t/040_type_constraints/011_container_type_constraint.t
Moose/branches/moose-manual/t/040_type_constraints/021_maybe_type_constraint.t
Moose/branches/moose-manual/t/100_bugs/011_DEMOLISH_eats_exceptions.t
Moose/branches/moose-manual/t/600_todo_tests/002_various_role_shit.t
Log:
merge from trunk to moose-manual branch
Property changes on: Moose/branches/moose-manual
___________________________________________________________________
Name: svn:ignore
- META.yml
MANIFEST.bak
inc
Makefile
Build
cover_db
_build
pm_to_blib
Makefile.old
blib
+ META.yml
MANIFEST
MANIFEST.bak
inc
Makefile
Build
cover_db
_build
pm_to_blib
Makefile.old
blib
Name: svk:merge
- 08e7d58d-de06-4458-8c15-335e402ab116:/local/Moose:77743
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/BUILDARGS:4770
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/Moose-dumb_roles:1727
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/Moose-moosex_compile_support:3337
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/Moose-real_class_meta_type_constraint:3322
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/deprototype:6072
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/inline_wrapped_constructor:3777
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/meta-role-helper:5585
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/method-changes:5953
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/moose-exporter:5196
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/parameterize_constructor_role:5927
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/parameterized_type_fixes:6365
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/predicate_fix:2940
3efe9002-19ed-0310-8735-a98156148065:/Moose/trunk:7243
48425d73-d564-4cf1-a4fc-b7d19ba782dc:/local/Moose:54077
f7901bf9-e7b5-442b-97a4-4d7fd5798e10:/local/moose/Moose:41354
+ 08e7d58d-de06-4458-8c15-335e402ab116:/local/Moose:77743
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/BUILDARGS:4770
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/Moose-dumb_roles:1727
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/Moose-moosex_compile_support:3337
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/Moose-real_class_meta_type_constraint:3322
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/deprototype:6072
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/inline_wrapped_constructor:3777
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/meta-role-helper:5585
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/method-changes:5953
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/moose-exporter:5196
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/parameterize_constructor_role:5927
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/parameterized_type_fixes:6365
3efe9002-19ed-0310-8735-a98156148065:/Moose/branches/predicate_fix:2940
3efe9002-19ed-0310-8735-a98156148065:/Moose/trunk:7408
48425d73-d564-4cf1-a4fc-b7d19ba782dc:/local/Moose:54077
f7901bf9-e7b5-442b-97a4-4d7fd5798e10:/local/moose/Moose:41354
Modified: Moose/branches/moose-manual/Changes
===================================================================
--- Moose/branches/moose-manual/Changes 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/Changes 2009-01-28 19:07:05 UTC (rev 7409)
@@ -1,18 +1,59 @@
Revision history for Perl extension Moose
-Pending
+0.66
+ * Moose::Meta::Attribute
+ - Added a delegation_metaclass method to replace a hard-coded
+ use of Moose::Meta::Method::Delegation. (Dave Rolsky)
+
+ * Moose::Util::TypeConstraints
+ - If you created a subtype and passed a parent that Moose didn't
+ know about, it simply ignored the parent. Now it automatically
+ creates the parent as a class type. This may not be what you
+ want, but is less broken than before. (Dave Rolsky)
+
+0.65 Thu, January 22, 2008
+ * Moose and Moose::Meta::Method::Overridden
+ - If an overridden method called super(), and then the
+ superclass's method (not overridden) _also_ called super(),
+ Moose went into an endless recursion loop. Test provided by
+ Chris Prather. (Dave Rolsky)
+
* Moose::Meta::TypeConstraint
- - Add some explanation for a few explanationless methods (gphat)
+ - All methods are now documented. (gphat)
+ * t/100_bugs/011_DEMOLISH_eats_exceptions.t
+ - Fixed some bogus failures that occurred because we tried to
+ validate filesystem paths in a very ad-hoc and
+ not-quite-correct way. (Dave Rolsky)
+
+ * Moose::Util::TypeConstraints
+ - Added maybe_type to exports. See docs for details. (rjbs)
+
+ * Moose
+ - Added Moose::Util::TypeConstraints to the SEE ALSO
+ section. (pjf)
+
+ * Moose::Role
+ - Methods created via an attribute can now fulfill a "requires"
+ declaration for a role. (nothingmuch)
+
+ * Moose::Meta::Method::*
+ - Stack traces from inlined code will now report its line and
+ file as being in your class, as opposed to in Moose
+ guts. (nothingmuch).
+
0.64 Wed, December 31, 2008
* Moose::Meta::Method::Accessor
- Always inline predicate and clearer methods (Sartak)
+
* Moose::Meta::Attribute
- Support for parameterized traits (Sartak)
- verify_against_type_constraint method to avoid duplication
and enhance extensibility (Sartak)
+
* Moose::Meta::Class
- Tests (but no support yet) for parameterized traits (Sartak)
+
* Moose
- Require Class::MOP 0.75+, which has the side effect of making
sure we work on Win32. (Dave Rolsky)
Deleted: Moose/branches/moose-manual/MANIFEST
===================================================================
--- Moose/branches/moose-manual/MANIFEST 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/MANIFEST 2009-01-28 19:07:05 UTC (rev 7409)
@@ -1,287 +0,0 @@
-Changes
-doap.rdf
-inc/Module/Install.pm
-inc/Module/Install/Base.pm
-inc/Module/Install/Can.pm
-inc/Module/Install/Fetch.pm
-inc/Module/Install/Makefile.pm
-inc/Module/Install/Metadata.pm
-inc/Module/Install/Win32.pm
-inc/Module/Install/WriteAll.pm
-lib/Moose.pm
-lib/Moose/Cookbook.pod
-lib/Moose/Cookbook/Basics/Recipe1.pod
-lib/Moose/Cookbook/Basics/Recipe10.pod
-lib/Moose/Cookbook/Basics/Recipe2.pod
-lib/Moose/Cookbook/Basics/Recipe3.pod
-lib/Moose/Cookbook/Basics/Recipe4.pod
-lib/Moose/Cookbook/Basics/Recipe5.pod
-lib/Moose/Cookbook/Basics/Recipe6.pod
-lib/Moose/Cookbook/Basics/Recipe7.pod
-lib/Moose/Cookbook/Basics/Recipe9.pod
-lib/Moose/Cookbook/Extending/Recipe1.pod
-lib/Moose/Cookbook/Extending/Recipe2.pod
-lib/Moose/Cookbook/Extending/Recipe3.pod
-lib/Moose/Cookbook/Extending/Recipe4.pod
-lib/Moose/Cookbook/FAQ.pod
-lib/Moose/Cookbook/Meta/Recipe1.pod
-lib/Moose/Cookbook/Meta/Recipe2.pod
-lib/Moose/Cookbook/Meta/Recipe3.pod
-lib/Moose/Cookbook/Meta/Recipe4.pod
-lib/Moose/Cookbook/Meta/Recipe5.pod
-lib/Moose/Cookbook/Roles/Recipe1.pod
-lib/Moose/Cookbook/Roles/Recipe2.pod
-lib/Moose/Cookbook/Snack/Keywords.pod
-lib/Moose/Cookbook/Snack/Types.pod
-lib/Moose/Cookbook/Style.pod
-lib/Moose/Cookbook/WTF.pod
-lib/Moose/Error/Confess.pm
-lib/Moose/Error/Croak.pm
-lib/Moose/Error/Default.pm
-lib/Moose/Exporter.pm
-lib/Moose/Intro.pod
-lib/Moose/Meta/Attribute.pm
-lib/Moose/Meta/Class.pm
-lib/Moose/Meta/Instance.pm
-lib/Moose/Meta/Method.pm
-lib/Moose/Meta/Method/Accessor.pm
-lib/Moose/Meta/Method/Augmented.pm
-lib/Moose/Meta/Method/Constructor.pm
-lib/Moose/Meta/Method/Delegation.pm
-lib/Moose/Meta/Method/Destructor.pm
-lib/Moose/Meta/Method/Overriden.pm
-lib/Moose/Meta/Role.pm
-lib/Moose/Meta/Role/Application.pm
-lib/Moose/Meta/Role/Application/RoleSummation.pm
-lib/Moose/Meta/Role/Application/ToClass.pm
-lib/Moose/Meta/Role/Application/ToInstance.pm
-lib/Moose/Meta/Role/Application/ToRole.pm
-lib/Moose/Meta/Role/Composite.pm
-lib/Moose/Meta/Role/Method.pm
-lib/Moose/Meta/Role/Method/Required.pm
-lib/Moose/Meta/TypeCoercion.pm
-lib/Moose/Meta/TypeCoercion/Union.pm
-lib/Moose/Meta/TypeConstraint.pm
-lib/Moose/Meta/TypeConstraint/Class.pm
-lib/Moose/Meta/TypeConstraint/Enum.pm
-lib/Moose/Meta/TypeConstraint/Parameterizable.pm
-lib/Moose/Meta/TypeConstraint/Parameterized.pm
-lib/Moose/Meta/TypeConstraint/Registry.pm
-lib/Moose/Meta/TypeConstraint/Role.pm
-lib/Moose/Meta/TypeConstraint/Union.pm
-lib/Moose/Object.pm
-lib/Moose/Role.pm
-lib/Moose/Spec/Role.pod
-lib/Moose/Unsweetened.pod
-lib/Moose/Util.pm
-lib/Moose/Util/MetaRole.pm
-lib/Moose/Util/TypeConstraints.pm
-lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm
-lib/oose.pm
-lib/Test/Moose.pm
-Makefile.PL
-MANIFEST This list of files
-MANIFEST.SKIP
-META.yml
-README
-t/000_load.t
-t/000_recipes/basics/001_point.t
-t/000_recipes/basics/002_bank_account.t
-t/000_recipes/basics/003_binary_tree.t
-t/000_recipes/basics/004_company.t
-t/000_recipes/basics/005_coercion.t
-t/000_recipes/basics/006_augment_inner.t
-t/000_recipes/basics/010_genes.t
-t/000_recipes/extending/001_base_class.t
-t/000_recipes/extending/002_metaclass_and_sugar.t
-t/000_recipes/meta/002_meta_attribute.t
-t/000_recipes/meta/003_attribute_trait.t
-t/000_recipes/roles/001_roles.t
-t/000_recipes/roles/002_advanced_role_composition.t
-t/010_basics/001_basic_class_setup.t
-t/010_basics/002_require_superclasses.t
-t/010_basics/003_super_and_override.t
-t/010_basics/004_inner_and_augment.t
-t/010_basics/005_override_augment_inner_super.t
-t/010_basics/006_override_and_foreign_classes.t
-t/010_basics/007_always_strict_warnings.t
-t/010_basics/008_wrapped_method_cxt_propagation.t
-t/010_basics/009_import_unimport.t
-t/010_basics/010_method_modifier_with_regexp.t
-t/010_basics/011_moose_respects_type_constraints.t
-t/010_basics/012_rebless.t
-t/010_basics/013_create.t
-t/010_basics/014_create_anon.t
-t/010_basics/015_buildargs.t
-t/010_basics/016_load_into_main.t
-t/010_basics/017_error_handling.t
-t/010_basics/018_methods.t
-t/020_attributes/001_attribute_reader_generation.t
-t/020_attributes/002_attribute_writer_generation.t
-t/020_attributes/003_attribute_accessor_generation.t
-t/020_attributes/004_attribute_triggers.t
-t/020_attributes/005_attribute_does.t
-t/020_attributes/006_attribute_required.t
-t/020_attributes/007_attribute_custom_metaclass.t
-t/020_attributes/008_attribute_type_unions.t
-t/020_attributes/009_attribute_inherited_slot_specs.t
-t/020_attributes/010_attribute_delegation.t
-t/020_attributes/011_more_attr_delegation.t
-t/020_attributes/012_misc_attribute_tests.t
-t/020_attributes/013_attr_dereference_test.t
-t/020_attributes/014_misc_attribute_coerce_lazy.t
-t/020_attributes/015_attribute_traits.t
-t/020_attributes/016_attribute_traits_registered.t
-t/020_attributes/017_attribute_traits_n_meta.t
-t/020_attributes/018_no_init_arg.t
-t/020_attributes/019_attribute_lazy_initializer.t
-t/020_attributes/020_trigger_and_coerce.t
-t/020_attributes/021_method_generation_rules.t
-t/020_attributes/022_legal_options_for_inheritance.t
-t/020_attributes/023_attribute_names.t
-t/020_attributes/024_attribute_traits_parameterized.t
-t/030_roles/001_meta_role.t
-t/030_roles/002_role.t
-t/030_roles/003_apply_role.t
-t/030_roles/004_role_composition_errors.t
-t/030_roles/005_role_conflict_detection.t
-t/030_roles/006_role_exclusion.t
-t/030_roles/007_roles_and_req_method_edge_cases.t
-t/030_roles/008_role_conflict_edge_cases.t
-t/030_roles/009_more_role_edge_cases.t
-t/030_roles/010_run_time_role_composition.t
-t/030_roles/011_overriding.t
-t/030_roles/012_method_exclusion_in_composition.t
-t/030_roles/013_method_aliasing_in_composition.t
-t/030_roles/014_more_alias_and_exclude.t
-t/030_roles/015_runtime_roles_and_attrs.t
-t/030_roles/016_runtime_roles_and_nonmoose.t
-t/030_roles/017_extending_role_attrs.t
-t/030_roles/018_runtime_roles_w_params.t
-t/030_roles/019_build.t
-t/030_roles/020_role_composite.t
-t/030_roles/021_role_composite_exclusion.t
-t/030_roles/022_role_composition_req_methods.t
-t/030_roles/023_role_composition_attributes.t
-t/030_roles/024_role_composition_methods.t
-t/030_roles/025_role_composition_override.t
-t/030_roles/026_role_composition_method_mods.t
-t/030_roles/031_roles_applied_in_create.t
-t/030_roles/032_roles_and_method_cloning.t
-t/030_roles/033_role_exclusion_and_alias_bug.t
-t/030_roles/034_create_role.t
-t/030_roles/035_anonymous_roles.t
-t/030_roles/036_free_anonymous_roles.t
-t/030_roles/037_create_role_subclass.t
-t/040_type_constraints/001_util_type_constraints.t
-t/040_type_constraints/002_util_type_constraints_export.t
-t/040_type_constraints/003_util_std_type_constraints.t
-t/040_type_constraints/004_util_find_type_constraint.t
-t/040_type_constraints/005_util_type_coercion.t
-t/040_type_constraints/006_util_type_reloading.t
-t/040_type_constraints/007_util_more_type_coercion.t
-t/040_type_constraints/008_union_types.t
-t/040_type_constraints/009_union_types_and_coercions.t
-t/040_type_constraints/010_misc_type_tests.t
-t/040_type_constraints/011_container_type_constraint.t
-t/040_type_constraints/012_container_type_coercion.t
-t/040_type_constraints/013_advanced_type_creation.t
-t/040_type_constraints/014_type_notation_parser.t
-t/040_type_constraints/015_enum.t
-t/040_type_constraints/016_subtyping_parameterized_types.t
-t/040_type_constraints/017_subtyping_union_types.t
-t/040_type_constraints/018_custom_parameterized_types.t
-t/040_type_constraints/019_coerced_parameterized_types.t
-t/040_type_constraints/020_class_type_constraint.t
-t/040_type_constraints/021_maybe_type_constraint.t
-t/040_type_constraints/022_custom_type_errors.t
-t/040_type_constraints/023_types_and_undef.t
-t/040_type_constraints/024_role_type_constraint.t
-t/040_type_constraints/025_type_coersion_on_lazy_attributes.t
-t/040_type_constraints/026_normalize_type_name.t
-t/040_type_constraints/027_parameterize_from.t
-t/040_type_constraints/029_define_type_twice_throws.t
-t/040_type_constraints/030-class_subtypes.t
-t/050_metaclasses/001_custom_attr_meta_with_roles.t
-t/050_metaclasses/002_custom_attr_meta_as_role.t
-t/050_metaclasses/003_moose_w_metaclass.t
-t/050_metaclasses/004_moose_for_meta.t
-t/050_metaclasses/010_extending_and_embedding_back_compat.t
-t/050_metaclasses/011_init_meta.t
-t/050_metaclasses/012_moose_exporter.t
-t/050_metaclasses/013_metaclass_traits.t
-t/050_metaclasses/014_goto_moose_import.t
-t/050_metaclasses/015_metarole.t
-t/050_metaclasses/016_metarole_w_metaclass_pm.t
-t/050_metaclasses/017_use_base_of_moose.t
-t/050_metaclasses/018_throw_error.t
-t/050_metaclasses/019_create_anon_with_required_attr.t
-t/050_metaclasses/020_metaclass_parameterized_traits.t
-t/060_compat/001_module_refresh_compat.t
-t/060_compat/002_moose_respects_base.t
-t/060_compat/003_foreign_inheritence.t
-t/100_bugs/001_subtype_quote_bug.t
-t/100_bugs/002_subtype_conflict_bug.t
-t/100_bugs/003_Moose_Object_error.t
-t/100_bugs/004_subclass_use_base_bug.t
-t/100_bugs/005_inline_reader_bug.t
-t/100_bugs/006_handles_foreign_class_bug.t
-t/100_bugs/007_reader_precedence_bug.t
-t/100_bugs/008_new_w_undef.t
-t/100_bugs/009_augment_recursion_bug.t
-t/100_bugs/010_immutable_n_default_x2.t
-t/100_bugs/011_DEMOLISH_eats_exceptions.t
-t/100_bugs/012_DEMOLISH_eats_mini.t
-t/100_bugs/013_lazybuild_required_undef.t
-t/100_bugs/014_DEMOLISHALL.t
-t/100_bugs/016_inheriting_from_roles.t
-t/100_bugs/017_type_constraint_messages.t
-t/100_bugs/018_immutable_metaclass_does_role.t
-t/100_bugs/019_moose_octal_defaults.t
-t/200_examples/001_example.t
-t/200_examples/002_example_Moose_POOP.t
-t/200_examples/003_example.t
-t/200_examples/004_example_w_DCS.t
-t/200_examples/005_example_w_TestDeep.t
-t/200_examples/006_example_Protomoose.t
-t/200_examples/007_Child_Parent_attr_inherit.t
-t/200_examples/008_record_set_iterator.t
-t/300_immutable/001_immutable_moose.t
-t/300_immutable/002_apply_roles_to_immutable.t
-t/300_immutable/003_immutable_meta_class.t
-t/300_immutable/004_inlined_constructors_n_types.t
-t/300_immutable/005_multiple_demolish_inline.t
-t/300_immutable/007_immutable_trigger_from_constructor.t
-t/300_immutable/008_immutable_constructor_error.t
-t/300_immutable/009_buildargs.t
-t/300_immutable/010_constructor_is_not_moose.t
-t/300_immutable/011_constructor_is_wrapped.t
-t/300_immutable/012_default_values.t
-t/300_immutable/013_immutable_roundtrip.t
-t/400_moose_util/001_moose_util.t
-t/400_moose_util/002_moose_util_does_role.t
-t/400_moose_util/003_moose_util_search_class_by_role.t
-t/400_moose_util/004_resolve_alias.t
-t/500_test_moose/001_test_moose.t
-t/500_test_moose/002_test_moose_does_ok.t
-t/500_test_moose/003_test_moose_has_attribute_ok.t
-t/500_test_moose/004_test_moose_meta_ok.t
-t/600_todo_tests/001_exception_reflects_failed_constraint.t
-t/600_todo_tests/002_various_role_shit.t
-t/600_todo_tests/003_immutable_n_around.t
-t/600_todo_tests/005_moose_and_threads.t
-t/lib/Bar.pm
-t/lib/Foo.pm
-t/lib/Moose/Meta/Attribute/Custom/Bar.pm
-t/lib/Moose/Meta/Attribute/Custom/Foo.pm
-t/lib/Moose/Meta/Attribute/Custom/Trait/Bar.pm
-t/lib/Moose/Meta/Attribute/Custom/Trait/Foo.pm
-t/lib/MyMetaclassRole.pm
-t/lib/MyMooseA.pm
-t/lib/MyMooseB.pm
-t/lib/MyMooseObject.pm
-t/lib/Role/Child.pm
-t/lib/Role/Interface.pm
-t/lib/Role/Parent.pm
-t/pod.t
-t/pod_coverage.t
Modified: Moose/branches/moose-manual/Makefile.PL
===================================================================
--- Moose/branches/moose-manual/Makefile.PL 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/Makefile.PL 2009-01-28 19:07:05 UTC (rev 7409)
@@ -13,7 +13,7 @@
# prereqs
requires 'Scalar::Util' => '1.19';
requires 'Carp';
-requires 'Class::MOP' => '0.75';
+requires 'Class::MOP' => '0.76';
requires 'List::MoreUtils' => '0.12';
requires 'Sub::Exporter' => '0.972';
requires 'Task::Weaken' => '0';
Modified: Moose/branches/moose-manual/README
===================================================================
--- Moose/branches/moose-manual/README 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/README 2009-01-28 19:07:05 UTC (rev 7409)
@@ -1,4 +1,4 @@
-Moose version 0.64
+Moose version 0.65
===========================
See the individual module documentation for more information
Modified: Moose/branches/moose-manual/lib/Moose/Cookbook/Extending/Recipe2.pod
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Cookbook/Extending/Recipe2.pod 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Cookbook/Extending/Recipe2.pod 2009-01-28 19:07:05 UTC (rev 7409)
@@ -12,6 +12,7 @@
use strict;
use warnings;
+ use Moose ();
use Moose::Exporter;
use Moose::Util::MetaRole;
use MooseX::Debugging::Role::Object;
@@ -22,9 +23,11 @@
shift;
my %options = @_;
- Moose::Util::MetaRole::apply_base_object_roles(
+ Moose->init_meta(%options);
+
+ Moose::Util::MetaRole::apply_base_class_roles(
for_class => $options{for_class},
- role => ['MooseX::Debugging::Role::Object'],
+ roles => ['MooseX::Debugging::Role::Object'],
);
}
Modified: Moose/branches/moose-manual/lib/Moose/Error/Confess.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Error/Confess.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Error/Confess.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Error/Croak.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Error/Croak.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Error/Croak.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Error/Default.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Error/Default.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Error/Default.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Exporter.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Exporter.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Exporter.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Attribute.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Attribute.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Attribute.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -7,7 +7,7 @@
use Scalar::Util 'blessed', 'weaken';
use overload ();
-our $VERSION = '0.64';
+our $VERSION = '0.65';
our $AUTHORITY = 'cpan:STEVAN';
use Moose::Meta::Method::Accessor;
@@ -145,6 +145,7 @@
default coerce required
documentation lazy handles
builder type_constraint
+ definition_context
);
sub legal_options_for_inheritance { @legal_options_for_inheritance }
@@ -704,6 +705,8 @@
}
}
+sub delegation_metaclass { 'Moose::Meta::Method::Delegation' }
+
sub _make_delegation_method {
my ( $self, $handle_name, $method_to_call ) = @_;
@@ -712,7 +715,7 @@
$method_body = $method_to_call
if 'CODE' eq ref($method_to_call);
- return Moose::Meta::Method::Delegation->new(
+ return $self->delegation_metaclass->new(
name => $handle_name,
package_name => $self->associated_class->name,
attribute => $self,
@@ -786,6 +789,8 @@
=item B<accessor_metaclass>
+=item B<delegation_metaclass>
+
=item B<get_value>
=item B<set_value>
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Class.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Class.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Class.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -11,7 +11,7 @@
use List::MoreUtils qw( any all uniq );
use Scalar::Util 'weaken', 'blessed';
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Instance.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Instance.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Instance.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -4,7 +4,7 @@
use strict;
use warnings;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Method/Accessor.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Method/Accessor.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Method/Accessor.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -4,7 +4,7 @@
use strict;
use warnings;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
@@ -21,21 +21,22 @@
# NOTE:
# set up the environment
- my $attr = $self->associated_attribute;
- my $attr_name = $attr->name;
- my $meta = $self,
-
- my $type_constraint_obj = $attr->type_constraint;
- my $type_constraint_name = $type_constraint_obj && $type_constraint_obj->name;
- my $type_constraint = $type_constraint_obj
+ my $attr = $self->associated_attribute;
+ my $type_constraint_obj = $attr->type_constraint;
+ my $environment = {
+ '$attr' => \$attr,
+ '$attr_name' => \$attr->name,
+ '$meta' => \$self,
+ '$type_constraint_obj' => \$type_constraint_obj,
+ '$type_constraint_name' => \($type_constraint_obj && $type_constraint_obj->name),
+ '$type_constraint' => \($type_constraint_obj
? $type_constraint_obj->_compiled_type_constraint
- : undef;
+ : undef),
+ };
#warn "code for $attr_name =>\n" . $code . "\n";
- my $sub = eval $code;
- $self->throw_error("Could not create writer for '$attr_name' because $@ \n code: $code", error => $@, data => $code ) if $@;
- return $sub;
-
+ $self->_compile_code( environment => $environment, code => $code )
+ or $self->throw_error("Could not create writer for '${\$self->associated_attribute->name}' because $@ \n code: $code", error => $@, data => $code );
}
sub generate_accessor_method_inline {
@@ -228,7 +229,7 @@
my ($self, $instance, $value) = @_;
my $attr = $self->associated_attribute;
return '' unless $attr->has_trigger;
- return sprintf('$attr->trigger->(%s, %s, $attr);', $instance, $value);
+ return sprintf('$attr->trigger->(%s, %s);', $instance, $value);
}
sub _inline_get {
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Method/Augmented.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Method/Augmented.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Method/Augmented.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Method/Constructor.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Method/Constructor.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Method/Constructor.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -6,7 +6,7 @@
use Scalar::Util 'blessed', 'weaken', 'looks_like_number';
-our $VERSION = '0.64';
+our $VERSION = '0.65';
our $AUTHORITY = 'cpan:STEVAN';
use base 'Moose::Meta::Method',
@@ -142,42 +142,42 @@
$self->_generate_slot_initializer($_)
} 0 .. (@{$self->attributes} - 1));
- $source .= ";\n" . $self->_generate_triggers();
+ $source .= ";\n" . $self->_generate_triggers();
$source .= ";\n" . $self->_generate_BUILDALL();
$source .= ";\n" . 'return $instance';
$source .= ";\n" . '}';
warn $source if $self->options->{debug};
- my $code;
- {
- my $meta = $self; # FIXME for _inline_throw_error...
+ # We need to check if the attribute ->can('type_constraint')
+ # since we may be trying to immutabilize a Moose meta class,
+ # which in turn has attributes which are Class::MOP::Attribute
+ # objects, rather than Moose::Meta::Attribute. And
+ # Class::MOP::Attribute attributes have no type constraints.
+ # However we need to make sure we leave an undef value there
+ # because the inlined code is using the index of the attributes
+ # to determine where to find the type constraint
- # NOTE:
- # create the nessecary lexicals
- # to be picked up in the eval
- my $attrs = $self->attributes;
+ my $attrs = $self->attributes;
- # We need to check if the attribute ->can('type_constraint')
- # since we may be trying to immutabilize a Moose meta class,
- # which in turn has attributes which are Class::MOP::Attribute
- # objects, rather than Moose::Meta::Attribute. And
- # Class::MOP::Attribute attributes have no type constraints.
- # However we need to make sure we leave an undef value there
- # because the inlined code is using the index of the attributes
- # to determine where to find the type constraint
-
- my @type_constraints = map {
- $_->can('type_constraint') ? $_->type_constraint : undef
- } @$attrs;
-
- my @type_constraint_bodies = map {
- defined $_ ? $_->_compiled_type_constraint : undef;
- } @type_constraints;
+ my @type_constraints = map {
+ $_->can('type_constraint') ? $_->type_constraint : undef
+ } @$attrs;
- $code = eval $source;
- $self->throw_error("Could not eval the constructor :\n\n$source\n\nbecause :\n\n$@", error => $@, data => $source ) if $@;
- }
+ my @type_constraint_bodies = map {
+ defined $_ ? $_->_compiled_type_constraint : undef;
+ } @type_constraints;
+
+ my $code = $self->_compile_code(
+ code => $source,
+ environment => {
+ '$meta' => \$self,
+ '$attrs' => \$attrs,
+ '@type_constraints' => \@type_constraints,
+ '@type_constraint_bodies' => \@type_constraint_bodies,
+ },
+ ) or $self->throw_error("Could not eval the constructor :\n\n$source\n\nbecause :\n\n$@", error => $@, data => $source );
+
$self->{'body'} = $code;
}
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Method/Delegation.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Method/Delegation.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Method/Delegation.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -7,7 +7,7 @@
use Carp 'confess';
use Scalar::Util 'blessed', 'weaken';
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Method/Destructor.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Method/Destructor.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Method/Destructor.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -6,7 +6,7 @@
use Scalar::Util 'blessed', 'weaken';
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
@@ -88,11 +88,11 @@
$source .= ";\n" . '}';
warn $source if $self->options->{debug};
- my $code;
- {
- $code = eval $source;
- $self->throw_error("Could not eval the destructor :\n\n$source\n\nbecause :\n\n$@", error => $@, data => $source) if $@;
- }
+ my $code = $self->_compile_code(
+ environment => {},
+ code => $source,
+ ) or $self->throw_error("Could not eval the destructor :\n\n$source\n\nbecause :\n\n$@", error => $@, data => $source);
+
$self->{'body'} = $code;
}
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Method/Overriden.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Method/Overriden.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Method/Overriden.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
@@ -16,7 +16,7 @@
# it is really more like body's compilation stash
# this is where we need to override the definition of super() so that the
# body of the code can call the right overridden version
- my $_super_package = $args{package} || $args{class}->name;
+ my $super_package = $args{package} || $args{class}->name;
my $name = $args{name};
@@ -30,13 +30,14 @@
my $method = $args{method};
my $body = sub {
+ local $Moose::SUPER_PACKAGE = $super_package;
local @Moose::SUPER_ARGS = @_;
local $Moose::SUPER_BODY = $super_body;
return $method->(@_);
};
# FIXME do we need this make sure this works for next::method?
- # subname "${_super_package}::${name}", $method;
+ # subname "${super_package}::${name}", $method;
# FIXME store additional attrs
$class->wrap(
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Method.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Method.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Method.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/RoleSummation.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/RoleSummation.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/RoleSummation.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -8,7 +8,7 @@
use Moose::Meta::Role::Composite;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/ToClass.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/ToClass.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/ToClass.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -7,7 +7,7 @@
use Moose::Util 'english_list';
use Scalar::Util 'blessed';
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
@@ -51,32 +51,9 @@
push @missing, $required_method_name;
}
- else {
- # NOTE:
- # we need to make sure that the method is
- # not a method modifier, because those do
- # not satisfy the requirements ...
- my $method = $class->find_method_by_name($required_method_name);
-
- # check if it is a generated accessor ...
- push @is_attr, $required_method_name,
- if $method->isa('Class::MOP::Method::Accessor');
-
- # NOTE:
- # All other tests here have been removed, they were tests
- # for overriden methods and before/after/around modifiers.
- # But we realized that for classes any overriden or modified
- # methods would be backed by a real method of that name
- # (and therefore meet the requirement). And for roles, the
- # overriden and modified methods are "in statis" and so would
- # not show up in this test anyway (and as a side-effect they
- # would not fufill the requirement, which is exactly what we
- # want them to do anyway).
- # - SL
- }
}
- return unless @missing || @is_attr;
+ return unless @missing;
my $error = '';
@@ -94,23 +71,6 @@
. $class->name . q{'};
}
- if (@is_attr) {
- my $noun = @is_attr == 1 ? 'method' : 'methods';
-
- my $list
- = Moose::Util::english_list( map { q{'} . $_ . q{'} } @is_attr );
-
- $error .= "\n" if length $error;
-
- $error
- .= q{'}
- . $role->name
- . "' requires the $noun $list "
- . "to be implemented by '"
- . $class->name
- . "' but the method is only an attribute accessor";
- }
-
$class->throw_error($error);
}
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/ToInstance.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/ToInstance.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/ToInstance.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -6,7 +6,7 @@
use Scalar::Util 'blessed';
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/ToRole.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/ToRole.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Role/Application/ToRole.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -6,7 +6,7 @@
use Scalar::Util 'blessed';
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Role/Application.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Role/Application.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Role/Application.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -4,7 +4,7 @@
use warnings;
use metaclass;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Role/Composite.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Role/Composite.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Role/Composite.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -6,7 +6,7 @@
use Scalar::Util 'blessed';
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Role/Method/Required.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Role/Method/Required.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Role/Method/Required.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -4,7 +4,7 @@
use strict;
use warnings;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Role/Method.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Role/Method.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Role/Method.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -4,7 +4,7 @@
use strict;
use warnings;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/Role.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/Role.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/Role.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -8,7 +8,7 @@
use Scalar::Util 'blessed';
use Carp 'confess';
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/TypeCoercion/Union.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/TypeCoercion/Union.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/TypeCoercion/Union.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -7,7 +7,7 @@
use Scalar::Util 'blessed';
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/TypeCoercion.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/TypeCoercion.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/TypeCoercion.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -8,7 +8,7 @@
use Moose::Meta::Attribute;
use Moose::Util::TypeConstraints ();
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Class.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Class.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Class.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -7,7 +7,7 @@
use Scalar::Util 'blessed';
use Moose::Util::TypeConstraints ();
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Enum.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Enum.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Enum.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -6,7 +6,7 @@
use Moose::Util::TypeConstraints ();
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Parameterizable.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Parameterizable.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Parameterizable.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -4,7 +4,7 @@
use warnings;
use metaclass;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
@@ -99,8 +99,8 @@
=item B<parameterize>
-Given a single type constraint string, this method parses the string
-and parameterizes the type based on the parsed string.
+Given a single type constraint or type constraint string, this method
+parameterizes the type based on the given argument.
=item B<meta>
Modified: Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Parameterized.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Parameterized.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Parameterized.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -8,7 +8,7 @@
use Moose::Util::TypeConstraints;
use Moose::Meta::TypeConstraint::Parameterizable;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Registry.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Registry.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Registry.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -8,7 +8,7 @@
use Scalar::Util 'blessed';
use Carp 'confess'; # FIXME Moose->throw_error
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Role.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Role.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Role.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -7,7 +7,7 @@
use Scalar::Util 'blessed';
use Moose::Util::TypeConstraints ();
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Union.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Union.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint/Union.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -7,7 +7,7 @@
use Moose::Meta::TypeCoercion::Union;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Meta/TypeConstraint.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -12,7 +12,7 @@
use base qw(Class::MOP::Object);
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Object.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Object.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Object.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -7,7 +7,7 @@
use if ( not our $__mx_is_compiled ), 'Moose::Meta::Class';
use if ( not our $__mx_is_compiled ), metaclass => 'Moose::Meta::Class';
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Role.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Role.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Role.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -10,13 +10,14 @@
use Data::OptList;
use Sub::Exporter;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
use Moose ();
use Moose::Util ();
+use Moose::Exporter;
use Moose::Meta::Role;
use Moose::Util::TypeConstraints;
@@ -107,7 +108,7 @@
croak "Roles cannot support 'augment'";
}
-my $exporter = Moose::Exporter->setup_import_methods(
+Moose::Exporter->setup_import_methods(
with_caller => [
qw( with requires excludes has before after around override make_immutable )
],
Modified: Moose/branches/moose-manual/lib/Moose/Util/MetaRole.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Util/MetaRole.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Util/MetaRole.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -5,7 +5,7 @@
use Scalar::Util 'blessed', 'looks_like_number';
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose/Util/TypeConstraints.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Util/TypeConstraints.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Util/TypeConstraints.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -9,7 +9,7 @@
use Scalar::Util 'blessed';
use Moose::Exporter;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
@@ -47,7 +47,8 @@
Moose::Exporter->setup_import_methods(
as_is => [
qw(
- type subtype class_type role_type as where message optimize_as
+ type subtype class_type role_type maybe_type
+ as where message optimize_as
coerce from via
enum
find_type_constraint
@@ -301,6 +302,14 @@
);
}
+sub maybe_type {
+ my ($type_parameter) = @_;
+
+ register_type_constraint(
+ $REGISTRY->get_type_constraint('Maybe')->parameterize($type_parameter)
+ );
+}
+
sub coerce {
my ($type_name, @coercion_map) = @_;
_install_type_coercions($type_name, \@coercion_map);
@@ -386,7 +395,7 @@
my $constraint;
if ( defined $parent
and $parent
- = blessed $parent ? $parent : find_or_parse_type_constraint($parent) )
+ = blessed $parent ? $parent : find_or_create_isa_type_constraint($parent) )
{
$constraint = $parent->create_child_type(%opts);
}
@@ -754,6 +763,10 @@
HashRef[CodeRef] # a hash of str to CODE ref mappings
Maybe[Str] # value may be a string, may be undefined
+If Moose finds a name in brackets that it does not recognize as an
+existing type, it assumes that this is a class name, for example
+C<ArrayRef[DateTime]>.
+
B<NOTE:> Unless you parameterize a type, then it is invalid to
include the square brackets. I.e. C<ArrayRef[]> will be
literally interpreted as a type name.
@@ -829,6 +842,9 @@
This creates a named subtype.
+If you provide a parent that Moose does not recognize, it will
+automatically create a new class type constraint for this name.
+
=item B<subtype ($parent, $where_clause, ?$message)>
This creates an unnamed subtype and will return the type
@@ -845,6 +861,11 @@
Creates a type constraint with the name C<$role> and the metaclass
L<Moose::Meta::TypeConstraint::Role>.
+=item B<maybe_type ($type)>
+
+Creates a type constraint for either C<undef> or something of the
+given type.
+
=item B<enum ($name, @values)>
This will create a basic subtype for a given set of strings.
Modified: Moose/branches/moose-manual/lib/Moose/Util.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose/Util.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose/Util.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -7,7 +7,7 @@
use Scalar::Util 'blessed';
use Class::MOP 0.60;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/Moose.pm
===================================================================
--- Moose/branches/moose-manual/lib/Moose.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Moose.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -6,7 +6,7 @@
use 5.008;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
@@ -15,7 +15,7 @@
use Moose::Exporter;
-use Class::MOP 0.75;
+use Class::MOP 0.76;
use Moose::Meta::Class;
use Moose::Meta::TypeConstraint;
@@ -36,6 +36,13 @@
use Moose::Util::TypeConstraints;
use Moose::Util ();
+sub _caller_info {
+ my $level = @_ ? ($_[0] + 1) : 2;
+ my %info;
+ @info{qw(package file line)} = caller($level);
+ return \%info;
+}
+
sub throw_error {
# FIXME This
shift;
@@ -74,7 +81,7 @@
my $class = shift;
my $name = shift;
croak 'Usage: has \'name\' => ( key => value, ... )' if @_ == 1;
- my %options = @_;
+ my %options = ( definition_context => _caller_info(), @_ );
my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ];
Class::MOP::Class->initialize($class)->add_attribute( $_, %options ) for @$attrs;
}
@@ -94,8 +101,15 @@
Moose::Util::add_method_modifier($class, 'around', \@_);
}
+our $SUPER_PACKAGE;
+our $SUPER_BODY;
+our @SUPER_ARGS;
+
sub super {
- return unless our $SUPER_BODY; $SUPER_BODY->(our @SUPER_ARGS);
+ # This check avoids a recursion loop - see
+ # t/100_bugs/020_super_recursion.t
+ return if defined $SUPER_PACKAGE && $SUPER_PACKAGE ne caller();
+ return unless $SUPER_BODY; $SUPER_BODY->(@SUPER_ARGS);
}
sub override {
@@ -1004,6 +1018,8 @@
=item L<Class::MOP> documentation
+=item L<Moose::Util::TypeConstraints> for information about type constraints.
+
=item The #moose channel on irc.perl.org
=item The Moose mailing list - moose at perl.org
Modified: Moose/branches/moose-manual/lib/Test/Moose.pm
===================================================================
--- Moose/branches/moose-manual/lib/Test/Moose.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/Test/Moose.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -8,7 +8,7 @@
use Moose::Util 'does_role', 'find_meta';
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/lib/oose.pm
===================================================================
--- Moose/branches/moose-manual/lib/oose.pm 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/lib/oose.pm 2009-01-28 19:07:05 UTC (rev 7409)
@@ -5,7 +5,7 @@
use Class::MOP;
-our $VERSION = '0.64';
+our $VERSION = '0.65';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: Moose/branches/moose-manual/t/030_roles/003_apply_role.t
===================================================================
--- Moose/branches/moose-manual/t/030_roles/003_apply_role.t 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/t/030_roles/003_apply_role.t 2009-01-28 19:07:05 UTC (rev 7409)
@@ -9,151 +9,177 @@
{
package FooRole;
use Moose::Role;
-
- has 'bar' => (is => 'rw', isa => 'FooClass');
- has 'baz' => (is => 'ro');
-
- sub goo { 'FooRole::goo' }
- sub foo { 'FooRole::foo' }
-
- override 'boo' => sub { 'FooRole::boo -> ' . super() };
-
- around 'blau' => sub {
+
+ has 'bar' => ( is => 'rw', isa => 'FooClass' );
+ has 'baz' => ( is => 'ro' );
+
+ sub goo {'FooRole::goo'}
+ sub foo {'FooRole::foo'}
+
+ override 'boo' => sub { 'FooRole::boo -> ' . super() };
+
+ around 'blau' => sub {
my $c = shift;
'FooRole::blau -> ' . $c->();
- };
+ };
+}
-}{
+{
package BarRole;
use Moose::Role;
- sub woot { 'BarRole::woot' }
-
-}{
+ sub woot {'BarRole::woot'}
+}
+
+{
package BarClass;
use Moose;
-
- sub boo { 'BarClass::boo' }
- sub foo { 'BarClass::foo' } # << the role overrides this ...
- __PACKAGE__->meta->make_immutable(debug => 0);
-}{
-
+ sub boo {'BarClass::boo'}
+ sub foo {'BarClass::foo'} # << the role overrides this ...
+}
+
+{
package FooClass;
use Moose;
-
+
extends 'BarClass';
- with 'FooRole';
-
- sub blau { 'FooClass::blau' } # << the role wraps this ...
+ with 'FooRole';
- sub goo { 'FooClass::goo' } # << overrides the one from the role ...
-
- __PACKAGE__->meta->make_immutable(debug => 0);
-}{
-
+ sub blau {'FooClass::blau'} # << the role wraps this ...
+
+ sub goo {'FooClass::goo'} # << overrides the one from the role ...
+}
+
+{
package FooBarClass;
use Moose;
-
+
extends 'FooClass';
- with 'FooRole', 'BarRole';
+ with 'FooRole', 'BarRole';
}
my $foo_class_meta = FooClass->meta;
-isa_ok($foo_class_meta, 'Moose::Meta::Class');
+isa_ok( $foo_class_meta, 'Moose::Meta::Class' );
my $foobar_class_meta = FooBarClass->meta;
-isa_ok($foobar_class_meta, 'Moose::Meta::Class');
+isa_ok( $foobar_class_meta, 'Moose::Meta::Class' );
dies_ok {
- $foo_class_meta->does_role()
-} '... does_role requires a role name';
+ $foo_class_meta->does_role();
+}
+'... does_role requires a role name';
dies_ok {
- $foo_class_meta->apply_role()
-} '... apply_role requires a role';
+ $foo_class_meta->add_role();
+}
+'... apply_role requires a role';
dies_ok {
- $foo_class_meta->apply_role(bless({} => 'Fail'))
-} '... apply_role requires a role';
+ $foo_class_meta->add_role( bless( {} => 'Fail' ) );
+}
+'... apply_role requires a role';
-ok($foo_class_meta->does_role('FooRole'), '... the FooClass->meta does_role FooRole');
-ok(!$foo_class_meta->does_role('OtherRole'), '... the FooClass->meta !does_role OtherRole');
+ok( $foo_class_meta->does_role('FooRole'),
+ '... the FooClass->meta does_role FooRole' );
+ok( !$foo_class_meta->does_role('OtherRole'),
+ '... the FooClass->meta !does_role OtherRole' );
-ok($foobar_class_meta->does_role('FooRole'), '... the FooBarClass->meta does_role FooRole');
-ok($foobar_class_meta->does_role('BarRole'), '... the FooBarClass->meta does_role BarRole');
-ok(!$foobar_class_meta->does_role('OtherRole'), '... the FooBarClass->meta !does_role OtherRole');
+ok( $foobar_class_meta->does_role('FooRole'),
+ '... the FooBarClass->meta does_role FooRole' );
+ok( $foobar_class_meta->does_role('BarRole'),
+ '... the FooBarClass->meta does_role BarRole' );
+ok( !$foobar_class_meta->does_role('OtherRole'),
+ '... the FooBarClass->meta !does_role OtherRole' );
foreach my $method_name (qw(bar baz foo boo blau goo)) {
- ok($foo_class_meta->has_method($method_name), '... FooClass has the method ' . $method_name);
- ok($foobar_class_meta->has_method($method_name), '... FooBarClass has the method ' . $method_name);
+ ok( $foo_class_meta->has_method($method_name),
+ '... FooClass has the method ' . $method_name );
+ ok( $foobar_class_meta->has_method($method_name),
+ '... FooBarClass has the method ' . $method_name );
}
-ok(!$foo_class_meta->has_method('woot'), '... FooClass lacks the method woot');
-ok($foobar_class_meta->has_method('woot'), '... FooBarClass has the method woot');
+ok( !$foo_class_meta->has_method('woot'),
+ '... FooClass lacks the method woot' );
+ok( $foobar_class_meta->has_method('woot'),
+ '... FooBarClass has the method woot' );
foreach my $attr_name (qw(bar baz)) {
- ok($foo_class_meta->has_attribute($attr_name), '... FooClass has the attribute ' . $attr_name);
- ok($foobar_class_meta->has_attribute($attr_name), '... FooBarClass has the attribute ' . $attr_name);
+ ok( $foo_class_meta->has_attribute($attr_name),
+ '... FooClass has the attribute ' . $attr_name );
+ ok( $foobar_class_meta->has_attribute($attr_name),
+ '... FooBarClass has the attribute ' . $attr_name );
}
-can_ok('FooClass', 'does');
-ok(FooClass->does('FooRole'), '... the FooClass does FooRole');
-ok(!FooClass->does('BarRole'), '... the FooClass does not do BarRole');
-ok(!FooClass->does('OtherRole'), '... the FooClass does not do OtherRole');
+can_ok( 'FooClass', 'does' );
+ok( FooClass->does('FooRole'), '... the FooClass does FooRole' );
+ok( !FooClass->does('BarRole'), '... the FooClass does not do BarRole' );
+ok( !FooClass->does('OtherRole'), '... the FooClass does not do OtherRole' );
-can_ok('FooBarClass', 'does');
-ok(FooBarClass->does('FooRole'), '... the FooClass does FooRole');
-ok(FooBarClass->does('BarRole'), '... the FooBarClass does FooBarRole');
-ok(!FooBarClass->does('OtherRole'), '... the FooBarClass does not do OtherRole');
+can_ok( 'FooBarClass', 'does' );
+ok( FooBarClass->does('FooRole'), '... the FooClass does FooRole' );
+ok( FooBarClass->does('BarRole'), '... the FooBarClass does FooBarRole' );
+ok( !FooBarClass->does('OtherRole'),
+ '... the FooBarClass does not do OtherRole' );
my $foo = FooClass->new();
-isa_ok($foo, 'FooClass');
+isa_ok( $foo, 'FooClass' );
my $foobar = FooBarClass->new();
-isa_ok($foobar, 'FooBarClass');
+isa_ok( $foobar, 'FooBarClass' );
-is($foo->goo, 'FooClass::goo', '... got the right value of goo');
-is($foobar->goo, 'FooRole::goo', '... got the right value of goo');
+is( $foo->goo, 'FooClass::goo', '... got the right value of goo' );
+is( $foobar->goo, 'FooRole::goo', '... got the right value of goo' );
-is($foo->boo, 'FooRole::boo -> BarClass::boo', '... got the right value from ->boo');
-is($foobar->boo, 'FooRole::boo -> FooRole::boo -> BarClass::boo', '... got the right value from ->boo (double wrapped)');
+is( $foo->boo, 'FooRole::boo -> BarClass::boo',
+ '... got the right value from ->boo' );
+is( $foobar->boo, 'FooRole::boo -> FooRole::boo -> BarClass::boo',
+ '... got the right value from ->boo (double wrapped)' );
-is($foo->blau, 'FooRole::blau -> FooClass::blau', '... got the right value from ->blau');
-is($foobar->blau, 'FooRole::blau -> FooRole::blau -> FooClass::blau', '... got the right value from ->blau');
+is( $foo->blau, 'FooRole::blau -> FooClass::blau',
+ '... got the right value from ->blau' );
+is( $foobar->blau, 'FooRole::blau -> FooRole::blau -> FooClass::blau',
+ '... got the right value from ->blau' );
-foreach my $foo ($foo, $foobar) {
- can_ok($foo, 'does');
- ok($foo->does('FooRole'), '... an instance of FooClass does FooRole');
- ok(!$foo->does('OtherRole'), '... and instance of FooClass does not do OtherRole');
+foreach my $foo ( $foo, $foobar ) {
+ can_ok( $foo, 'does' );
+ ok( $foo->does('FooRole'), '... an instance of FooClass does FooRole' );
+ ok( !$foo->does('OtherRole'),
+ '... and instance of FooClass does not do OtherRole' );
- can_ok($foobar, 'does');
- ok($foobar->does('FooRole'), '... an instance of FooBarClass does FooRole');
- ok($foobar->does('BarRole'), '... an instance of FooBarClass does BarRole');
- ok(!$foobar->does('OtherRole'), '... and instance of FooBarClass does not do OtherRole');
+ can_ok( $foobar, 'does' );
+ ok( $foobar->does('FooRole'),
+ '... an instance of FooBarClass does FooRole' );
+ ok( $foobar->does('BarRole'),
+ '... an instance of FooBarClass does BarRole' );
+ ok( !$foobar->does('OtherRole'),
+ '... and instance of FooBarClass does not do OtherRole' );
for my $method (qw/bar baz foo boo goo blau/) {
- can_ok($foo, $method);
+ can_ok( $foo, $method );
}
- is($foo->foo, 'FooRole::foo', '... got the right value of foo');
+ is( $foo->foo, 'FooRole::foo', '... got the right value of foo' );
- ok(!defined($foo->baz), '... $foo->baz is undefined');
- ok(!defined($foo->bar), '... $foo->bar is undefined');
+ ok( !defined( $foo->baz ), '... $foo->baz is undefined' );
+ ok( !defined( $foo->bar ), '... $foo->bar is undefined' );
dies_ok {
- $foo->baz(1)
- } '... baz is a read-only accessor';
+ $foo->baz(1);
+ }
+ '... baz is a read-only accessor';
dies_ok {
- $foo->bar(1)
- } '... bar is a read-write accessor with a type constraint';
+ $foo->bar(1);
+ }
+ '... bar is a read-write accessor with a type constraint';
my $foo2 = FooClass->new();
- isa_ok($foo2, 'FooClass');
+ isa_ok( $foo2, 'FooClass' );
lives_ok {
- $foo->bar($foo2)
- } '... bar is a read-write accessor with a type constraint';
+ $foo->bar($foo2);
+ }
+ '... bar is a read-write accessor with a type constraint';
- is($foo->bar, $foo2, '... got the right value for bar now');
+ is( $foo->bar, $foo2, '... got the right value for bar now' );
}
Modified: Moose/branches/moose-manual/t/030_roles/004_role_composition_errors.t
===================================================================
--- Moose/branches/moose-manual/t/030_roles/004_role_composition_errors.t 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/t/030_roles/004_role_composition_errors.t 2009-01-28 19:07:05 UTC (rev 7409)
@@ -140,9 +140,8 @@
has 'meth2' => ( is => 'ro' );
::throws_ok { with('Quux::Role') }
- qr/\Q'Quux::Role' requires the methods 'meth3' and 'meth4' to be implemented by 'Quux::Class3'\E\n
- \Q'Quux::Role' requires the methods 'meth1' and 'meth2' to be implemented by 'Quux::Class3' but the method is only an attribute accessor/x,
- 'exception mentions all the require methods that are accessors at once, as well as missing methods';
+ qr/'Quux::Role' requires the methods 'meth3' and 'meth4' to be implemented by 'Quux::Class3'/,
+ 'exception mentions all the missing methods at once, but not the accessors';
}
{
@@ -153,7 +152,6 @@
has 'meth2' => ( is => 'ro' );
::throws_ok { with('Quux::Role') }
- qr/\Q'Quux::Role' requires the methods 'meth3' and 'meth4' to be implemented by 'Quux::Class4'\E\n
- \Q'Quux::Role' requires the method 'meth2' to be implemented by 'Quux::Class4' but the method is only an attribute accessor/x,
+ qr/'Quux::Role' requires the methods 'meth3' and 'meth4' to be implemented by 'Quux::Class4'/,
'exception mentions all the require methods that are accessors at once, as well as missing methods, but not the one that exists';
}
Modified: Moose/branches/moose-manual/t/030_roles/007_roles_and_req_method_edge_cases.t
===================================================================
--- Moose/branches/moose-manual/t/030_roles/007_roles_and_req_method_edge_cases.t 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/t/030_roles/007_roles_and_req_method_edge_cases.t 2009-01-28 19:07:05 UTC (rev 7409)
@@ -173,9 +173,9 @@
has 'foo' => (is => 'ro');
- ::dies_ok {
+ ::lives_ok {
with 'Role::RequireFoo';
- } '... the required "foo" method exists, but it is a before (and we will die)';
+ } '... the required "foo" method exists, and is an accessor';
}
# ...
@@ -211,7 +211,7 @@
use Moose;
extends 'Foo::Class::Base';
- ::dies_ok {
+ ::lives_ok {
with 'Foo::Role';
} '... our role combined successfully';
}
Modified: Moose/branches/moose-manual/t/030_roles/011_overriding.t
===================================================================
--- Moose/branches/moose-manual/t/030_roles/011_overriding.t 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/t/030_roles/011_overriding.t 2009-01-28 19:07:05 UTC (rev 7409)
@@ -174,6 +174,7 @@
} "define role Role::I";
sub zot { 'Role::I::zot' }
+ sub zzy { 'Role::I::zzy' }
package Class::C;
use Moose;
@@ -205,26 +206,21 @@
ok(Role::I->meta->requires_method('foo'), '... Role::I still have the &foo requirement');
{
- # fix these later ...
- TODO: {
- local $TODO = "add support for attribute methods fufilling reqs";
+ lives_ok {
+ package Class::D;
+ use Moose;
- lives_ok {
- package Class::D;
- use Moose;
+ has foo => ( default => __PACKAGE__ . "::foo", is => "rw" );
- has foo => ( default => __PACKAGE__ . "::foo", is => "rw" );
+ sub zot { 'Class::D::zot' }
- sub zot { 'Class::D::zot' }
+ with qw(Role::I);
- with qw(Role::I);
-
- } "resolved with attr";
+ } "resolved with attr";
- can_ok( Class::D->new, qw(foo bar xxy zot) );
- is( eval { Class::D->new->bar }, "Role::H::bar", "bar" );
- is( eval { Class::D->new->xxy }, "Role::I::xxy", "xxy" );
- }
+ can_ok( Class::D->new, qw(foo bar xxy zot) );
+ is( eval { Class::D->new->bar }, "Role::H::bar", "bar" );
+ is( eval { Class::D->new->zzy }, "Role::I::zzy", "zzy" );
is( eval { Class::D->new->foo }, "Class::D::foo", "foo" );
is( eval { Class::D->new->zot }, "Class::D::zot", "zot" );
Modified: Moose/branches/moose-manual/t/040_type_constraints/011_container_type_constraint.t
===================================================================
--- Moose/branches/moose-manual/t/040_type_constraints/011_container_type_constraint.t 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/t/040_type_constraints/011_container_type_constraint.t 2009-01-28 19:07:05 UTC (rev 7409)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 22;
+use Test::More tests => 24;
use Test::Exception;
BEGIN {
@@ -64,5 +64,10 @@
[[ 1, 2, 3 ], [ qw/foo bar/ ]]
), '... [[ 1, 2, 3 ], [ qw/foo bar/ ]] failed successfully');
+{
+ my $anon_type = Moose::Util::TypeConstraints::find_or_parse_type_constraint('ArrayRef[Foo]');
+ isa_ok( $anon_type, 'Moose::Meta::TypeConstraint::Parameterized' );
-
+ my $param_type = $anon_type->type_parameter;
+ isa_ok( $param_type, 'Moose::Meta::TypeConstraint::Class' );
+}
Modified: Moose/branches/moose-manual/t/040_type_constraints/021_maybe_type_constraint.t
===================================================================
--- Moose/branches/moose-manual/t/040_type_constraints/021_maybe_type_constraint.t 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/t/040_type_constraints/021_maybe_type_constraint.t 2009-01-28 19:07:05 UTC (rev 7409)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 31;
+use Test::More tests => 36;
use Test::Exception;
use Moose::Util::TypeConstraints;
@@ -26,26 +26,52 @@
ok(!$type->check([]), '... checked type correctly (fail)');
{
+ package Bar;
+ use Moose;
+
package Foo;
use Moose;
+ use Moose::Util::TypeConstraints;
- has 'bar' => (is => 'rw', isa => 'Maybe[ArrayRef]', required => 1);
+ has 'arr' => (is => 'rw', isa => 'Maybe[ArrayRef]', required => 1);
+ has 'bar' => (is => 'rw', isa => class_type('Bar'));
+ has 'maybe_bar' => (is => 'rw', isa => maybe_type(class_type('Bar')));
}
lives_ok {
- Foo->new(bar => []);
+ Foo->new(arr => [], bar => Bar->new);
+} '... Bar->new isa Bar';
+
+dies_ok {
+ Foo->new(arr => [], bar => undef);
+} '... undef isnta Bar';
+
+lives_ok {
+ Foo->new(arr => [], maybe_bar => Bar->new);
+} '... Bar->new isa maybe(Bar)';
+
+lives_ok {
+ Foo->new(arr => [], maybe_bar => undef);
+} '... undef isa maybe(Bar)';
+
+dies_ok {
+ Foo->new(arr => [], maybe_bar => 1);
+} '... 1 isnta maybe(Bar)';
+
+lives_ok {
+ Foo->new(arr => []);
} '... it worked!';
lives_ok {
- Foo->new(bar => undef);
+ Foo->new(arr => undef);
} '... it worked!';
dies_ok {
- Foo->new(bar => 100);
+ Foo->new(arr => 100);
} '... failed the type check';
dies_ok {
- Foo->new(bar => 'hello world');
+ Foo->new(arr => 'hello world');
} '... failed the type check';
@@ -104,4 +130,4 @@
throws_ok sub { $obj->Maybe_Int("a") },
qr/Attribute \(Maybe_Int\) does not pass the type constraint/
- => 'failed assigned ("a")';
\ No newline at end of file
+ => 'failed assigned ("a")';
Deleted: Moose/branches/moose-manual/t/040_type_constraints/030-class_subtypes.t
===================================================================
--- Moose/branches/moose-manual/t/040_type_constraints/030-class_subtypes.t 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/t/040_type_constraints/030-class_subtypes.t 2009-01-28 19:07:05 UTC (rev 7409)
@@ -1,82 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Test::More tests => 18;
-use Test::Exception;
-
-use Moose::Util::TypeConstraints;
-use Moose::Meta::TypeConstraint;
-
-
-## Create a subclass with a custom method
-
-{
- package Test::Moose::Meta::TypeConstraint::AnySubType;
- use Moose;
- extends 'Moose::Meta::TypeConstraint';
-
- sub my_custom_method {
- return 1;
- }
-}
-
-my $Int = find_type_constraint('Int');
-ok $Int, 'Got a good type contstraint';
-
-my $parent = Test::Moose::Meta::TypeConstraint::AnySubType->new({
- name => "Test::Moose::Meta::TypeConstraint::AnySubType" ,
- parent => $Int,
-});
-
-ok $parent, 'Created type constraint';
-ok $parent->check(1), 'Correctly passed';
-ok ! $parent->check('a'), 'correctly failed';
-ok $parent->my_custom_method, 'found the custom method';
-
-my $subtype1 = subtype 'another_subtype' => as $parent;
-
-ok $subtype1, 'Created type constraint';
-ok $subtype1->check(1), 'Correctly passed';
-ok ! $subtype1->check('a'), 'correctly failed';
-ok $subtype1->my_custom_method, 'found the custom method';
-
-
-my $subtype2 = subtype 'another_subtype' => as $subtype1 => where { $_ < 10 };
-
-ok $subtype2, 'Created type constraint';
-ok $subtype2->check(1), 'Correctly passed';
-ok ! $subtype2->check('a'), 'correctly failed';
-ok ! $subtype2->check(100), 'correctly failed';
-
-ok $subtype2->my_custom_method, 'found the custom method';
-
-
-{
- package Foo;
-
- use Moose;
-}
-
-{
- package Bar;
-
- use Moose;
-
- extends 'Foo';
-}
-
-{
- package Baz;
-
- use Moose;
-}
-
-my $foo = class_type 'Foo';
-my $isa_foo = subtype 'IsaFoo' => as $foo;
-
-ok $isa_foo, 'Created subtype of Foo type';
-ok $isa_foo->check( Foo->new ), 'Foo passes check';
-ok $isa_foo->check( Bar->new ), 'Bar passes check';
-ok ! $isa_foo->check( Baz->new ), 'Baz does not pass check';
Copied: Moose/branches/moose-manual/t/040_type_constraints/030_class_subtypes.t (from rev 7030, Moose/branches/moose-manual/t/040_type_constraints/030-class_subtypes.t)
===================================================================
--- Moose/branches/moose-manual/t/040_type_constraints/030_class_subtypes.t (rev 0)
+++ Moose/branches/moose-manual/t/040_type_constraints/030_class_subtypes.t 2009-01-28 19:07:05 UTC (rev 7409)
@@ -0,0 +1,82 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 18;
+use Test::Exception;
+
+use Moose::Util::TypeConstraints;
+use Moose::Meta::TypeConstraint;
+
+
+## Create a subclass with a custom method
+
+{
+ package Test::Moose::Meta::TypeConstraint::AnySubType;
+ use Moose;
+ extends 'Moose::Meta::TypeConstraint';
+
+ sub my_custom_method {
+ return 1;
+ }
+}
+
+my $Int = find_type_constraint('Int');
+ok $Int, 'Got a good type contstraint';
+
+my $parent = Test::Moose::Meta::TypeConstraint::AnySubType->new({
+ name => "Test::Moose::Meta::TypeConstraint::AnySubType" ,
+ parent => $Int,
+});
+
+ok $parent, 'Created type constraint';
+ok $parent->check(1), 'Correctly passed';
+ok ! $parent->check('a'), 'correctly failed';
+ok $parent->my_custom_method, 'found the custom method';
+
+my $subtype1 = subtype 'another_subtype' => as $parent;
+
+ok $subtype1, 'Created type constraint';
+ok $subtype1->check(1), 'Correctly passed';
+ok ! $subtype1->check('a'), 'correctly failed';
+ok $subtype1->my_custom_method, 'found the custom method';
+
+
+my $subtype2 = subtype 'another_subtype' => as $subtype1 => where { $_ < 10 };
+
+ok $subtype2, 'Created type constraint';
+ok $subtype2->check(1), 'Correctly passed';
+ok ! $subtype2->check('a'), 'correctly failed';
+ok ! $subtype2->check(100), 'correctly failed';
+
+ok $subtype2->my_custom_method, 'found the custom method';
+
+
+{
+ package Foo;
+
+ use Moose;
+}
+
+{
+ package Bar;
+
+ use Moose;
+
+ extends 'Foo';
+}
+
+{
+ package Baz;
+
+ use Moose;
+}
+
+my $foo = class_type 'Foo';
+my $isa_foo = subtype 'IsaFoo' => as $foo;
+
+ok $isa_foo, 'Created subtype of Foo type';
+ok $isa_foo->check( Foo->new ), 'Foo passes check';
+ok $isa_foo->check( Bar->new ), 'Bar passes check';
+ok ! $isa_foo->check( Baz->new ), 'Baz does not pass check';
Added: Moose/branches/moose-manual/t/040_type_constraints/031_subtype_auto_vivify_parent.t
===================================================================
--- Moose/branches/moose-manual/t/040_type_constraints/031_subtype_auto_vivify_parent.t (rev 0)
+++ Moose/branches/moose-manual/t/040_type_constraints/031_subtype_auto_vivify_parent.t 2009-01-28 19:07:05 UTC (rev 7409)
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More 'no_plan';
+
+use Moose::Util::TypeConstraints;
+
+
+{
+ package Foo;
+
+ sub new {
+ my $class = shift;
+
+ return bless {@_}, $class;
+ }
+}
+
+subtype 'FooWithSize'
+ => as 'Foo'
+ => where { $_[0]->{size} };
+
+
+my $type = find_type_constraint('FooWithSize');
+ok( $type, 'made a FooWithSize constraint' );
+ok( $type->parent, 'type has a parent type' );
+is( $type->parent->name, 'Foo', 'parent type is Foo' );
+isa_ok( $type->parent, 'Moose::Meta::TypeConstraint::Class',
+ 'parent type constraint is a class type' );
Property changes on: Moose/branches/moose-manual/t/040_type_constraints/031_subtype_auto_vivify_parent.t
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Name: svn:eol-style
+ native
Modified: Moose/branches/moose-manual/t/100_bugs/011_DEMOLISH_eats_exceptions.t
===================================================================
--- Moose/branches/moose-manual/t/100_bugs/011_DEMOLISH_eats_exceptions.t 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/t/100_bugs/011_DEMOLISH_eats_exceptions.t 2009-01-28 19:07:05 UTC (rev 7409)
@@ -11,8 +11,10 @@
subtype 'FilePath'
=> as 'Str'
- => where { $_ =~ m#^(/[a-zA-Z0-9_.-]+)+/?$#
- || $_ =~ m#^([c-zC-Z]:/[a-zA-Z0-9_.-]+)# };
+ # This used to try to _really_ check for a valid Unix or Windows
+ # path, but the regex wasn't quite right, and all we care about
+ # for the tests is that it rejects '/'
+ => where { $_ ne '/' };
{
package Baz;
use Moose;
Added: Moose/branches/moose-manual/t/100_bugs/020_super_recursion.t
===================================================================
--- Moose/branches/moose-manual/t/100_bugs/020_super_recursion.t (rev 0)
+++ Moose/branches/moose-manual/t/100_bugs/020_super_recursion.t 2009-01-28 19:07:05 UTC (rev 7409)
@@ -0,0 +1,67 @@
+use strict;
+use warnings;
+
+use Test::More 'no_plan';
+
+{
+ package A;
+ use Moose;
+
+ sub foo {
+ ::BAIL_OUT('A::foo called twice') if $main::seen{'A::foo'}++;
+ return 'a';
+ }
+
+ sub bar {
+ ::BAIL_OUT('A::bar called twice') if $main::seen{'A::bar'}++;
+ return 'a';
+ }
+
+ sub baz {
+ ::BAIL_OUT('A::baz called twice') if $main::seen{'A::baz'}++;
+ return 'a';
+ }
+}
+
+{
+ package B;
+ use Moose;
+ extends qw(A);
+
+ sub foo {
+ ::BAIL_OUT('B::foo called twice') if $main::seen{'B::foo'}++;
+ return 'b' . super();
+ }
+
+ sub bar {
+ ::BAIL_OUT('B::bar called twice') if $main::seen{'B::bar'}++;
+ return 'b' . ( super() || '' );
+ }
+
+ override baz => sub {
+ ::BAIL_OUT('B::baz called twice') if $main::seen{'B::baz'}++;
+ return 'b' . super();
+ };
+}
+
+{
+ package C;
+ use Moose;
+ extends qw(B);
+
+ sub foo { return 'c' . ( super() || '' ) }
+
+ override bar => sub {
+ ::BAIL_OUT('C::bar called twice') if $main::seen{'C::bar'}++;
+ return 'c' . super();
+ };
+
+ override baz => sub {
+ ::BAIL_OUT('C::baz called twice') if $main::seen{'C::baz'}++;
+ return 'c' . super();
+ };
+}
+
+is( C->new->foo, 'c' );
+is( C->new->bar, 'cb' );
+is( C->new->baz, 'cba' );
Modified: Moose/branches/moose-manual/t/600_todo_tests/002_various_role_shit.t
===================================================================
--- Moose/branches/moose-manual/t/600_todo_tests/002_various_role_shit.t 2009-01-28 19:06:14 UTC (rev 7408)
+++ Moose/branches/moose-manual/t/600_todo_tests/002_various_role_shit.t 2009-01-28 19:07:05 UTC (rev 7409)
@@ -83,7 +83,6 @@
has twist => ( is => "rw" );
{
- local our $TODO = "accessors don't satisfy role requires";
::lives_ok { with qw(Dancer) };
}
More information about the Moose-commits
mailing list