Linux cpanel2.daytoncreative.net 2.6.32-754.29.2.el6.x86_64 #1 SMP Tue May 12 17:39:04 UTC 2020 x86_64
Apache/2.4.43 (cPanel) OpenSSL/1.1.1g mod_bwlimited/1.4
Server IP : 70.62.220.67 & Your IP : 216.73.216.193
Domains :
Cant Read [ /etc/named.conf ]
User : michaelgreg
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
log /
perl-5.20.2 /
cpan /
Pod-Checker /
t /
pod /
Delete
Unzip
Name
Size
Permission
Date
Action
contains_bad_pod.xr
31
B
-r--r--r--
2014-12-27 11:48
empty.xr
0
B
-r--r--r--
2014-12-27 11:48
podchkenc.t
570
B
-r--r--r--
2014-12-27 11:48
podchkenc.xr
74
B
-r--r--r--
2014-12-27 11:48
poderrs.t
3.56
KB
-r--r--r--
2014-12-27 11:48
poderrs.xr
4.18
KB
-r--r--r--
2014-12-27 11:48
selfcheck.t
1.09
KB
-r--r--r--
2014-12-27 11:48
testcmp.pl
2.76
KB
-r--r--r--
2014-12-27 11:48
testpchk.pl
3.58
KB
-r--r--r--
2014-12-27 11:48
Save
Rename
package TestCompare; use vars qw(@ISA @EXPORT $MYPKG); #use strict; #use diagnostics; use Carp; use Exporter; use File::Basename; use File::Spec; use FileHandle; @ISA = qw(Exporter); @EXPORT = qw(&testcmp); $MYPKG = eval { (caller)[0] }; ##-------------------------------------------------------------------------- =head1 NAME testcmp -- compare two files line-by-line =head1 SYNOPSIS $is_diff = testcmp($file1, $file2); or $is_diff = testcmp({-cmplines => \&mycmp}, $file1, $file2); =head2 DESCRIPTION Compare two text files line-by-line and return 0 if they are the same, 1 if they differ. Each of $file1 and $file2 may be a filenames, or a filehandles (in which case it must already be open for reading). If the first argument is a hashref, then the B<-cmplines> key in the hash may have a subroutine reference as its corresponding value. The referenced user-defined subroutine should be a line-comparator function that takes two pre-chomped text-lines as its arguments (the first is from $file1 and the second is from $file2). It should return 0 if it considers the two lines equivalent, and non-zero otherwise. =cut ##-------------------------------------------------------------------------- sub testcmp( $ $ ; $) { my %opts = ref($_[0]) eq 'HASH' ? %{shift()} : (); my ($file1, $file2) = @_; my ($fh1, $fh2) = ($file1, $file2); unless (ref $fh1) { $fh1 = FileHandle->new($file1, "r") or die "Can't open $file1: $!"; } unless (ref $fh2) { $fh2 = FileHandle->new($file2, "r") or die "Can't open $file2: $!"; } my $cmplines = $opts{'-cmplines'} || undef; my ($f1text, $f2text) = ("", ""); my ($line, $diffs) = (0, 0); while ( defined($f1text) and defined($f2text) ) { defined($f1text = <$fh1>) and chomp($f1text); defined($f2text = <$fh2>) and chomp($f2text); ++$line; last unless ( defined($f1text) and defined($f2text) ); # kill any extra line endings $f1text =~ s/[\r\n]+$//s; $f2text =~ s/[\r\n]+$//s; $diffs = (ref $cmplines) ? &$cmplines($f1text, $f2text) : ($f1text ne $f2text); last if $diffs; } close($fh1) unless (ref $file1); close($fh2) unless (ref $file2); $diffs = 1 if (defined($f1text) or defined($f2text)); if ( defined($f1text) and defined($f2text) ) { ## these two lines must be different warn "$file1 and $file2 differ at line $line\n"; } elsif (defined($f1text) and (! defined($f1text))) { ## file1 must be shorter warn "$file1 is shorter than $file2\n"; } elsif (defined $f2text) { ## file2 must be longer warn "$file1 is shorter than $file2\n"; } return $diffs; } 1;