Skip to content

Commit

Permalink
DO NOT MERGE: perltidy all the *.pm files
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Jul 9, 2024
1 parent d02da2a commit f2936ef
Show file tree
Hide file tree
Showing 162 changed files with 35,896 additions and 36,357 deletions.
77 changes: 35 additions & 42 deletions cassandane/Cassandane/Address.pm
Original file line number Diff line number Diff line change
Expand Up @@ -42,60 +42,53 @@ use strict;
use warnings;
use overload qw("") => \&as_string;

sub new
{
my $class = shift;
my %params = @_;
my $self = {
name => undef,
localpart => undef,
domain => undef,
};
sub new {
my $class = shift;
my %params = @_;
my $self = {
name => undef,
localpart => undef,
domain => undef,
};

$self->{name} = $params{name}
if defined $params{name};
$self->{localpart} = $params{localpart}
if defined $params{localpart};
$self->{domain} = $params{domain}
if defined $params{domain};
$self->{name} = $params{name}
if defined $params{name};
$self->{localpart} = $params{localpart}
if defined $params{localpart};
$self->{domain} = $params{domain}
if defined $params{domain};

bless $self, $class;
return $self;
bless $self, $class;
return $self;
}

sub name
{
my ($self) = @_;
return $self->{name};
sub name {
my ($self) = @_;
return $self->{name};
}

sub localpart
{
my ($self) = @_;
return ($self->{localpart} || 'unknown-user');
sub localpart {
my ($self) = @_;
return ($self->{localpart} || 'unknown-user');
}

sub domain
{
my ($self) = @_;
return ($self->{domain} || 'unspecified-domain');
sub domain {
my ($self) = @_;
return ($self->{domain} || 'unspecified-domain');
}

sub address
{
my ($self) = @_;
return $self->localpart() . '@' . $self->domain();
sub address {
my ($self) = @_;
return $self->localpart() . '@' . $self->domain();
}

sub as_string
{
my ($self) = @_;
my $s = '';
$s .= $self->{name} . ' '
if defined $self->{name};
$s .= '<' . $self->address() . '>';
return $s;
sub as_string {
my ($self) = @_;
my $s = '';
$s .= $self->{name} . ' '
if defined $self->{name};
$s .= '<' . $self->address() . '>';
return $s;
}


1;
70 changes: 34 additions & 36 deletions cassandane/Cassandane/BuildInfo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -45,56 +45,54 @@ use Cassandane::Cassini;
use Cassandane::Util::Log;

sub new {
my $class = shift;
my %params = @_;
my $self = {};
my $class = shift;
my %params = @_;
my $self = {};

my $cassini = Cassandane::Cassini->instance();
my $cassini = Cassandane::Cassini->instance();

my $prefix = $cassini->val("cyrus default", 'prefix', '/usr/cyrus');
$prefix = $params{cyrus_prefix}
if defined $params{cyrus_prefix};
my $prefix = $cassini->val("cyrus default", 'prefix', '/usr/cyrus');
$prefix = $params{cyrus_prefix}
if defined $params{cyrus_prefix};

my $destdir = $cassini->val("cyrus default", 'destdir', '');
$destdir = $params{cyrus_destdir}
if defined $params{cyrus_destdir};
my $destdir = $cassini->val("cyrus default", 'destdir', '');
$destdir = $params{cyrus_destdir}
if defined $params{cyrus_destdir};

$self->{data} = _read_buildinfo($destdir, $prefix);
$self->{data} = _read_buildinfo($destdir, $prefix);

return bless $self, $class;
return bless $self, $class;
}

sub _read_buildinfo
{
my ($destdir, $prefix) = @_;

my $cyr_buildinfo;
foreach my $bindir (qw(sbin cyrus/bin)) {
my $p = "$destdir$prefix/$bindir/cyr_buildinfo";
if (-x $p) {
$cyr_buildinfo = $p;
last;
}
}
sub _read_buildinfo {
my ($destdir, $prefix) = @_;

if (not defined $cyr_buildinfo) {
xlog "Couldn't find cyr_buildinfo: ".
"don't know what features Cyrus supports";
return;
my $cyr_buildinfo;
foreach my $bindir (qw(sbin cyrus/bin)) {
my $p = "$destdir$prefix/$bindir/cyr_buildinfo";
if (-x $p) {
$cyr_buildinfo = $p;
last;
}
}

if (not defined $cyr_buildinfo) {
xlog "Couldn't find cyr_buildinfo: "
. "don't know what features Cyrus supports";
return;
}

my $jsondata = qx($cyr_buildinfo);
return if not $jsondata;
my $jsondata = qx($cyr_buildinfo);
return if not $jsondata;

return JSON::decode_json($jsondata);
return JSON::decode_json($jsondata);
}

sub get
{
my ($self, $category, $key) = @_;
sub get {
my ($self, $category, $key) = @_;

return if not exists $self->{data}->{$category}->{$key};
return $self->{data}->{$category}->{$key};
return if not exists $self->{data}->{$category}->{$key};
return $self->{data}->{$category}->{$key};
}

1;
Loading

0 comments on commit f2936ef

Please sign in to comment.