remove WebGUI::Utility::makeArrayTabSafe
This commit is contained in:
parent
41201e5c4f
commit
55bd411e2c
3 changed files with 16 additions and 32 deletions
|
|
@ -759,12 +759,24 @@ sub quickTab {
|
|||
my $self = shift;
|
||||
my $sql = shift;
|
||||
my $params = shift;
|
||||
|
||||
my $sth = $self->prepare($sql);
|
||||
$sth->execute(@{$params});
|
||||
my $output = join("\t", $sth->getColumnNames) . "\n";
|
||||
|
||||
my $csv = Text::CSV_XS->new({
|
||||
eol => "\n",
|
||||
quote_char => undef,
|
||||
escape_char => undef,
|
||||
sep_char => "\t",
|
||||
});
|
||||
|
||||
return undef
|
||||
unless $csv->combine($sth->getColumnNames);
|
||||
|
||||
my $output = $csv->string;
|
||||
while (my @data = $sth->fetchrow_array) {
|
||||
WebGUI::Utility::makeArrayTabSafe(\@data);
|
||||
$output .= join("\t", @data) . "\n";
|
||||
return undef unless $csv->combine(@data);
|
||||
$output .= $csv->string;
|
||||
}
|
||||
$sth->finish;
|
||||
return $output;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use Tie::IxHash;
|
|||
use Net::CIDR::Lite;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&makeTabSafe &makeArrayTabSafe &randomizeHash &randomizeArray &isInSubnet
|
||||
our @EXPORT = qw(&makeTabSafe &randomizeHash &randomizeArray &isInSubnet
|
||||
&sortHashDescending &sortHash &isIn &makeCommaSafe &randint &round &scalarEquals
|
||||
);
|
||||
|
||||
|
|
@ -40,7 +40,6 @@ This package provides miscellaneous but useful utilities to the WebGUI programme
|
|||
use WebGUI::Utility;
|
||||
$boolean = isIn($value, @array);
|
||||
$boolean = isInSubnet($ip, \@subnets);
|
||||
makeArrayTabSafe(\@array);
|
||||
$string = makeCommaSafe($string);
|
||||
$string = makeTabSafe($string);
|
||||
$integer = randint($low,$high);
|
||||
|
|
@ -122,24 +121,6 @@ sub isInSubnet {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 makeArrayTabSafe ( array )
|
||||
|
||||
Searches through an array looking for tabs and replaces them with four spaces. Also replaces carriage returns with a space. This is useful for exporting tab separated data.
|
||||
|
||||
=head3 array
|
||||
|
||||
A reference to the array to look through. The array itself is modified, rather than
|
||||
returning useful data.
|
||||
|
||||
=cut
|
||||
|
||||
sub makeArrayTabSafe {
|
||||
my $array = $_[0];
|
||||
$_ = makeTabSafe($_) for @$array;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 makeCommaSafe ( text )
|
||||
|
||||
Replaces commas with semi-colons and carriage returns with spaces.
|
||||
|
|
|
|||
|
|
@ -51,15 +51,6 @@ is(
|
|||
'makeCommaSafe(): clearing tabs, newlines and carriage returns'
|
||||
);
|
||||
|
||||
# makeArrayTabSafe -- modifies an array in place
|
||||
my $tabbedArray = ["this\tthat", "these\nthose"];
|
||||
WebGUI::Utility::makeArrayTabSafe($tabbedArray);
|
||||
cmp_deeply(
|
||||
$tabbedArray,
|
||||
["this that", "these those"],
|
||||
'makeArrayTabSafe'
|
||||
);
|
||||
|
||||
# randint
|
||||
my $number = WebGUI::Utility::randint(50,75);
|
||||
ok($number >= 50 && $number <= 75, 'randint()');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue