# HG changeset patch # User cin # Date 1360102548 -14400 # Node ID c6d0f889ef8788e5523f62fe88920126b71f1ba1 # Parent af8af4b8337e1b7567de09d9c08aa9a49b0a5673 +IMPL::declare now supports meta attributes *bugfixes related to the typeof() operator diff -r af8af4b8337e -r c6d0f889ef87 Lib/IMPL/Class/Meta.pm --- a/Lib/IMPL/Class/Meta.pm Mon Feb 04 17:16:45 2013 +0400 +++ b/Lib/IMPL/Class/Meta.pm Wed Feb 06 02:15:48 2013 +0400 @@ -29,7 +29,7 @@ my @result; if ($deep) { - @result = map { $_->can('get_meta') ? $_->get_meta($meta_class,$predicate,$deep) : () } @{$class.'::ISA'}; + @result = map { $_->can('GetMeta') ? $_->GetMeta($meta_class,$predicate,$deep) : () } @{$class.'::ISA'}; } if ($predicate) { diff -r af8af4b8337e -r c6d0f889ef87 Lib/IMPL/DOM/Document.pm --- a/Lib/IMPL/DOM/Document.pm Mon Feb 04 17:16:45 2013 +0400 +++ b/Lib/IMPL/DOM/Document.pm Wed Feb 06 02:15:48 2013 +0400 @@ -2,6 +2,7 @@ use strict; use warnings; +use IMPL::lang; use parent qw(IMPL::DOM::Node); __PACKAGE__->PassThroughArgs; diff -r af8af4b8337e -r c6d0f889ef87 Lib/IMPL/DOM/Node.pm --- a/Lib/IMPL/DOM/Node.pm Mon Feb 04 17:16:45 2013 +0400 +++ b/Lib/IMPL/DOM/Node.pm Wed Feb 06 02:15:48 2013 +0400 @@ -4,6 +4,7 @@ use parent qw(IMPL::Object); +use IMPL::lang; use IMPL::Object::List; use IMPL::Class::Property; use Scalar::Util qw(weaken); diff -r af8af4b8337e -r c6d0f889ef87 Lib/IMPL/Object/Abstract.pm --- a/Lib/IMPL/Object/Abstract.pm Mon Feb 04 17:16:45 2013 +0400 +++ b/Lib/IMPL/Object/Abstract.pm Wed Feb 06 02:15:48 2013 +0400 @@ -113,7 +113,7 @@ return (ref $self || $self); } -sub typeof { +sub _typeof { ref $_[0] || $_[0]; } diff -r af8af4b8337e -r c6d0f889ef87 Lib/IMPL/SQL/Schema/Constraint.pm --- a/Lib/IMPL/SQL/Schema/Constraint.pm Mon Feb 04 17:16:45 2013 +0400 +++ b/Lib/IMPL/SQL/Schema/Constraint.pm Wed Feb 06 02:15:48 2013 +0400 @@ -2,7 +2,7 @@ use strict; use warnings; -use IMPL::lang qw(is isclass); +use IMPL::lang; use IMPL::Const qw(:prop); use IMPL::declare { base => [ diff -r af8af4b8337e -r c6d0f889ef87 Lib/IMPL/Web/Application/ControllerUnit.pm --- a/Lib/IMPL/Web/Application/ControllerUnit.pm Mon Feb 04 17:16:45 2013 +0400 +++ b/Lib/IMPL/Web/Application/ControllerUnit.pm Wed Feb 06 02:15:48 2013 +0400 @@ -239,7 +239,7 @@ my $methods = $this->class_data(CONTROLLER_METHODS); my $namespace = $this->unitNamespace; - (my $module = typeof $this) =~ s/^$namespace//; + (my $module = typeof($this)) =~ s/^$namespace//; my %smd = ( module => [grep $_, split /::/, $module ], diff -r af8af4b8337e -r c6d0f889ef87 Lib/IMPL/Web/View/TTFactory.pm --- a/Lib/IMPL/Web/View/TTFactory.pm Mon Feb 04 17:16:45 2013 +0400 +++ b/Lib/IMPL/Web/View/TTFactory.pm Wed Feb 06 02:15:48 2013 +0400 @@ -113,7 +113,7 @@ =begin code my $factory = new IMPL::Web::View::TTFactory( - typeof IMPL::Web::View::TTControl, + 'IMPL::Web::View::TTControl', $doc, $context, { diff -r af8af4b8337e -r c6d0f889ef87 Lib/IMPL/declare.pm --- a/Lib/IMPL/declare.pm Mon Feb 04 17:16:45 2013 +0400 +++ b/Lib/IMPL/declare.pm Wed Feb 06 02:15:48 2013 +0400 @@ -20,6 +20,7 @@ die "A hash reference is required" unless ref $args eq 'HASH'; no strict 'refs'; + no warnings 'once'; my $caller = caller; diff -r af8af4b8337e -r c6d0f889ef87 Lib/IMPL/lang.pm --- a/Lib/IMPL/lang.pm Mon Feb 04 17:16:45 2013 +0400 +++ b/Lib/IMPL/lang.pm Wed Feb 06 02:15:48 2013 +0400 @@ -6,6 +6,7 @@ use IMPL::_core::version; use IMPL::clone qw(clone); use Scalar::Util qw(blessed); +use Carp qw(carp); our @EXPORT = qw(&is &isclass &typeof); our %EXPORT_TAGS = ( @@ -64,15 +65,17 @@ use IMPL::Const qw(:all); sub is($$) { + carp "A typename can't be undefined" unless $_[1]; eval {ref $_[0] and $_[0]->isa( $_[1] ) }; } sub isclass { + carp "A typename can't be undefined" unless $_[1]; eval {not ref $_[0] and $_[0]->isa( $_[1] ) }; } sub typeof(*) { - eval { $_[0]->typeof } || blessed($_[0]); + eval { $_[0]->_typeof } || blessed($_[0]) || ref($_[0]) || $_[0]; } sub public($) { diff -r af8af4b8337e -r c6d0f889ef87 _test/Test/Web/View.pm --- a/_test/Test/Web/View.pm Mon Feb 04 17:16:45 2013 +0400 +++ b/_test/Test/Web/View.pm Wed Feb 06 02:15:48 2013 +0400 @@ -10,11 +10,12 @@ use File::Slurp; use Scalar::Util qw(weaken); +use IMPL::lang; use IMPL::Test qw(assert test GetCallerSourceLine); use IMPL::Web::View::TTLoader(); use constant { - TTLoader => typeof IMPL::Web::View::TTLoader, + TTLoader => 'IMPL::Web::View::TTLoader', MProfiler => 'IMPL::Profiler::Memory' };