Skip to content

Commit

Permalink
Add .perltidyrc
Browse files Browse the repository at this point in the history
  • Loading branch information
gbarr committed Dec 18, 2012
1 parent 89d895c commit 6fb9891
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 28 deletions.
33 changes: 33 additions & 0 deletions .perltidyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Perl Best Practices (plus errata) .perltidyrc file

-l=98 # Max line width is 98 cols
-i=4 # Indent level is 4 cols
-ci=4 # Continuation indent is 4 cols
-se # Errors to STDERR
-vt=2 # Maximal vertical tightness
-cti=0 # No extra indentation for closing brackets
-pt=1 # Medium parenthesis tightness
-bt=1 # Medium brace tightness
-sbt=1 # Medium square bracket tightness
-bbt=1 # Medium block brace tightness
-nsfs # No space before semicolons
-nolq # Don't outdent long quoted strings
-wbb="% + - * / x != == >= <= =~ < > | & **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="
# Break before all operators

# extras/overrides/deviations from PBP

--maximum-line-length=100 # be slightly more generous
--warning-output # Show warnings
--maximum-consecutive-blank-lines=2 # default is 1
--nohanging-side-comments # troublesome for commented out code

-isbc # block comments may only be indented if they have some space characters before the #
-ci=2 # Continuation indent is 2 cols
-i=2 # Indent level is 2 cols

# for the up-tight folk :)
-pt=2 # High parenthesis tightness
-bt=2 # High brace tightness
-sbt=2 # High square bracket tightness

40 changes: 20 additions & 20 deletions lib/Beanstalk/Client.pm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ sub _interact {
local $SIG{PIPE} = "IGNORE" unless $MSG_NOSIGNAL;

my $debug = $self->debug;
warn $cmd ."\n" if $debug;
warn $cmd . "\n" if $debug;

$cmd .= $CRLF;
$cmd .= $data . $CRLF if defined $data;
Expand All @@ -75,7 +75,7 @@ READ: {
if ($read) {
if ($buffer =~ /^([^\015\012]+)\015\012/) {
$self->{_recv_buffer} = substr($buffer, 2 + length($1));
warn $1,"\n" if $debug;
warn $1, "\n" if $debug;
return split(' ', $1);
}
$offset += length $buffer;
Expand Down Expand Up @@ -113,7 +113,7 @@ READ: while ($more > 0) {
return $self->disconnect;
}
}
warn substr($self->{_recv_buffer}, 0, $bytes),"\n" if $self->debug;
warn substr($self->{_recv_buffer}, 0, $bytes), "\n" if $self->debug;
return substr($self->{_recv_buffer}, 0, $bytes);
}

Expand Down Expand Up @@ -165,7 +165,7 @@ sub _peek {
}

sub __watching {
my $self = shift;
my $self = shift;
my $watching = $self->_watching;
return $watching if $watching;
$self->list_tubes_watched;
Expand All @@ -192,7 +192,7 @@ sub new {


sub connect {
my $self = shift;
my $self = shift;
my $server = $self->server || "127.0.0.1";

$server .= ":11300" unless $server =~ /:/;
Expand All @@ -212,7 +212,7 @@ sub connect {
$self->socket($sock);

my $was_watching = $self->_watching;
my $was_using = $self->_using;
my $was_using = $self->_using;

$self->list_tubes_watched;
if ($was_watching) {
Expand Down Expand Up @@ -249,7 +249,7 @@ sub quit {

sub put {
my $self = shift;
my $opt = shift || {};
my $opt = shift || {};

my $pri = exists $opt->{priority} ? $opt->{priority} : $self->priority;
my $ttr = exists $opt->{ttr} ? $opt->{ttr} : $self->ttr;
Expand Down Expand Up @@ -287,7 +287,7 @@ sub stats {

sub stats_tube {
my $self = shift;
my $tube = @_ ? shift: 'default';
my $tube = @_ ? shift : 'default';
_interact_stats($self, "stats-tube $tube");
}

Expand All @@ -300,7 +300,7 @@ sub stats_job {


sub kick {
my $self = shift;
my $self = shift;
my $bound = shift || 1;

my @resp = _interact($self, "kick $bound")
Expand All @@ -314,8 +314,8 @@ sub kick {


sub kick_job {
my $self = shift;
my $job = shift;
my $self = shift;
my $job = shift;

my @resp = _interact($self, "kick-job $job")
or return undef;
Expand Down Expand Up @@ -345,8 +345,8 @@ sub reserve {
my $self = shift;
my $timeout = shift;

my $cmd = defined($timeout) ? "reserve-with-timeout $timeout" : "reserve";
my @resp = _interact($self, $cmd)
my $cmd = defined($timeout) ? "reserve-with-timeout $timeout" : "reserve";
my @resp = _interact($self, $cmd)
or return undef;

if ($resp[0] eq 'RESERVED') {
Expand Down Expand Up @@ -464,9 +464,9 @@ sub ignore {


sub watch_only {
my $self = shift;
my $self = shift;
my $watching = $self->__watching or return undef;
my %watched = %$watching;
my %watched = %$watching;
my $ret;
foreach my $watch (@_) {
next if delete $watched{$watch};
Expand Down Expand Up @@ -508,16 +508,16 @@ sub list_tubes_watched {
my $self = shift;
my $ret = _interact_yaml_resp($self, "list-tubes-watched")
or return;
$self->_watching( { map { ($_,1) } @$ret });
$self->_watching({map { ($_, 1) } @$ret});
@$ret;
}


sub pause_tube {
my $self = shift;
my $tube = shift;
my $delay= shift || 0;
my @resp = _interact($self, "pause-tube $tube $delay")
my $self = shift;
my $tube = shift;
my $delay = shift || 0;
my @resp = _interact($self, "pause-tube $tube $delay")
or return undef;
return 1 if $resp[0] eq 'PAUSED';

Expand Down
10 changes: 4 additions & 6 deletions lib/Beanstalk/Job.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ use base qw(Class::Accessor::Fast);

our $VERSION = "1.07";

__PACKAGE__->mk_accessors(
qw(id client buried reserved data error)
);
__PACKAGE__->mk_accessors(qw(id client buried reserved data error));

sub stats {
my $self = shift;
Expand Down Expand Up @@ -84,7 +82,7 @@ sub args {
}

sub tube {
my $self = shift;
my $self = shift;

my $stats = $self->{_stats} || $self->stats
or return undef;
Expand All @@ -93,7 +91,7 @@ sub tube {
}

sub ttr {
my $self = shift;
my $self = shift;

my $stats = $self->{_stats} || $self->stats
or return undef;
Expand All @@ -102,7 +100,7 @@ sub ttr {
}

sub priority {
my $self = shift;
my $self = shift;

my $stats = $self->{_stats} || $self->stats
or return undef;
Expand Down
4 changes: 2 additions & 2 deletions lib/Beanstalk/Stats.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ our $VERSION = "1.07";

sub new {
my $proto = shift;
my $href = shift;
my $href = shift;
bless $href, $proto;
}

sub DESTROY { }
sub DESTROY { }

sub AUTOLOAD {
(my $method = $AUTOLOAD) =~ s/.*:://;
Expand Down

0 comments on commit 6fb9891

Please sign in to comment.