r5827 - in /packages/libemail-localdelivery-perl/trunk: Changes MANIFEST META.yml debian/changelog debian/patches/10mbox-locking.dpatch lib/Email/LocalDelivery.pm lib/Email/LocalDelivery/Maildir.pm lib/Email/LocalDelivery/Mbox.pm t/test_mbox
gregoa-guest at users.alioth.debian.org
gregoa-guest at users.alioth.debian.org
Sun Jul 15 14:55:52 UTC 2007
Author: gregoa-guest
Date: Sun Jul 15 14:55:52 2007
New Revision: 5827
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=5827
Log:
* New upstream release.
* Adapt patch 10mbox-locking accordingly.
Removed:
packages/libemail-localdelivery-perl/trunk/t/test_mbox
Modified:
packages/libemail-localdelivery-perl/trunk/Changes
packages/libemail-localdelivery-perl/trunk/MANIFEST
packages/libemail-localdelivery-perl/trunk/META.yml
packages/libemail-localdelivery-perl/trunk/debian/changelog
packages/libemail-localdelivery-perl/trunk/debian/patches/10mbox-locking.dpatch
packages/libemail-localdelivery-perl/trunk/lib/Email/LocalDelivery.pm
packages/libemail-localdelivery-perl/trunk/lib/Email/LocalDelivery/Maildir.pm
packages/libemail-localdelivery-perl/trunk/lib/Email/LocalDelivery/Mbox.pm
Modified: packages/libemail-localdelivery-perl/trunk/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-localdelivery-perl/trunk/Changes?rev=5827&op=diff
==============================================================================
--- packages/libemail-localdelivery-perl/trunk/Changes (original)
+++ packages/libemail-localdelivery-perl/trunk/Changes Sun Jul 15 14:55:52 2007
@@ -1,3 +1,9 @@
+0.217 2007-06-22
+ remove dross test file from dist
+
+0.216 2007-06-22
+ allow Maildir deliveries to be streamed to disk
+
0.215 2007-04-15
mbox is /From / not /From\s/ (rt 26373 from Simon Law)
Modified: packages/libemail-localdelivery-perl/trunk/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-localdelivery-perl/trunk/MANIFEST?rev=5827&op=diff
==============================================================================
--- packages/libemail-localdelivery-perl/trunk/MANIFEST (original)
+++ packages/libemail-localdelivery-perl/trunk/MANIFEST Sun Jul 15 14:55:52 2007
@@ -10,5 +10,4 @@
t/mbox.t
t/pod.t
t/pod-coverage.t
-t/test_mbox
LICENSE
Modified: packages/libemail-localdelivery-perl/trunk/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-localdelivery-perl/trunk/META.yml?rev=5827&op=diff
==============================================================================
--- packages/libemail-localdelivery-perl/trunk/META.yml (original)
+++ packages/libemail-localdelivery-perl/trunk/META.yml Sun Jul 15 14:55:52 2007
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Email-LocalDelivery
-version: 0.215
+version: 0.217
abstract: ~
license: perl
generated_by: ExtUtils::MakeMaker version 6.32
Modified: packages/libemail-localdelivery-perl/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-localdelivery-perl/trunk/debian/changelog?rev=5827&op=diff
==============================================================================
--- packages/libemail-localdelivery-perl/trunk/debian/changelog (original)
+++ packages/libemail-localdelivery-perl/trunk/debian/changelog Sun Jul 15 14:55:52 2007
@@ -1,3 +1,10 @@
+libemail-localdelivery-perl (0.217-1) unstable; urgency=low
+
+ * New upstream release.
+ * Adapt patch 10mbox-locking accordingly.
+
+ -- gregor herrmann <gregor+debian at comodo.priv.at> Sun, 15 Jul 2007 16:53:49 +0200
+
libemail-localdelivery-perl (0.215-1) unstable; urgency=low
* New upstream release
Modified: packages/libemail-localdelivery-perl/trunk/debian/patches/10mbox-locking.dpatch
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-localdelivery-perl/trunk/debian/patches/10mbox-locking.dpatch?rev=5827&op=diff
==============================================================================
--- packages/libemail-localdelivery-perl/trunk/debian/patches/10mbox-locking.dpatch (original)
+++ packages/libemail-localdelivery-perl/trunk/debian/patches/10mbox-locking.dpatch Sun Jul 15 14:55:52 2007
@@ -5,115 +5,115 @@
## DP: Policy-compliant mbox locking (hopefully).
@DPATCH@
-diff -urNad trunk~/LocalDelivery/Mbox.pm trunk/LocalDelivery/Mbox.pm
---- trunk~/lib/Email/LocalDelivery/Mbox.pm 2006-07-27 22:10:49.000000000 +0300
-+++ trunk/lib/Email/LocalDelivery/Mbox.pm 2006-07-27 22:11:02.000000000 +0300
-@@ -2,7 +2,7 @@
+diff -urNad libemail-localdelivery-perl-0.217~/lib/Email/LocalDelivery/Mbox.pm libemail-localdelivery-perl-0.217/lib/Email/LocalDelivery/Mbox.pm
+--- libemail-localdelivery-perl-0.217~/lib/Email/LocalDelivery/Mbox.pm 2007-07-15 16:41:03.000000000 +0200
++++ libemail-localdelivery-perl-0.217/lib/Email/LocalDelivery/Mbox.pm 2007-07-15 16:50:59.000000000 +0200
+@@ -4,7 +4,7 @@
use File::Path;
use File::Basename;
- use Email::Simple 1.998; # needed for ->header_obj
+ use Email::Simple 1.998; # needed for ->header_obj
-use Fcntl ':flock';
+use Fcntl qw(:DEFAULT :seek);
use Symbol qw(gensym);
use vars qw($VERSION);
-@@ -17,7 +17,7 @@
- print $fh $class->_from_line(\$mail); # Avoid passing $mail where poss.
- print $fh $class->_escape_from_body(\$mail);
- print $fh "\n" unless $mail =~ /\n$/;
-- $class->_close_fh($fh) || next;
-+ $class->_close_fh($fh, $file) || next;
- push @rv, $file
- }
- return @rv;
-@@ -30,14 +30,14 @@
+@@ -37,7 +37,7 @@
+ # This will make streaming a bit more annoying. -- rjbs, 2007-05-25
+ print $fh "\n" unless $email->as_string =~ /\n$/;
- my $fh = gensym;
- open $fh, ">> $file" or return;
-- $class->getlock($fh) || return;
-+ $class->getlock($fh, $file) || return;
- seek $fh, 0, 2;
- return $fh;
+- $class->_close_fh($fh) || next;
++ $class->_close_fh($fh, $file) || next;
+ push @rv, $file;
+ }
+ return @rv;
+@@ -50,14 +50,14 @@
+
+ my $fh = gensym;
+ open $fh, ">> $file" or return;
+- $class->getlock($fh) || return;
++ $class->getlock($fh, $file) || return;
+ seek $fh, 0, 2;
+ return $fh;
}
sub _close_fh {
-- my ($class, $fh) = @_;
-- $class->unlock($fh) || return;
-+ my ($class, $fh, $file) = @_;
-+ $class->unlock($fh, $file) || return;
- close $fh or return;
- return 1;
+- my ($class, $fh) = @_;
+- $class->unlock($fh) || return;
++ my ($class, $fh, $file) = @_;
++ $class->unlock($fh, $file) || return;
+ close $fh or return;
+ return 1;
}
-@@ -82,17 +82,69 @@
+@@ -98,17 +98,69 @@
}
sub getlock {
-+ my ($class, $fh, $file) = @_;
-+ for (1..10) {
-+ return 0 unless $class->getlock_fcntl($fh);
-+ return 1 if $class->getlock_dotlock($file);
-+ sleep int(rand(10 * $_));
-+ }
-+ $class->unlock_fcntl($fh);
-+ return 0;
-+
++ my ($class, $fh, $file) = @_;
++ for (1..10) {
++ return 0 unless $class->getlock_fcntl($fh);
++ return 1 if $class->getlock_dotlock($file);
++ sleep int(rand(10 * $_));
++ }
++ $class->unlock_fcntl($fh);
++ return 0;
++
+}
+
+sub getlock_fcntl {
- my ($class, $fh) = @_;
-+ my $lock = pack('ss at 256', F_WRLCK, SEEK_SET);
- for (1..10) {
-- return 1 if flock ($fh, LOCK_EX | LOCK_NB);
-+ return 1 if fcntl($fh, F_SETLK, $lock);
- sleep $_;
- }
- return 0 ;
+ my ($class, $fh) = @_;
+- for (1 .. 10) {
+- return 1 if flock($fh, LOCK_EX | LOCK_NB);
++ my $lock = pack('ss at 256', F_WRLCK, SEEK_SET);
++ for (1..10) {
++ return 1 if fcntl($fh, F_SETLK, $lock);
+ sleep $_;
+ }
++ return 0 ;
++}
++
++sub getlock_dotlock {
++ my ($class, $file) = @_;
++ my $lockfile = $file . ".lock";
++ my $cmd = "/usr/bin/dotlockfile";
++ system($cmd, $lockfile);
++ return 1 unless $?;
++ if ($? == -1) {
++ die("Couldn't exec $cmd: $!");
++ }
++ if ($? & 127) {
++ warn("$cmd exited with signal " . ($? & 127));
++ }
+ return 0;
}
-+sub getlock_dotlock {
-+ my ($class, $file) = @_;
-+ my $lockfile = $file . ".lock";
-+ my $cmd = "/usr/bin/dotlockfile";
-+ system($cmd, $lockfile);
-+ return 1 unless $?;
-+ if ($? == -1) {
-+ die("Couldn't exec $cmd: $!");
-+ }
-+ if ($? & 127) {
-+ warn("$cmd exited with signal " . ($? & 127));
-+ }
-+ return 0;
-+}
-+
sub unlock {
-- my ($class,$fh) = @_;
-- flock ($fh, LOCK_UN);
-+ my ($class,$fh, $file) = @_;
-+ return 0 unless $class->unlock_dotlock($file);
-+ return 0 unless $class->unlock_fcntl($fh);
-+ return 1;
++ my ($class,$fh, $file) = @_;
++ return 0 unless $class->unlock_dotlock($file);
++ return 0 unless $class->unlock_fcntl($fh);
++ return 1;
+}
+
+sub unlock_fcntl {
-+ my ($class, $fh) = @_;
-+ my $lock = pack('ss at 256', F_UNLCK, SEEK_SET);
-+ return 1 if fcntl($fh, F_SETLK, $lock);
-+ return 0;
+ my ($class, $fh) = @_;
+- flock($fh, LOCK_UN);
++ my $lock = pack('ss at 256', F_UNLCK, SEEK_SET);
++ return 1 if fcntl($fh, F_SETLK, $lock);
++ return 0;
+}
+
+sub unlock_dotlock {
-+ my ($class, $file) = @_;
-+ my $lockfile = $file . ".lock";
-+ my $cmd = "/usr/bin/dotlockfile";
-+ system($cmd, "-u", $lockfile);
-+ return 1 unless $?;
-+ if ($? == -1) {
-+ die("Couldn't exec $cmd: $!");
-+ }
-+ if ($? & 127) {
-+ warn("$cmd exited with signal " . ($? & 127));
-+ }
-+ return 0;
++ my ($class, $file) = @_;
++ my $lockfile = $file . ".lock";
++ my $cmd = "/usr/bin/dotlockfile";
++ system($cmd, "-u", $lockfile);
++ return 1 unless $?;
++ if ($? == -1) {
++ die("Couldn't exec $cmd: $!");
++ }
++ if ($? & 127) {
++ warn("$cmd exited with signal " . ($? & 127));
++ }
++ return 0;
}
1;
Modified: packages/libemail-localdelivery-perl/trunk/lib/Email/LocalDelivery.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-localdelivery-perl/trunk/lib/Email/LocalDelivery.pm?rev=5827&op=diff
==============================================================================
--- packages/libemail-localdelivery-perl/trunk/lib/Email/LocalDelivery.pm (original)
+++ packages/libemail-localdelivery-perl/trunk/lib/Email/LocalDelivery.pm Sun Jul 15 14:55:52 2007
@@ -6,7 +6,7 @@
use Carp;
use vars qw($VERSION);
-$VERSION = '0.215';
+$VERSION = '0.217';
=head1 NAME
@@ -35,8 +35,10 @@
sub deliver {
my ($class, $mail, @boxes) = @_;
+
croak "Mail argument to deliver should just be a plain string"
if ref $mail;
+
if (!@boxes) {
my $default_unixbox = ( grep { -d $_ } qw(/var/spool/mail/ /var/mail/) )[0] . getpwuid($>);
my $default_maildir = ((getpwuid($>))[7])."/Maildir/";
@@ -74,6 +76,12 @@
L<http://emailproject.perl.org/wiki/Email::LocalDelivery>
+=head1 CONTACT INFO
+
+To report bugs, please use the request tracker at L<http://rt.cpan.org>. For
+all other information, please contact the PEP mailing list (see the wiki,
+above) or Ricardo SIGNES.
+
=head1 COPYRIGHT AND LICENSE
Copyright 2003 by Simon Cozens
Modified: packages/libemail-localdelivery-perl/trunk/lib/Email/LocalDelivery/Maildir.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-localdelivery-perl/trunk/lib/Email/LocalDelivery/Maildir.pm?rev=5827&op=diff
==============================================================================
--- packages/libemail-localdelivery-perl/trunk/lib/Email/LocalDelivery/Maildir.pm (original)
+++ packages/libemail-localdelivery-perl/trunk/lib/Email/LocalDelivery/Maildir.pm Sun Jul 15 14:55:52 2007
@@ -1,92 +1,109 @@
use strict;
+
package Email::LocalDelivery::Maildir;
use Email::Simple;
use File::Path;
use Symbol qw(gensym);
use vars qw($VERSION);
-$VERSION = "1.10";
+$VERSION = "1.101";
my $maildir_time = 0;
my $maildir_counter = 0;
-use Sys::Hostname; (my $HOSTNAME = hostname) =~ s/\..*//;
+use Sys::Hostname;
+(my $HOSTNAME = hostname) =~ s/\..*//;
sub deliver {
- my ($class, $mail, @files) = @_;
- $mail = Email::Simple->new($mail)
- unless ref $mail eq "Email::Simple"; # For when we recurse
- $class->fix_lines($mail);
- $class->update_time();
+ my ($class, $mail, @files) = @_;
- my $temp_file = $class->write_temp($mail, @files) or return;
+ $mail = Email::Simple->new($mail)
+ unless eval { $mail->isa('Email::Simple') }; # For when we recurse
- my @written = $class->write_links($mail, $temp_file, @files);
- unlink $temp_file;
- return @written;
+ $class->fix_lines($mail);
+ $class->update_time();
+
+ my $temp_file = $class->write_temp($mail, @files) or return;
+
+ my @written = $class->write_links($mail, $temp_file, @files);
+ unlink $temp_file;
+ return @written;
}
sub fix_lines {
- my ($class, $mail) = @_;
- return if $mail->header("Lines");
- my @lines = split /\n/, $mail->body;
- $mail->header_set("Lines", scalar @lines);
+ my ($class, $mail) = @_;
+ return if $mail->header("Lines");
+ my @lines = split /\n/, $mail->body;
+ $mail->header_set("Lines", scalar @lines);
}
sub update_time {
- if ($maildir_time != time) {
- $maildir_time = time;
- $maildir_counter = 0
- } else { $maildir_counter++ }
+ if ($maildir_time != time) {
+ $maildir_time = time;
+ $maildir_counter = 0;
+ } else {
+ $maildir_counter++;
+ }
}
sub write_temp {
- my ($class, $mail, @files) = @_;
- for my $file (@files) {
- $file =~ s{/$}{};
- my $tmp_file = $class->get_filename_in($file."/tmp");
- eval { mkpath([map { "$file/$_" } qw(tmp new cur)]); 1 } or next;
- $class->write_message($mail, $tmp_file)
- and return $tmp_file;
- }
- return;
+ my ($class, $mail, @files) = @_;
+ for my $file (@files) {
+ $file =~ s{/$}{};
+ my $tmp_file = $class->get_filename_in($file . "/tmp");
+ eval {
+ mkpath([ map { "$file/$_" } qw(tmp new cur) ]);
+ 1;
+ } or next;
+ $class->write_message($mail, $tmp_file)
+ and return $tmp_file;
+ }
+ return;
}
sub get_filename_in {
- my ($class, $tmpdir) = @_;
- my ($msg_file, $tmppath);
- do {
- $msg_file = join ".", ($maildir_time,
- $$. "_$maildir_counter",
- $HOSTNAME)
- } while -e ($tmppath="$tmpdir/$msg_file")
- and ++$maildir_counter;
- return $tmppath;
+ my ($class, $tmpdir) = @_;
+ my ($msg_file, $tmppath);
+ do {
+ $msg_file = join ".", ($maildir_time, $$ . "_$maildir_counter", $HOSTNAME);
+ } while -e ($tmppath = "$tmpdir/$msg_file")
+ and ++$maildir_counter;
+ return $tmppath;
}
sub write_links {
- my ($class, $mail, $temp_file, @files) = @_;
- my @rv;
- for my $file (@files) {
- $file =~ s{/$}{};
- my $new_location = $class->get_filename_in($file."/new");
- eval { mkpath([map { "$file/$_" } qw(tmp new cur)]); 1 } or next;
- if (link $temp_file, $new_location) {
- push @rv, $new_location;
- } else {
- require Errno; import Errno qw(EXDEV);
- if ($! == &EXDEV) {
- push @rv, $class->deliver($mail, $file);
- }
- }
+ my ($class, $mail, $temp_file, @files) = @_;
+ my @rv;
+ for my $file (@files) {
+ $file =~ s{/$}{};
+ my $new_location = $class->get_filename_in($file . "/new");
+ eval {
+ mkpath([ map { "$file/$_" } qw(tmp new cur) ]);
+ 1;
+ } or next;
+ if (link $temp_file, $new_location) {
+ push @rv, $new_location;
+ } else {
+ require Errno;
+ import Errno qw(EXDEV);
+ if ($! == &EXDEV) {
+ push @rv, $class->deliver($mail, $file);
+ }
}
- return @rv;
+ }
+ return @rv;
}
sub write_message {
- my ($class, $mail, $file) = @_;
- my $fh = gensym;
- open $fh, ">$file" or return;
+ my ($class, $mail, $file) = @_;
+ my $fh = gensym;
+ open $fh, ">$file" or return;
+
+ if (eval { $mail->can('stream_to') }) {
+ eval { $mail->stream_to($fh); 1 } or return;
+ } else {
print $fh $mail->as_string or return;
- return close $fh;
+ }
+
+ return close $fh;
}
1;
Modified: packages/libemail-localdelivery-perl/trunk/lib/Email/LocalDelivery/Mbox.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-localdelivery-perl/trunk/lib/Email/LocalDelivery/Mbox.pm?rev=5827&op=diff
==============================================================================
--- packages/libemail-localdelivery-perl/trunk/lib/Email/LocalDelivery/Mbox.pm (original)
+++ packages/libemail-localdelivery-perl/trunk/lib/Email/LocalDelivery/Mbox.pm Sun Jul 15 14:55:52 2007
@@ -3,7 +3,7 @@
use File::Path;
use File::Basename;
-use Email::Simple 1.998; # needed for ->header_obj
+use Email::Simple 1.998; # needed for ->header_obj
use Fcntl ':flock';
use Symbol qw(gensym);
@@ -11,91 +11,104 @@
$VERSION = "1.103";
sub deliver {
- my ($class, $mail, @files) = @_;
- my @rv;
- for my $file (@files) {
- my $fh = $class->_open_fh($file) or next;
- print $fh "\n" if tell($fh) > 0;
- print $fh $class->_from_line(\$mail); # Avoid passing $mail where poss.
- print $fh $class->_escape_from_body(\$mail);
- print $fh "\n" unless $mail =~ /\n$/;
- $class->_close_fh($fh) || next;
- push @rv, $file
- }
- return @rv;
+ # The slightly convoluted method of unrolling the stack is intended to limit
+ # the scope of which a large string at $_[1] might be in memory before being
+ # constructed into an Email::Simple. -- rjbs, 2007-05-25
+ my $class = shift;
+
+ my $email;
+ if (eval { $_[0]->isa('Email::Simple') }) {
+ $email = shift;
+ } else {
+ my $text = shift;
+ $email = Email::Simple->new(\$text); # requires Email::Simple 1.998 or so
+ }
+
+ my @files = @_;
+
+ my @rv;
+
+ for my $file (@files) {
+ my $fh = $class->_open_fh($file) or next;
+ print $fh "\n" if tell($fh) > 0;
+ print $fh $class->_from_line($email);
+ print $fh $class->_escape_from_body($email);
+
+ # This will make streaming a bit more annoying. -- rjbs, 2007-05-25
+ print $fh "\n" unless $email->as_string =~ /\n$/;
+
+ $class->_close_fh($fh) || next;
+ push @rv, $file;
+ }
+ return @rv;
}
sub _open_fh {
- my ($class, $file) = @_;
- my $dir = dirname($file);
- return if ! -d $dir and not mkpath($dir);
+ my ($class, $file) = @_;
+ my $dir = dirname($file);
+ return if !-d $dir and not mkpath($dir);
- my $fh = gensym;
- open $fh, ">> $file" or return;
- $class->getlock($fh) || return;
- seek $fh, 0, 2;
- return $fh;
+ my $fh = gensym;
+ open $fh, ">> $file" or return;
+ $class->getlock($fh) || return;
+ seek $fh, 0, 2;
+ return $fh;
}
sub _close_fh {
- my ($class, $fh) = @_;
- $class->unlock($fh) || return;
- close $fh or return;
- return 1;
+ my ($class, $fh) = @_;
+ $class->unlock($fh) || return;
+ close $fh or return;
+ return 1;
}
sub _escape_from_body {
- my ($class, $mail_r) = @_;
+ my ($class, $email) = @_;
- my $email = Email::Simple->new($$mail_r);
+ my $body = $email->body;
+ $body =~ s/^(From )/>$1/gm;
- my $body = $email->body;
- $body =~ s/^(From )/>$1/gm;
-
- return $email->header_obj->as_string . $email->crlf . $body;
+ return $email->header_obj->as_string . $email->crlf . $body;
}
sub _from_line {
- my ($class, $mail_r) = @_;
+ my ($class, $email) = @_;
- # The trivial way
- return if $$mail_r =~ /^From /;
+ # The qmail way.
+ return $ENV{UFLINE} . $ENV{RPLINE} . $ENV{DTLINE} if exists $ENV{UFLINE};
- # The qmail way.
- return $ENV{UFLINE}.$ENV{RPLINE}.$ENV{DTLINE} if exists $ENV{UFLINE};
-
- # The boring way.
- return _from_line_boring(Email::Simple->new($$mail_r));
+ # The boring way.
+ return _from_line_boring($email);
}
sub _from_line_boring {
- my $mail = shift;
- my $from = $mail->header("Return-path") ||
- $mail->header("Sender") ||
- $mail->header("Reply-To") ||
- $mail->header("From") ||
- 'root at localhost';
- $from = $1 if $from =~ /<(.*?)>/; # comment <email at address> -> email at address
- $from =~ s/\s*\(.*\)\s*//; # email at address (comment) -> email at address
- $from =~ s/\s+//g; # if any whitespace remains, get rid of it.
+ my $mail = shift;
+ my $from = $mail->header("Return-path")
+ || $mail->header("Sender")
+ || $mail->header("Reply-To")
+ || $mail->header("From")
+ || 'root at localhost';
+ $from = $1 if $from =~ /<(.*?)>/; # comment <email at address> -> email at address
+ $from =~ s/\s*\(.*\)\s*//; # email at address (comment) -> email at address
+ $from =~ s/\s+//g; # if any whitespace remains, get rid of it.
- my $fromtime = localtime;
- $fromtime =~ s/(:\d\d) \S+ (\d{4})$/$1 $2/; # strip timezone.
- return "From $from $fromtime\n";
+ my $fromtime = localtime;
+ $fromtime =~ s/(:\d\d) \S+ (\d{4})$/$1 $2/; # strip timezone.
+ return "From $from $fromtime\n";
}
sub getlock {
- my ($class, $fh) = @_;
- for (1..10) {
- return 1 if flock ($fh, LOCK_EX | LOCK_NB);
- sleep $_;
- }
- return 0 ;
+ my ($class, $fh) = @_;
+ for (1 .. 10) {
+ return 1 if flock($fh, LOCK_EX | LOCK_NB);
+ sleep $_;
+ }
+ return 0;
}
sub unlock {
- my ($class,$fh) = @_;
- flock ($fh, LOCK_UN);
+ my ($class, $fh) = @_;
+ flock($fh, LOCK_UN);
}
1;
More information about the Pkg-perl-cvs-commits
mailing list