[Jifty-commit] r5391 - Runops-Hook/trunk/lib/Runops

Jifty commits jifty-commit at lists.jifty.org
Wed May 7 14:16:15 EDT 2008


Author: nothingmuch
Date: Wed May  7 14:16:15 2008
New Revision: 5391

Modified:
   Runops-Hook/trunk/lib/Runops/Hook.pm

Log:
boilerplate

Modified: Runops-Hook/trunk/lib/Runops/Hook.pm
==============================================================================
--- Runops-Hook/trunk/lib/Runops/Hook.pm	(original)
+++ Runops-Hook/trunk/lib/Runops/Hook.pm	Wed May  7 14:16:15 2008
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.01';
+our $VERSION = '0.02';
 
 use DynaLoader ();
 our @ISA = qw(DynaLoader);
@@ -26,10 +26,29 @@
 
 =head1 NAME
 
-Runops::Hook - C level hooking of the runloop
+Runops::Hook - Hook the runloop to a C or Perl callback
 
 =head1 SYNOPSIS
 
+	use Runops::Hook;
+
+	Runops::Hook::set_hook(sub {
+		my ( $hook, $op, $arity, @args ) = @_;
+		# $hook is the hook coderef
+		# $op is the B::OP object representing PL_op
+		# $arity is a value describing what to expect in @args
+		# @args are the arguments to the operator passed by scalar reference
+	});
+
+	Runops::Hook::enable();
+
+	# code from here on is traced
+
+	Runops::Hook::disable(); # tracing stops just after entersub for 'disable' itself
+
+If you are concerned about your callback's performance you can register a C
+callback too.
+
 	# in MyHook.xs
 	bool
 	my_hook (pTHX) {
@@ -46,6 +65,13 @@
 		Runops_Hook_set_hook(my_hook);
 		Runops_Hook_enable();
 
+=head1 STATUS
+
+This is still very much experimental and in need of usability improvements,
+docs, tests, etc.
+
+It's released for amusement/embarrassment purposes only ;-)
+
 =head1 HOOKS
 
 The runloop has a global boolean, C<Runops_Hook_enabled>. When unset, the


More information about the Jifty-commit mailing list