Skip to content

Commit

Permalink
don't use indirect syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanez committed Jan 16, 2012
1 parent 5f94489 commit b30d4ab
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 23 deletions.
8 changes: 4 additions & 4 deletions lib/SNAG.pm
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ sub already_running
my $full_script = "^($^X |perl |.{0,0})$0";

#return grep { $_->fname eq SCRIPT_NAME && $_->pid != $$ } @{(new Proc::ProcessTable)->table};
return grep { $_->cmndline =~ /^$full_script/ && $_->pid != $$ } @{(new Proc::ProcessTable)->table};
return grep { $_->cmndline =~ /^$full_script/ && $_->pid != $$ } @{Proc::ProcessTable->new->table};
}
}

Expand Down Expand Up @@ -461,16 +461,16 @@ sub logger
# Check if logfile was modified in the last day, so we can append rather than overwrite
if(time() - (stat($logfile))[9] < 3600)
{
$fh = new FileHandle ">> $logfile" or die "Could not open log $logfile";
$fh = FileHandle->new ">> $logfile" or die "Could not open log $logfile";
}
else
{
$fh = new FileHandle "> $logfile" or die "Could not open log $logfile"
$fh = FileHandle->new "> $logfile" or die "Could not open log $logfile"
}
}
else
{
$fh = new FileHandle ">> $logfile" or die "Could not open log $logfile";
$fh = FileHandle->new ">> $logfile" or die "Could not open log $logfile";
}

$fh->autoflush(1);
Expand Down
4 changes: 2 additions & 2 deletions lib/SNAG/BP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ BEGIN

unless ( $opt{allowdup} )
{
my @res = grep { $_->pid == $$ } @{ ( new Proc::ProcessTable )->table };
exit(0) if grep { @res && $_->cmndline eq $res[0]->cmndline && $_->pid != $$ } @{ ( new Proc::ProcessTable )->table };
my @res = grep { $_->pid == $$ } @{ Proc::ProcessTable->new->table };
exit(0) if grep { @res && $_->cmndline eq $res[0]->cmndline && $_->pid != $$ } @{ Proc::ProcessTable->new->table };
}

$id = md5_hex( "$0 $args" . time() . int( rand(127) ) );
Expand Down
8 changes: 4 additions & 4 deletions lib/SNAG/Client.pm
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ sub new
my ($queue_name, $server_name) = ($1, $2);

my $queue_file = catfile(LOG_DIR, $queue_name);
my $queue = new SNAG::Queue ( File => $queue_file, Seperator => PARCEL_SEP );
my $queue = SNAG::Queue->new( File => $queue_file, Seperator => PARCEL_SEP );

if($queue->peek(1))
{
Expand Down Expand Up @@ -219,12 +219,12 @@ sub new

# create UUID
use Data::UUID;
my $ug = new Data::UUID;
my $ug = Data::UUID->new;
$config->{uuid} = $ug->create_str();

$kernel->post("logger" => 'log' => "saving config file: " . $client_conf) if $SNAG::flags{debug};
use Config::General;
my $cg = new Config::General();
my $cg = Config::General->new;
$cg->save_file($client_conf, $config);
$kernel->call($_[SESSION], 'load_conf');
},
Expand Down Expand Up @@ -299,7 +299,7 @@ sub handle_input
{
my $queue_file = catfile(LOG_DIR, $script_name . '_' . $name . '_client_queue');

$heap->{client_queue}->{$name}->{functions}->{load} = new SNAG::Queue ( File => $queue_file, Seperator => PARCEL_SEP );
$heap->{client_queue}->{$name}->{functions}->{load} = SNAG::Queue->new( File => $queue_file, Seperator => PARCEL_SEP );
}

$kernel->post('logger' => 'log' => "Enqueue: $name($function): " . substr($data, 0, 130) . "....") if $SNAG::flags{debug} && ! $SNAG::flags{verbose};
Expand Down
2 changes: 1 addition & 1 deletion lib/SNAG/Dispatch.pm
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ sub new
my ($kernel, $heap) = @_[KERNEL, HEAP];
$kernel->delay($_[STATE] => 3600);

my $procs = new Proc::ProcessTable;
my $procs = Proc::ProcessTable->new;
my %fields = map { $_ => 1 } $procs->fields;

my $already_started; #kludge, id like to rework this later
Expand Down
4 changes: 2 additions & 2 deletions lib/SNAG/Queue.pm
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ sub new
$self->{queue_file} = $queue_file;
$self->{idx_file} = $idx_file;

