Update of /cvsroot/mhonarc/mhonarc/MHonArc/lib
In directory subversions:/tmp/cvs-serv20011
Modified Files:
mhfile.pl
Log Message:
+ Added use of Symbol module to generate symbols for file handles to
replace old symbolic technique that is left-over from Perl 4 days.
* Removed uses of local(), where applicable, and replaced with my().
Index: mhfile.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhfile.pl,v
retrieving revision 2.5
retrieving revision 2.6
diff -C2 -r2.5 -r2.6
*** mhfile.pl 17 Sep 2001 16:09:37 -0000 2.5
--- mhfile.pl 14 May 2002 00:04:40 -0000 2.6
***************
*** 28,37 ****
package mhonarc;
##---------------------------------------------------------------------------##
sub file_open {
! local($file) = shift;
! local($handle) = q/mhonarc::FOPEN/ . ++$_fo_cnt;
! local($gz) = $file =~ /\.gz$/i;
if ($gz) {
--- 28,39 ----
package mhonarc;
+ use Symbol;
+
##---------------------------------------------------------------------------##
sub file_open {
! my($file) = shift;
! my($handle) = gensym;
! my($gz) = $file =~ /\.gz$/i;
if ($gz) {
***************
*** 48,54 ****
sub file_create {
! local($file) = shift;
! local($gz) = shift;
! local($handle) = q/mhonarc::FCREAT/ . ++$_fc_cnt;
if ($gz) {
--- 50,56 ----
sub file_create {
! my($file) = shift;
! my($gz) = shift;
! my($handle) = gensym;
if ($gz) {
***************
*** 66,71 ****
sub file_copy {
! local($src, $dst) = ($_[0], $_[1]);
! local($gz) = $src =~ /\.gz$/i;
if ($gz || (-e "$src.gz")) {
--- 68,73 ----
sub file_copy {
! my($src, $dst) = ($_[0], $_[1]);
! my($gz) = $src =~ /\.gz$/i;
if ($gz || (-e "$src.gz")) {
***************
*** 77,82 ****
sub file_rename {
! local($src, $dst) = ($_[0], $_[1]);
! local($gz) = $src =~ /\.gz$/i;
if ($gz || (-e "$src.gz")) {
--- 79,84 ----
sub file_rename {
! my($src, $dst) = ($_[0], $_[1]);
! my($gz) = $src =~ /\.gz$/i;
if ($gz || (-e "$src.gz")) {
***************
*** 90,94 ****
sub file_remove {
! local($file) = shift;
unlink($file);
--- 92,96 ----
sub file_remove {
! my($file) = shift;
unlink($file);
***************
*** 97,102 ****
sub file_utime {
! local($atime) = shift;
! local($mtime) = shift;
foreach (@_) {
utime($atime, $mtime, $_, "$_.gz");
--- 99,104 ----
sub file_utime {
! my($atime) = shift;
! my($mtime) = shift;
foreach (@_) {
utime($atime, $mtime, $_, "$_.gz");
***************
*** 107,123 ****
sub dir_remove {
! local($file) = shift;
if (-d $file) {
! local(@files) = ();
!
if (!opendir(DIR, $file)) {
warn qq{Warning: Unable to open "$file"\n};
return 0;
}
! @files = grep(!/^(\.|\..)$/i, readdir(DIR));
closedir(DIR);
foreach (@files) {
! &dir_remove($file . $mhonarc'DIRSEP . $_);
}
if (!rmdir($file)) {
--- 109,125 ----
sub dir_remove {
! my($file) = shift;
if (-d $file) {
! local(*DIR);
! local($_);
if (!opendir(DIR, $file)) {
warn qq{Warning: Unable to open "$file"\n};
return 0;
}
! my @files = grep(!/^(\.|\..)$/i, readdir(DIR));
closedir(DIR);
foreach (@files) {
! &dir_remove($file . $mhonarc::DIRSEP . $_);
}
if (!rmdir($file)) {
---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV