use DXProtout;
use DXDebug;
use DXLog;
-use FileHandle;
+use IO::File;
+use Fcntl;
use Carp;
use strict;
keep => '0,Keep this?,yesno',
);
+sub DESTROY
+{
+ my $self = shift;
+ undef $self->{lines};
+ undef $self->{gotit};
+}
+
# allocate a new object
# called fromnode, tonode, from, to, datetime, private?, subject, nolinesper
sub alloc
$f[3] =~ s/^\///o; # remove the leading /
$f[3] = lc $f[3]; # to lower case;
dbg('msg', "incoming file $f[3]\n");
- last SWITCH if $f[3] =~ /^(perl|cmd|local|src|lib|include|sys|msg|connect)/; # prevent access to executables
+ $f[3] = 'packclus/' . $f[3] unless $f[3] =~ /^packclus\//o;
# create any directories
my @part = split /\//, $f[3];
if ($ref->{file}) { # a file
dbg('msg', "To be stored in $ref->{to}\n");
- my $fh = new FileHandle "$ref->{to}", "w";
+ my $fh = new IO::File "$ref->{to}", "w";
if (defined $fh) {
my $line;
foreach $line (@{$lines}) {
dbg('msg', "To be stored in $fn\n");
# now save the file, overwriting what's there, YES I KNOW OK! (I will change it if it's a problem)
- my $fh = new FileHandle "$fn", "w";
+ my $fh = new IO::File "$fn", "w";
if (defined $fh) {
my $rr = $ref->{rrreq} ? '1' : '0';
my $priv = $ref->{private} ? '1': '0';
my @f;
my $size;
- $file = new FileHandle;
+ $file = new IO::File;
if (!open($file, $fn)) {
print "Error reading $fn $!\n";
return undef;
my $fn = filename($msgno);
my @out;
- $file = new FileHandle;
+ $file = new IO::File;
if (!open($file, $fn)) {
print "Error reading $fn $!\n";
return undef;
my $fn = "$msgdir/$name";
my $msgno;
- my $fh = new FileHandle;
+ my $fh = new IO::File;
if (sysopen($fh, $fn, O_RDWR|O_CREAT, 0666)) {
$fh->autoflush(1);
$msgno = $fh->getline;
# initialise the message 'system', read in all the message headers
sub init
{
- my $dir = new FileHandle;
+ my $dir = new IO::File;
my @dir;
my $ref;