[Moose-commits] r7435 - in MooseX-GlobRef-Object/trunk: .
lib/MooseX/GlobRef/Meta t/tlib/MooseX/GlobRef
t/tlib/MooseX/GlobRef/Meta
dexter at code2.0beta.co.uk
dexter at code2.0beta.co.uk
Fri Jan 30 21:21:44 GMT 2009
Author: dexter
Date: 2009-01-30 13:21:43 -0800 (Fri, 30 Jan 2009)
New Revision: 7435
Modified:
MooseX-GlobRef-Object/trunk/Changes
MooseX-GlobRef-Object/trunk/Incompatibilities
MooseX-GlobRef-Object/trunk/lib/MooseX/GlobRef/Meta/Instance.pm
MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/Meta/InstanceImmutableTest.pm
MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/Meta/InstanceTest.pm
MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/ObjectImmutableTest.pm
MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/ObjectImmutableWithScalarSlotTest.pm
MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/ObjectWithScalarSlotTest.pm
Log:
* Attributes are stored in hash slot of glob reference. Previously they were stored in hash reference pointed by scalar slot of glob reference.
Modified: MooseX-GlobRef-Object/trunk/Changes
===================================================================
--- MooseX-GlobRef-Object/trunk/Changes 2009-01-30 20:59:11 UTC (rev 7434)
+++ MooseX-GlobRef-Object/trunk/Changes 2009-01-30 21:21:43 UTC (rev 7435)
@@ -2,7 +2,7 @@
0.05 | Piotr Roszatycki <dexter at debian.org> | 2009-01-30
* Attributes are stored in hash slot of glob reference. Previously they were
- stored in hash reference pointed by scalar slot.
+ stored in hash reference pointed by scalar slot of glob reference.
------------------------------------------------------------------------
0.04 | Piotr Roszatycki <dexter at debian.org> | 2008-12-30
Modified: MooseX-GlobRef-Object/trunk/Incompatibilities
===================================================================
--- MooseX-GlobRef-Object/trunk/Incompatibilities 2009-01-30 20:59:11 UTC (rev 7434)
+++ MooseX-GlobRef-Object/trunk/Incompatibilities 2009-01-30 21:21:43 UTC (rev 7435)
@@ -2,7 +2,7 @@
0.04 -> 0.05
* Attributes are stored in hash slot of glob reference. Previously they were
- stored in hash reference pointed by scalar slot.
+ stored in hash reference pointed by scalar slot of glob reference.
Was:
Modified: MooseX-GlobRef-Object/trunk/lib/MooseX/GlobRef/Meta/Instance.pm
===================================================================
--- MooseX-GlobRef-Object/trunk/lib/MooseX/GlobRef/Meta/Instance.pm 2009-01-30 20:59:11 UTC (rev 7434)
+++ MooseX-GlobRef-Object/trunk/lib/MooseX/GlobRef/Meta/Instance.pm 2009-01-30 21:21:43 UTC (rev 7435)
@@ -39,7 +39,7 @@
=head1 DESCRIPTION
This instance metaclass allows to store Moose object in glob reference or
-file handle. It can be used directly with B<metaclass> pragma or with
+file handle. It can be used directly with C<metaclass> pragma or with
L<MooseX::GlobRef::Object> base class.
Notice, that "use metaclass" have to be before "use Moose".
@@ -62,8 +62,8 @@
# create anonymous filehandler
select select my $fh;
- # associate hashref with globref
- ${*$fh} = {};
+ # associate hash slot with globref
+ %{*$fh} = ();
return bless $fh => $self->associated_metaclass->name;
};
@@ -71,43 +71,43 @@
sub get_slot_value {
my ($self, $instance, $slot_name) = @_;
- return ${*$instance}->{$slot_name};
+ return do { \%{*$instance} }->{$slot_name};
};
sub set_slot_value {
my ($self, $instance, $slot_name, $value) = @_;
- return ${*$instance}->{$slot_name} = $value;
+ return do { \%{*$instance} }->{$slot_name} = $value;
};
sub deinitialize_slot {
my ( $self, $instance, $slot_name ) = @_;
- return delete ${*$instance}->{$slot_name};
+ return delete do { \%{*$instance} }->{$slot_name};
};
sub is_slot_initialized {
my ($self, $instance, $slot_name) = @_;
- return exists ${*$instance}->{$slot_name} ? 1 : 0;
+ return exists do { \%{*$instance} }->{$slot_name} ? 1 : 0;
};
sub weaken_slot_value {
my ($self, $instance, $slot_name) = @_;
- return Scalar::Util::weaken ${*$instance}->{$slot_name};
+ return Scalar::Util::weaken do { \%{*$instance} }->{$slot_name};
};
sub inline_create_instance {
my ($self, $class_variable) = @_;
- return 'select select my $fh; ${*$fh} = {}; bless $fh => ' . $class_variable;
+ return 'select select my $fh; %{*$fh} = (); bless $fh => ' . $class_variable;
};
sub inline_slot_access {
my ($self, $instance, $slot_name) = @_;
- return sprintf '${*{%s}}->{%s}', $instance, $slot_name;
+ return 'do { \%{*{' . $instance . '}} }->{' . $slot_name . '}';
};
@@ -160,7 +160,7 @@
=head1 LICENSE
-Copyright (C) 2007, 2008 by Piotr Roszatycki E<lt>dexter at debian.orgE<gt>.
+Copyright (C) 2007, 2008, 2009 by Piotr Roszatycki E<lt>dexter at debian.orgE<gt>.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
Modified: MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/Meta/InstanceImmutableTest.pm
===================================================================
--- MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/Meta/InstanceImmutableTest.pm 2009-01-30 20:59:11 UTC (rev 7434)
+++ MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/Meta/InstanceImmutableTest.pm 2009-01-30 21:21:43 UTC (rev 7435)
@@ -29,7 +29,6 @@
assert_not_null($obj);
assert_true($obj->isa('MooseX::GlobRef::Meta::InstanceImmutableTest::Test1'));
assert_equals('GLOB', reftype($obj));
- assert_equals('HASH', reftype(${*$obj}));
};
sub test_accessor {
Modified: MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/Meta/InstanceTest.pm
===================================================================
--- MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/Meta/InstanceTest.pm 2009-01-30 20:59:11 UTC (rev 7434)
+++ MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/Meta/InstanceTest.pm 2009-01-30 21:21:43 UTC (rev 7435)
@@ -27,7 +27,6 @@
assert_not_null($obj);
assert_true($obj->isa('MooseX::GlobRef::Meta::InstanceTest::Test1'));
assert_equals('GLOB', reftype($obj));
- assert_equals('HASH', reftype(${*$obj}));
};
sub test_accessor {
Modified: MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/ObjectImmutableTest.pm
===================================================================
--- MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/ObjectImmutableTest.pm 2009-01-30 20:59:11 UTC (rev 7434)
+++ MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/ObjectImmutableTest.pm 2009-01-30 21:21:43 UTC (rev 7435)
@@ -36,7 +36,6 @@
assert_not_null($obj);
assert_true($obj->isa('MooseX::GlobRef::ObjectImmutableTest::Test1'));
assert_equals('GLOB', reftype($obj));
- assert_equals('HASH', reftype(${*$obj}));
};
sub test_accessor {
Modified: MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/ObjectImmutableWithScalarSlotTest.pm
===================================================================
--- MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/ObjectImmutableWithScalarSlotTest.pm 2009-01-30 20:59:11 UTC (rev 7434)
+++ MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/ObjectImmutableWithScalarSlotTest.pm 2009-01-30 21:21:43 UTC (rev 7435)
@@ -44,7 +44,6 @@
assert_not_null($obj);
assert_true($obj->isa('MooseX::GlobRef::ObjectImmutableWithScalarTest::Test1'));
assert_equals('GLOB', reftype($obj));
- assert_equals('HASH', reftype(${*$obj}));
};
sub test_accessor {
Modified: MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/ObjectWithScalarSlotTest.pm
===================================================================
--- MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/ObjectWithScalarSlotTest.pm 2009-01-30 20:59:11 UTC (rev 7434)
+++ MooseX-GlobRef-Object/trunk/t/tlib/MooseX/GlobRef/ObjectWithScalarSlotTest.pm 2009-01-30 21:21:43 UTC (rev 7435)
@@ -42,7 +42,6 @@
assert_not_null($obj);
assert_true($obj->isa('MooseX::GlobRef::ObjectWithScalarSlotTest::Test1'));
assert_equals('GLOB', reftype($obj));
- assert_equals('HASH', reftype(${*$obj}));
};
sub test_accessor {
More information about the Moose-commits
mailing list