Subject: | one typo and some warnings |
'use warnings' spits a lot of messages, most of them related to the
"Data::CTable::length" method conflicting with CORE::length.
1 typo (this-warn(...) instead of this->warn(...)
and a few redefinition of variables.
Subject: | CTable-1.03.patch |
--- CTable.pm.bck 2004-11-11 15:01:41.000000000 +0100
+++ CTable.pm 2006-03-09 11:55:57.000000000 +0100
@@ -260,7 +260,7 @@
## Required dependencies
use IO::File;
-use Config; qw(%Config);
+use Config qw(%Config);
use Carp qw(croak carp confess cluck);
use Storable qw(store nstore retrieve dclone);
@@ -899,7 +899,7 @@
=cut
-{}; ## Get emacs to indent correctly.
+
sub new
{
@@ -2119,7 +2119,7 @@
=cut
-{}; ## Get emacs to indent correctly.
+
sub calc
{
@@ -2417,7 +2417,7 @@
=cut
-{}; ## Get emacs to indent correctly.
+
sub row
{
@@ -3278,7 +3278,7 @@
=cut
-{}; ## Get emacs to indent correctly.
+
sub select {my $this = shift; return($this->select_internal(!'Add', !'Not', @_))}
sub omit {my $this = shift; return($this->select_internal(!'Add', 'Not', @_))}
@@ -3311,7 +3311,7 @@
{
my ($Field, $Sub) = @Specs[$i++, $i++];
- next unless ((length($Field)) && (ref($Sub) eq 'CODE'));
+ next unless ((CORE::length($Field)) && (ref($Sub) eq 'CODE'));
## Create pseudo-fields _RecNum / _SelNum if needed, but at
## most once per invocation.
@@ -3482,7 +3482,7 @@
=cut
-{}; ## Get emacs to indent correctly.
+
sub sort
{
@@ -3523,7 +3523,7 @@
## Ensure that DefaultSortType has a reasonable value for which we
## have a sort routine.
- $DefaultSortType = 'String' unless (length($DefaultSortType) &&
+ $DefaultSortType = 'String' unless (CORE::length($DefaultSortType) &&
exists($SRoutines->{$DefaultSortType}));
## Ensure that DefaultSortDirection has a legal value (1 or -1;
@@ -3658,7 +3658,7 @@
=cut
-{}; ## Get emacs to indent correctly.
+
sub sortorder
{
@@ -3766,7 +3766,7 @@
=cut
-{}; ## Get emacs to indent correctly.
+
sub sortspecs
{
@@ -3800,7 +3800,7 @@
$this->{_SortSpecs}->{$FieldName} = $SortSpec if $SortSpec;
## Get and return.
- my $SortSpec = ($this->{_SortSpecs}->{$FieldName} ||
+ $SortSpec = ($this->{_SortSpecs}->{$FieldName} ||
$this->sortspec_default($FieldName));
## Provide defaults for needed fields of sort spec.
@@ -3848,7 +3848,7 @@
=cut
-{}; ## Get emacs to indent correctly.
+
sub sortdirection_default
{
@@ -3894,7 +3894,7 @@
=cut
-{}; ## Get emacs to indent correctly.
+
sub sorttype_default
{
@@ -4017,7 +4017,7 @@
=cut
-{}; ## Get emacs to indent correctly.
+
BEGIN
{
@@ -4253,7 +4253,7 @@
=cut
-{}; ## Get emacs to indent correctly.
+
BEGIN
{
@@ -4299,7 +4299,7 @@
$this->{_LineEnding} = $this->lineending_symbol($LineEnding) || $LineEnding if $LineEnding;
## Otherwise / either case, get whatever value we have and return it....
- my $LineEnding = $this->{_LineEnding};
+ $LineEnding = $this->{_LineEnding};
return($LineEnding);
}
@@ -4631,7 +4631,7 @@
$HeaderRow = 1 unless defined($HeaderRow);
## Default for ReturnEncoding is "\x0B" (control-K; ASCII 11)
- $ReturnEncoding = "\x0B" unless length($ReturnEncoding);
+ $ReturnEncoding = "\x0B" unless CORE::length($ReturnEncoding);
## Default for ReturnMap is true.
$ReturnMap = 1 unless defined($ReturnMap);
@@ -4684,7 +4684,7 @@
{
## Get the list of fields available in the file (first line of file).
- $_ = <$File> or
+ defined($_ = <$File>) or
$this->{_ErrorMsg} = "Could not find a first line with field names in $FileName.", goto done;
## Try to guess file delimiter from the header row if not yet specified.
@@ -4797,7 +4797,7 @@
s/^\"//; s/\"$//; ## Kill leading, trailing quotes surrounding each record
my @FieldVals =
map
- {if (length($_))
+ {if (CORE::length($_))
{
s/\"\"/\"/g; ## Restore Merge format's quoted double-quotes. ("" ==> ")
s/\000/$FDelimiter/g; ## Restore delimiters inside fields
@@ -4810,7 +4810,7 @@
## Put the data into the vectors
foreach (@$FieldNums)
{
- $FieldVectors->[$_]->[$RecordsRead] = $FieldVals[$_] if (length($FieldVals[$_]));
+ $FieldVectors->[$_]->[$RecordsRead] = $FieldVals[$_] if (CORE::length($FieldVals[$_]));
}
$RecordsRead++;
@@ -4955,7 +4955,7 @@
## If the cache file preflight failed, treat this as a regular
## read_file() without cacheing.
- return($this->read_file(%$Params)) unless length($CacheFileName);
+ return($this->read_file(%$Params)) unless CORE::length($CacheFileName);
## At this point we believe we'll either be able to read or write
## the cache file as needed.
@@ -4973,7 +4973,7 @@
{
$Data = &retrieve($CacheFileName);
};
- $this-warn("Cache restore from $CacheFileName failed: $!"), unlink($CacheFileName)
+ $this->warn("Cache restore from $CacheFileName failed: $!"), unlink($CacheFileName)
unless defined ($Data);
}
@@ -5456,10 +5456,10 @@
$LineEnding = $this->lineending_string($LineEnding);
## Default for LineEnding is "\n" (CR on Mac; LF on Unix; CR/LF on DOS)
- $LineEnding = "\n" unless length($LineEnding);
+ $LineEnding = "\n" unless CORE::length($LineEnding);
## Default for FDelimiter is comma
- $FDelimiter = ',' unless length($FDelimiter);
+ $FDelimiter = ',' unless CORE::length($FDelimiter);
## Default for HeaderRow is true.
$HeaderRow = 1 unless defined($HeaderRow);
@@ -5540,7 +5540,7 @@
my $GotHandle = ref($FileName) eq 'IO::File';
$this->{_ErrorMsg} = "FileName must be specified for write()", goto done
- unless $GotHandle or length($FileName);
+ unless $GotHandle or CORE::length($FileName);
## Default for FieldList is all fields.
$FieldList ||= $this->fieldlist();
@@ -5555,10 +5555,10 @@
$LineEnding = $this->lineending_string($LineEnding);
## Default for LineEnding is "\n" (CR on Mac; LF on Unix; CR/LF on DOS)
- $LineEnding = "\n" unless length($LineEnding);
+ $LineEnding = "\n" unless CORE::length($LineEnding);
## Default for FDelimiter is comma
- $FDelimiter = ',' unless length($FDelimiter);
+ $FDelimiter = ',' unless CORE::length($FDelimiter);
## Default for QuoteFields is undef (auto)
$QuoteFields = undef unless defined($QuoteFields);
@@ -5581,7 +5581,7 @@
$this->progress("Will convert upper-ascii characters if any, from ISO-8859-1 to Mac Roman.") if $DoMacMapping;
## Default for ReturnEncoding is "\x0B" (control-K; ASCII 11)
- $ReturnEncoding = "\x0B" unless length($ReturnEncoding);
+ $ReturnEncoding = "\x0B" unless CORE::length($ReturnEncoding);
## Default for HeaderRow is true.
$HeaderRow = 1 unless defined($HeaderRow);
@@ -5881,7 +5881,7 @@
$FieldList ||= $this->fieldlist();
$Selection ||= $this->selection();
$SortSpecs ||= {};
- $DefaultSortType = 'String' unless (length($DefaultSortType));
+ $DefaultSortType = 'String' unless (CORE::length($DefaultSortType));
$MaxRecords ||= 0; ## Default is no maximum (all records).
$MaxWidth ||= 15; ## Zero or undef means use default.
$MaxWidth = max(2, $MaxWidth); ## MaxWidth must not be less than 2
@@ -5914,7 +5914,7 @@
my $List = [map
{
## Truncate as needed.
- my $X = (length > $MaxWidth ?
+ my $X = (CORE::length > $MaxWidth ?
(substr($_, 0, ($MaxWidth - 1)) . '>') : $_);
## Encode returns, tabs as carets.
@@ -5935,7 +5935,7 @@
my $Data = [""]; ## Array to hold output from out() and put()
{
- local *{Data::ShowTable::out} = sub ## See sub out in ShowTable.pm
+ local *Data::ShowTable::out = sub ## See sub out in ShowTable.pm
{
my $fmt = shift;
$fmt .= "\n" unless $fmt =~ /\n$/;
@@ -5943,7 +5943,7 @@
push @$Data, "";
};
- local *{Data::ShowTable::put} = sub ## See sub put in ShowTable.pm
+ local *Data::ShowTable::put = sub ## See sub put in ShowTable.pm
{
my $fmt = shift();
$Data->[-1] .= sprintf($fmt, @_);
@@ -6188,7 +6188,7 @@
=cut
-{}; ## Get emacs to indent correctly.
+
sub append ## ($this, $OtherCTable)
{
@@ -7411,7 +7411,7 @@
=cut
-{}; ## Get emacs to indent correctly.
+
sub prep_cache_file
{
@@ -7435,7 +7435,7 @@
## separator (see: man File::Basename). If empty, we set it to
## $Cur (the current directory).
- my $FileDir = (length($Path) ? $Path : $Cur);
+ my $FileDir = (CORE::length($Path) ? $Path : $Cur);
## Ensure $CacheSubDir is either empty or has a trailing separator...
@@ -7632,7 +7632,7 @@
=cut
-{}; ## Get emacs to indent correctly.
+
sub guess_endings
{
@@ -7666,7 +7666,7 @@
## ending first since it contains the other two), if any, and we
## return it.
- my $Ending = ($Buf =~ /((\x0D\x0A)|(\x0D)|(\x0A))/)[0];
+ $Ending = ($Buf =~ /((\x0D\x0A)|(\x0D)|(\x0A))/)[0];
## &progress_default(undef, "DOS line endings") if $2; ## Debugging.
## &progress_default(undef, "Mac line endings") if $3; ## Debugging.