Author: timbo
Date: Sat Sep 30 02:19:33 2006
New Revision: 7862

Modified:
   dbi/trunk/Changes
   dbi/trunk/MANIFEST
   dbi/trunk/dumpmethods.pl
   dbi/trunk/lib/DBI/Profile.pm
   dbi/trunk/lib/DBI/ProfileSubs.pm

Log:
Added some more docs to DBI::Profile and DBI::ProfileSubs.
Tweaked dumpmethods.pl utility.


Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Sat Sep 30 02:19:33 2006
@@ -4,11 +4,10 @@
 
 =cut
 
-XXX update docs for Profile &subname magic Path elements
-
 =head2 Changes in DBI 1.53 (svn rev XXX),   XXX 2006
 
   Fixed checks for weaken to work with early 5.8.x versions
+  Fixed DBD::Proxy handling of some methods, including commit and rollback.
 
   Added array context support to execute_array and execute_for_fetch
     methods which returns executed tuples and rows affected.

Modified: dbi/trunk/MANIFEST
==============================================================================
--- dbi/trunk/MANIFEST  (original)
+++ dbi/trunk/MANIFEST  Sat Sep 30 02:19:33 2006
@@ -69,5 +69,5 @@
 t/72childhandles.t
 t/80proxy.t
 t/pod.t
-test.pl                                A very simple test harness using 
ExampleP.pm
+test.pl                        Assorted informal tests, including tests for 
memory leaks
 typemap

Modified: dbi/trunk/dumpmethods.pl
==============================================================================
--- dbi/trunk/dumpmethods.pl    (original)
+++ dbi/trunk/dumpmethods.pl    Sat Sep 30 02:19:33 2006
@@ -13,7 +13,6 @@
 my %ima_n2v = map { /^(IMA_.*)/ ? ($1=>&$_) : () } @ima_n;
 warn Dumper \%ima_n2v;
 my %ima_v2n = reverse %ima_n2v;    
-my @ima_a   = map { $ima_v2a{1<<$_} || "b".($_+1) } 0..31;
 
 my @bit2hex_bitkeys = map { 1<<$_ } 0..31;
 my @bit2hex_bitvals = map { sprintf("%s", $ima_v2n{$_}||'') } @bit2hex_bitkeys;
@@ -21,6 +20,11 @@
 my @bit2hex_values = ("0x00000000", @bit2hex_bitvals);
 
 #warn Dumper \%DBI::DBI_methods;
+for (0..31) {
+    my $bit = 1 << $_;
+    my @ima_flags = map { ($bit & $_) ? $bit2hex{$_} : () } @bit2hex_bitkeys;
+    printf "%20s => %04x\n", "@ima_flags", $bit;
+}
 
 while ( my ($class, $meths) = each %DBI::DBI_methods ) {
 
@@ -37,7 +41,7 @@
         my $O = $info->{O}||0;
         my @ima_flags = map { ($O & $_) ? $bit2hex{$_} : () } @bit2hex_bitkeys;
 
-        print "\$h->$fullmeth($proto)  @ima_flags\n";
+        printf "\$h->$fullmeth($proto)  @ima_flags # 0x%04x\n", $O;
     }
 }   
 

Modified: dbi/trunk/lib/DBI/Profile.pm
==============================================================================
--- dbi/trunk/lib/DBI/Profile.pm        (original)
+++ dbi/trunk/lib/DBI/Profile.pm        Sat Sep 30 02:19:33 2006
@@ -285,11 +285,27 @@
 
 =item Code Reference
 
-Not yet implemented.
+The subroutine is passed the handle it was called on and the DBI method name.
+The current Statement is in $_. The statement string should not be modified,
+so most subs start with C<local $_ = $_;>.
 
-The subroutine is passed the DBI method name and the handle it was called on.
-It should return a list of values to used at this point in the Path.  If it
-returns an empty list then the method call is not profiled.
+The list of values it returns is used at that point in the Profile Path.
+
+The sub can 'veto' (reject) a profile sample by including a reference to undef
+in the returned list. That can be useful when you want to only profile
+statements that match a certain pattern, or only profile certain methods.
+
+=item Subroutine Specifier
+
+A Path element that begins with 'C<&>' is treated as the name of a subroutine
+in the DBI::ProfileSubs namespace and replaced with the corresponding code 
reference.
+
+Currently this only works when the Path is specified by the C<DBI_PROFILE>
+environment variable.
+
+Also, currently, the only subroutine in the DBI::ProfileSubs namespace is
+C<'&norm_std_n3'>. That's a very handy subroutine when profiling code that
+doesn't use placeholders. See L<DBI::ProfileSubs> for more information.
 
 =item Attribute Specifier
 

Modified: dbi/trunk/lib/DBI/ProfileSubs.pm
==============================================================================
--- dbi/trunk/lib/DBI/ProfileSubs.pm    (original)
+++ dbi/trunk/lib/DBI/ProfileSubs.pm    Sat Sep 30 02:19:33 2006
@@ -6,10 +6,14 @@
 
 =head1 SYNOPSIS
 
-  DBI_PROFILE='& prog.pl
+  DBI_PROFILE='&norm_std_n3' prog.pl
 
 This is new and still experimental.
 
+=head1 TO DO
+
+Define come kind of naming convention for the subs.
+
 =cut
 
 use strict;
@@ -18,6 +22,8 @@
 
 # would be good to refactor these regex into separate subs or find some other
 # way to compose them in various combinations into multiple subs
+# The final subs always been to be vert fast.
+# 
 
 sub norm_std_n3 {
     # my ($h, $method_name) = @_;

Reply via email to