Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: RFC: beginner level script improvement (various comments)

by smls (Friar)
on Oct 30, 2013 at 10:26 UTC ( [id://1060314]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub process_command_line_args {
        #set default values for dynamic config settings
    ...
        my @args = ($layout,$wait_for_child,$wait_for_exec,$name,$prompt,$
    +configf,$quiet,$outf,$debug,$batchsize,$proto,$tacacs,$verbose,$heade
    +r,$mailref,$path);
        return \@args;
    }
    
  2. or download this
    sub Main {
        my %CONFIG;
    ...
        )
        ...
    }
    
  3. or download this
    $WARN = 0; #supress flow control warning in following block due to exi
    +ting anon sub
    LOOPCTRL: while ($lb < 10){
    ...
        );
    }
    $WARN = 1; # reset to default
    
  4. or download this
    while (...) {
        next if $exp->expect(...
    ...
            ...
        );
    }
    
  5. or download this
    use strict;
    use warnings;
    ...
    }
    
    # warnings coming from here will be printed
    
  6. or download this
      # Don't warn about exiting subs via loop control:
      no warnings 'exiting';
      
      # Don't warn about using undef in numeric or string operations:
      no warnings 'uninitialized';
    
  7. or download this
    {
      local $SIG{__WARN__} = sub {};
    ...
    }
    
    # warnings coming from here will not be affected
    
  8. or download this
    \%{ $CONFIG }
    \%$CONFIG
    
  9. or download this
    my $range = '1000000';
    my $rand = int(rand($range)); ##generate random temp-db filename to al
    +low for simultanous script execution
    
    ...
      tempdb => "$path/$rand.db",
    
  10. or download this
    my $foo = $_[0];
    
  11. or download this
    my $foo = shift;
    
  12. or download this
    my ($foo) = @_;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1060314]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-24 20:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found