[tmcode commit] r313 - spine/branches/spine_2_2-devel/lib/Spine

0 views
Skip to first unread message

oss...@gmail.com

unread,
Mar 30, 2010, 11:21:13 AM3/30/10
to tmcode...@googlegroups.com
Author: richard
Date: Tue Mar 30 08:21:13 2010
New Revision: 313

Log:
Fix NOHOOKS return Ticket #114

Modified:
spine/branches/spine_2_2-devel/lib/Spine/Constants.pm
spine/branches/spine_2_2-devel/lib/Spine/Registry.pm

Modified: spine/branches/spine_2_2-devel/lib/Spine/Constants.pm
==============================================================================
--- spine/branches/spine_2_2-devel/lib/Spine/Constants.pm Tue Mar 30 08:16:56 2010 (r312)
+++ spine/branches/spine_2_2-devel/lib/Spine/Constants.pm Tue Mar 30 08:21:13 2010 (r313)
@@ -37,6 +37,7 @@
PLUGIN_ERROR => 1 << 0,
PLUGIN_SUCCESS => 1 << 1,
PLUGIN_FINAL => 1 << 2,
+ PLUGIN_NOHOOKS => 1 << 3,
PLUGIN_EXIT => 1 << 31,
CHAIN_START => "__START",
CHAIN_MIDDLE => "__MIDDLE",
@@ -65,6 +66,7 @@
PLUGIN_STOP
PLUGIN_FINAL
PLUGIN_SUCCESS
+ PLUGIN_NOHOOKS
HOOK_START
HOOK_MIDDLE
HOOK_END)];
@@ -81,5 +83,17 @@
push @EXPORT_OK, @{$tmp};
$EXPORT_TAGS{basic} = $tmp;

+# core key names as constants so they are easy to alter
+# these keys have a well defined structure and are used across
+# multiple plugins, calls to these keys not using a constant
+# are bad.
+use constant {
+ SPINE_HIERARCHY_KEY => "c_hierarchy",
+ SPINE_OVERLAY_KEY => "overlay",
+};
+$tmp = [qw(SPINE_HIERARCHY_KEY SPINE_OVERLAY_KEY)];
+push @EXPORT_OK, @{$tmp};
+$EXPORT_TAGS{keys} = $tmp;
+

1;

Modified: spine/branches/spine_2_2-devel/lib/Spine/Registry.pm
==============================================================================
--- spine/branches/spine_2_2-devel/lib/Spine/Registry.pm Tue Mar 30 08:16:56 2010 (r312)
+++ spine/branches/spine_2_2-devel/lib/Spine/Registry.pm Tue Mar 30 08:21:13 2010 (r313)
@@ -1,3 +1,4 @@
+
# -*- mode: perl; cperl-continued-brace-offset: -4; indent-tabs-mode: nil; -*-
# vim:shiftwidth=2:tabstop=8:expandtab:textwidth=78:softtabstop=4:ai:

@@ -410,6 +411,7 @@
return push @{ $self->{parameters} }, @_;
}

+
# Wil normally register all plugins hooks based on profile.
# if a plugin name is passed then it will register it's hooks
sub register_hooks
@@ -479,6 +481,11 @@
{
return $_[0]->{hooks}->head;
}
+
+sub count
+{
+ return $_[0]->{hooks}->count();
+}

sub next
{
@@ -569,7 +576,11 @@
return PLUGIN_FATAL;
}

+ # catch no hooks and return NOHOOKS
+ return ([], PLUGIN_NOHOOKS, 0) unless $self->count();
+
my (@results, $rc);
+
foreach my $hook ($self->head()) {
$rc = $self->run_hook($hook, @_);

Reply all
Reply to author
Forward
0 new messages