Mercurial > pub > Impl
diff Lib/IMPL/DOM/Property.pm @ 122:a7efb3117295
Fixed bug in IMPL::DOM::Navigator::selectNodes
Fixed bug in IMPL::DOM::Node::selectNodes
renamed operator 'type' to 'typeof' in IMPL::Object::Abstract
A proper implementation of the IMPL::DOM::Node::nodeProperty and a related changes in the IMPL::DOM::Property module, now the last is very simple.
author | wizard |
---|---|
date | Tue, 08 Jun 2010 20:12:45 +0400 |
parents | 16ada169ca75 |
children | 76515373dac0 |
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Property.pm Tue Jun 08 03:38:10 2010 +0400 +++ b/Lib/IMPL/DOM/Property.pm Tue Jun 08 20:12:45 2010 +0400 @@ -2,7 +2,6 @@ use strict; use warnings; -use IMPL::Class::Property; require IMPL::Exception; use base qw(Exporter); @@ -10,44 +9,10 @@ sub _dom($) { my ($prop_info) = @_; - $prop_info->Implementor( 'IMPL::DOM::Property' ); + $prop_info->Attributes->{domProperty} = 1; return $prop_info; } -sub Make { - my ($self,$propInfo) = @_; - - my ($class,$name,$virt,$access,$mutators) = $propInfo->get qw(Class Name Virtual Access Mutators); - - die new IMPL::InvalidOperationException("DOM properties can be declared only for the DOM objects") unless $class->isa('IMPL::DOM::Node'); - - no strict 'refs'; - die new IMPL::InvalidOperationException("Custom mutators are not allowed","${class}::$name") if ref $mutators; - if (($mutators & prop_all) == prop_all) { - *{"${class}::$name"} = sub { - $_[0]->nodeProperty($name,@_[1..$#_]); - }; - $propInfo->canGet(1); - $propInfo->canSet(1); - } elsif( $mutators & prop_get ) { - *{"${class}::$name"} = sub { - die new IMPL::InvalidOperationException("This is a readonly property", "${class}::$name") if @_>1; - $_[0]->nodeProperty($name); - }; - $propInfo->canGet(1); - $propInfo->canSet(0); - } elsif( $mutators & prop_set ) { - *{"${class}::$name"} = sub { - die new IMPL::InvalidOperationException("This is a writeonly property", "${class}::$name") if @_<2; - $_[0]->nodeProperty($name,@_[1..$#_]); - }; - $propInfo->canGet(0); - $propInfo->canSet(1); - } else { - die new IMPL::InvalidOperationException("Invalid value for the property mutators","${class}::$name",$mutators); - } -} - 1; __END__ =pod @@ -67,7 +32,6 @@ =head1 DESCRIPTION -Позволяет объявлять свойства, которые будут храниться в списке динамических -свойств. +Позволяет объявлять свойства, которые будут видны в списке свойств. =cut