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 {