$self->{queue} = new IO::File($queue_file, (O_CREAT | O_RDWR), $mode) or croak $!;
$self->{idx} = new IO::File($idx_file, (O_CREAT | O_RDWR), $mode) or croak $!;
$self->{queue} = IO::File->new($queue_file, (O_CREAT | O_RDWR), $mode) or croak $!;
$self->{idx} = IO::File->new($idx_file, (O_CREAT | O_RDWR), $mode) or croak $!;

### Default ptr to 0, replace it with value in idx file if one exists
$self->{idx}->sysseek(0, SEEK_SET);
Expand Down
2 changes: 1 addition & 1 deletion lib/SNAG/Server/Master.pm
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ sub new
my $get_nets = $heap->{dbh}->selectall_hashref("select subnet, pop, domain, override from domain_map", "subnet");
delete $heap->{netpat};
delete $heap->{netmap};
$heap->{netpat} = new Net::Patricia;
$heap->{netpat} = Net::Patricia->new;
foreach my $key (keys %$get_nets)
{
$heap->{netpat}->add_string($key);
Expand Down
2 changes: 1 addition & 1 deletion lib/SNAG/Server/RRDBench.pm
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ sub new
$kernel->alias_set('object');

my $state_file = LOG_DIR . "/$alias.state";
$heap->{state} = new DBM::Deep(file => $state_file);
$heap->{state} = DBM::Deep->new(file => $state_file);

$heap->{sleepy_time} = 100;
$heap->{tuned} = 0;
Expand Down
2 changes: 1 addition & 1 deletion lib/SNAG/Source/DailyFile.pm
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ sub new
$startatend = 1 if $startatendifnew;
}

$heap->{file_state} = new DBM::Deep(file => $state_file);
$heap->{file_state} = DBM::Deep->new(file => $state_file);

$kernel->state('filter' => \&{$package . '::filter'});

Expand Down
2 changes: 1 addition & 1 deletion lib/SNAG/Source/Manager.pm
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ sub new
eval
{

$state = new DBM::Deep( file => LOG_DIR . "/$type-$alias.state", autoflush => 1 ) or die "Could not open state file $type-$alias.state: $!";
$state = DBM::Deep->new( file => LOG_DIR . "/$type-$alias.state", autoflush => 1 ) or die "Could not open state file $type-$alias.state: $!";

if ( -r CFG_DIR . "/$type-$alias.xml")
{
Expand Down
2 changes: 1 addition & 1 deletion lib/SNAG/Source/SystemInfo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ sub apache_version
my ($execs, $contents);

require Proc::ProcessTable;
my $procs = new Proc::ProcessTable;
my $procs = Proc::ProcessTable->new;

foreach my $proc ( @{$procs->table} )
{
Expand Down
2 changes: 1 addition & 1 deletion lib/SNAG/Source/SystemInfo/Linux.pm
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ sub service_monitor
$service_monitor = retrieve($state_file) or die "Could not open $state_file";
}
my $table = new Proc::ProcessTable;
my $table = Proc::ProcessTable->new;
my $process_list;
foreach my $ref (@{$table->table})
Expand Down
6 changes: 3 additions & 3 deletions lib/SNAG/Source/SystemInfo/SunOS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ sub config_files_whole
#Add any new files that might have popped up
my $config_files = build_config_file_list();

my $state_files = new DBM::Deep
my $state_files = DBM::Deep->new
(
file => catfile(LOG_DIR, 'sysinfo_conf_files.state'),
autoflush => 1,
Expand Down Expand Up @@ -178,7 +178,7 @@ sub config_files_check

my $now = time;

my $state_files = new DBM::Deep
my $state_files = DBM::Deep->new
(
file => catfile(LOG_DIR, 'sysinfo_conf_files.state'),
autoflush => 1,
Expand Down Expand Up @@ -807,7 +807,7 @@ sub service_monitor
$service_monitor = retrieve($state_file) or die "Could not open $state_file";
}

my $table = new Proc::ProcessTable;
my $table = Proc::ProcessTable->new;

my $process_list;
foreach my $ref (@{$table->table})
Expand Down
2 changes: 1 addition & 1 deletion lib/SNAG/Source/monitor.pm
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ sub monitor

if(my $procs = $monitor_defs->{procs})
{
my $get_procs = new Proc::ProcessTable;
my $get_procs = Proc::ProcessTable->new;

while(my ($proc_key, $ref) = each %$procs)
{
Expand Down

0 comments on commit b30d4ab

Please sign in to comment.