This queue is for tickets about the DBIx-Profile CPAN distribution.

Report information
The Basics
Id:
738
Status:
new
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
ivan-cpan-rt [...] 420.am
Cc:
AdminCc:

BugTracker
Severity:
Wishlist
Broken in:
(no value)
Fixed in:
(no value)



MIME-Version: 1.0
X-Mailer: MIME-tools 5.405 (Entity 5.404)
Subject: sprintf method to return the profiling data instead [patch]
Content-Type: multipart/mixed; boundary="----------=_1023915474-4207-0"
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 98
A small patch to add a `sprintf' method to return the profiling information instead of print it.
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 0
MIME-Version: 1.0
X-Mailer: MIME-tools 5.405 (Entity 5.404)
Content-Type: multipart/mixed; boundary="----------=_1023915532-4207-3"
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 30
oops here is the patch itself
Content-Type: text/x-diff; name="sprintf.patch"
Content-Disposition: inline; filename="sprintf.patch"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 1080
diff -u DBIx-Profile-1.0/Profile.pm DBIx-Profile-1.0ivan1/Profile.pm --- DBIx-Profile-1.0/Profile.pm Tue Aug 29 14:41:21 2000 +++ DBIx-Profile-1.0ivan1/Profile.pm Sat Mar 17 10:52:51 2001 @@ -225,9 +225,16 @@ # JEFF - The printing and the print code is kinda (er... very) ugly! # +#like printProfile, except returns the results instead of printing them. +sub sprintProfile { + my $self = shift; + $self->printProfile({'sprint'=>1}); +} + sub printProfile { my $self = shift; + my $args = shift; my %result; my $total = 0; no integer; @@ -292,13 +299,18 @@ $result{$total} = $text; } # each query + my $results; foreach my $qry (sort stripsort keys %result) { - if ($DBIx::Profile::DBIXFILE eq "" ) { + if ( $args->{'sprint'} ) { + $results .= $result{$qry} . "\n"; + } elsif ($DBIx::Profile::DBIXFILE eq "" ) { warn $result{$qry} . "\n"; } else { print $DBIx::Profile::DBIXFILEHANDLE $result{$qry} . "\n"; } } + + return $results if $args->{'sprint'}; } sub stripsort {


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.