Permalink
Browse files

don't use indirect syntax

  • Loading branch information...
1 parent 5f94489 commit b30d4ab71db1a659af83824ce3cdcd05d98fa52b @arcanez committed Jan 16, 2012
View
@@ -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};
}
}
@@ -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);
View
@@ -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) ) );
View
@@ -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))
{
@@ -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');
},
@@ -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};
View
@@ -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
View
@@ -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);
@@ -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);
@@ -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;
@@ -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'});
@@ -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")
{
@@ -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} )
{
@@ -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})
@@ -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,
@@ -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,
@@ -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})
@@ -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)
{

0 comments on commit b30d4ab

Please sign in to comment.