Browse files

Note why Reflex::Types might be needed in the future.

  • Loading branch information...
1 parent 98811ee commit 6bd0de8fade38ee84c4f2cf5d8df370406c86477 @rcaputo committed Oct 14, 2010
Showing with 16 additions and 2 deletions.
  1. +1 −1 dist.ini
  2. +15 −1 lib/Reflex/Collection.pm
View
2 dist.ini
@@ -1,5 +1,5 @@
name = Reflex
-version = 0.081
+version = 0.085
author = Rocco Caputo <rcaputo@cpan.org>
license = Perl_5
copyright_holder = Rocco Caputo
View
16 lib/Reflex/Collection.pm
@@ -6,9 +6,23 @@ package Reflex::Collection;
use Moose;
use Moose::Exporter;
use Reflex::Callbacks qw(cb_method);
-use Reflex::Role::Collectible;
use Carp qw(cluck);
+# Reflex::Role::Collectible isn't directly used in this module, but
+# the role needs to be loaded for the objects() type constraint to
+# work below. Hans Dieter Pearcey recommends the canonical Moose
+# practice of declaring types in a separate header-like class:
+#
+# package Reflex::Types;
+# use Moose::Util::TypeConstraints;
+# role_type('Reflex::Role::Collectible');
+#
+# Using Reflex::Types sets up role and type constraints once across
+# the entire program. Problems can occur when the order modules are
+# loaded becomes significant. A Reflex::Types module can avoid them.
+
+use Reflex::Role::Collectible;
+
extends 'Reflex::Base';
Moose::Exporter->setup_import_methods( with_caller => [ qw( has_many ) ]);

0 comments on commit 6bd0de8

Please sign in to comment.