Skip to content

Commit

Permalink
I disabled more perl critic stuff rather than do some of the more irr…
Browse files Browse the repository at this point in the history
…itating things it suggested
  • Loading branch information
jettero committed Jul 6, 2010
1 parent 62d9415 commit 9a5db45
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .perlcriticrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
severity = 4
verbose = 8
exclude = ValuesAndExpressions::ProhibitConstantPragma Subroutines::RequireArgUnpacking
exclude = ValuesAndExpressions::ProhibitConstantPragma Subroutines::RequireArgUnpacking Modules::RequireFilenameMatchesPackage Modules::ProhibitMultiplePackages TestingAndDebugging::ProhibitNoStrict
36 changes: 26 additions & 10 deletions contrib/SimpleX.pm
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@
package Net::IMAP::SimpleX::Body;

use strict;
use warnings;

BEGIN {
our @fields = qw/content_description encoded_size charset content_type format part_number id name encoding/;
for my $attr (@fields) {
no strict;
*{"Net::IMAP::SimpleX::Body::$attr"} = sub { shift->{$attr}; };
}
};
sub hasparts { 0; } *has_parts = \&hasparts;
sub parts {}
sub type {}
sub body { shift; }
}

sub hasparts { return 0; } *has_parts = \&hasparts;
sub parts { return }
sub type { return }
sub body { return shift; }

package Net::IMAP::SimpleX::BodySummary;

use strict;
use warnings;

sub new {
my ($class, $data) = @_;
my $self;

Net::IMAP::SimpleX::__id_parts($data);

if ($data->{parts}) {
$self = $data;
} else {
$self = { body => $data };
}
bless $self, $class;

return bless $self, $class;
}

sub hasparts { return shift->{parts} ? 1 : 0; } *has_parts = \&hasparts;
sub parts { my $self = shift; wantarray ? @{$self->{parts}} : $self->{parts}; }
sub type { shift->{type} || undef; }
sub body { shift->{body}; }
sub parts { my $self = shift; return wantarray ? @{$self->{parts}} : $self->{parts}; }
sub type { return shift->{type} || undef; }
sub body { return shift->{body}; }


package Net::IMAP::SimpleX;
Expand Down Expand Up @@ -118,6 +132,8 @@ sub __id_parts {
} else {
$data->{part_number} = $id;
}

return;
}

sub body_summary {
Expand Down

0 comments on commit 9a5db45

Please sign in to comment.