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)



Subject: sprintf method to return the profiling data instead [patch]
A small patch to add a `sprintf' method to return the profiling information instead of print it.
oops here is the patch itself
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.