changeset 280:c6d0f889ef87

+IMPL::declare now supports meta attributes *bugfixes related to the typeof() operator
author cin
date Wed, 06 Feb 2013 02:15:48 +0400
parents af8af4b8337e
children a8dbddf491dd
files Lib/IMPL/Class/Meta.pm Lib/IMPL/DOM/Document.pm Lib/IMPL/DOM/Node.pm Lib/IMPL/Object/Abstract.pm Lib/IMPL/SQL/Schema/Constraint.pm Lib/IMPL/Web/Application/ControllerUnit.pm Lib/IMPL/Web/View/TTFactory.pm Lib/IMPL/declare.pm Lib/IMPL/lang.pm _test/Test/Web/View.pm
diffstat 10 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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) {
--- 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;
--- 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);
--- 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];
 }
 
--- 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 => [
--- 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 ],
--- 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,
     {
--- 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;
 
--- 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($) {
--- 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'
 };