Hello,

I've been using a logging module "LogFile.pm" introduced in the book;
「Network Programing With Perl」
ISBN:4894714655 (2002/12)
for a long time thanks to L.D.S., though in modified by myself.

Now when I call Archive::Tar:read, "IO::Zlib.pm" issues warning mesgs.
It can be off'ed by "undef $SIG{__????__}" temporarily, but I can't 
dertermine which CPAN modules must be treated as such.

Is there any good work-around?

<exec>
------------------------------------------------------------
C:>test_tar_ng.pl
(log_info called) start test_tar_ng.pl .....
(log_info called) SIG set ok
(log_info called) Archive::Tar new.
(log_info called) tar read, NOT clear SIG.
(log_die called) Not a GLOB reference at C:/Perl/lib/IO/Zlib.pm line 566.
(log_die called) Not a GLOB reference at C:/Perl/lib/IO/Zlib.pm line 566.
(log_die called) Not a GLOB reference at C:/Perl/lib/IO/Zlib.pm line 566.
(log_die called) Not a GLOB reference at C:/Perl/lib/IO/Zlib.pm line 566.
(log_die called) Not a GLOB reference at C:/Perl/lib/IO/Zlib.pm line 566.
(log_info called) list_files.
(log_info called) ok
(log_info called) list_files: 'A1.txt B1.txt C1.txt'

C:>test_tar_ok.pl
(log_info called) start test_tar_ok.pl .....
(log_info called) SIG set ok
(log_info called) Archive::Tar new.
(log_info called) tar read, clear SIG.
SIG restored.
(log_info called) list_files.
(log_info called) ok
(log_info called) list_files: 'A1.txt B1.txt C1.txt'

<test_tar_ng.pl>
------------------------------------------------------------
#!Perl
# test_tar_ng.pl
use strict;
use Archive::Tar;

log_info("start test_tar_ng.pl .....\n");

$SIG{__WARN__} = \&log_warn;
$SIG{__DIE__}  = \&log_die;
log_info("SIG set ok\n");

log_info("Archive::Tar new.\n");
my $tar = Archive::Tar->new();
log_info("tar read, NOT clear SIG.\n");
$tar->read('test1.tar.gz', 1);

log_info("list_files.\n");
my @files = $tar->list_files();
log_info("ok\n");

log_info("list_files: '@files'\n");
exit;

sub log_info {
  print "(log_info called) @_";
}
sub log_warn {
  print "(log_warn called) @_";
}
sub log_die {
  print "(log_die called) @_";
}

__END__


<test_tar_ok.pl>
------------------------------------------------------------
#!Perl
# test_tar_ok.pl
use strict;
use Archive::Tar;

log_info("start test_tar_ok.pl .....\n");

$SIG{__WARN__} = \&log_warn;
$SIG{__DIE__}  = \&log_die;
my $w = $SIG{__WARN__};
my $d = $SIG{__DIE__};
log_info("SIG set ok\n");

log_info("Archive::Tar new.\n");
my $tar = Archive::Tar->new();
log_info("tar read, clear SIG.\n");

undef $SIG{__WARN__};
undef $SIG{__DIE__};
$tar->read('test1.tar.gz', 1);
$SIG{__WARN__} = $w;
$SIG{__DIE__}  = $d;

print "SIG restored.\n";

log_info("list_files.\n");
my @files = $tar->list_files();
log_info("ok\n");

log_info("list_files: '@files'\n");
exit;

sub log_info {
  print "(log_info called) @_";
}
sub log_warn {
  print "(log_warn called) @_";
}
sub log_die {
  print "(log_die called) @_";
}

__END__

Regards,
Hirosi Taguti
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to