Mail-POP3
view release on metacpan or search on metacpan
lib/Mail/POP3/Folder/mbox.pm view on Meta::CPAN
return if -f $lockfile;
$self->{LINE} = 0;
$self->{LOCK_FH} = IO::File->new(
">$lockfile"
) or die "open >$lockfile: $!\n";
unless (flock $self->{LOCK_FH}, LOCK_EX|LOCK_NB) {
unlink $lockfile;
return;
}
chmod 0600, $lockfile;
chown $self->{CLIENT_USER_ID}, $self->{MAILGROUP}, $lockfile;
my $oldfh = select $self->{LOCK_FH};
$| = 1;
select $oldfh;
$self->_lock_refresh;
# stat the file to get its size, this is checked before closing
# the mailbox.
# If the size has changed the lock may have been compromised, so a
# backup is then made.
my @filestat = stat $self->_spoolfile;
$self->{MAILBOX_TIMESTAMP_OPEN} = $filestat[9];
lib/Mail/POP3/Server.pm view on Meta::CPAN
if (!-d $self->{CONFIG}->{user_log_dir}) {
mkdir $self->{CONFIG}->{user_log_dir};
chmod 01777, $self->{CONFIG}->{user_log_dir};
}
my $logfile = "$self->{CONFIG}->{user_log_dir}/${user_name}_log";
$self->{USERLOG_FH} = IO::File->new(
">>$logfile"
);
eval {
# in case we're on Windoze...
chown((getpwnam $self->{CLIENT_USERNAME})[2], $logfile);
chmod 0600, $logfile;
};
$self->log_user_entry("CONNECTION OPENED");
}
=head2 log_user_close
=cut
sub log_user_close {
lib/Mail/POP3/Server.pm view on Meta::CPAN
return unless defined $self->{CONFIG}->{debug_log};
$> = 0;
unless ($self->{DEBUG_FH}) {
my ($debuglog_dir) = $self->{CONFIG}->{debug_log} =~ /^(.+)\//;
if (!-d $debuglog_dir) {
mkdir $debuglog_dir, 0700;
}
$self->{DEBUG_FH} = IO::File->new(">>$self->{CONFIG}->{debug_log}")
or die "open >>$self->{CONFIG}->{debug_log}: $!\n";
my $gid = $^O =~ /MSWin32/ ? 0 : getgrnam("root");
chown 0, $gid, $self->{CONFIG}->{debug_log};
chmod 0600, $self->{CONFIG}->{debug_log};
}
my $logtime = localtime(time);
$self->{DEBUG_FH}->print("$error\t$logtime\n");
$> = $self->{CLIENT_USER_ID} if $self->{CLIENT_USER_ID};
}
=head2 shutdown
Clean up and exit
( run in 1.845 second using v1.01-cache-2.11-cpan-71847e10f99 )