in reply to Main logic of this script

Hi, I only know Perl from an administration perspective, and trying to understand the below Perl Script primarily the main logic. Though I understand the syntax, but have challenges in understanding the flow. Could someone please explain me an overview of the this script ( Just a brief one would suffice) Here is the code :

Its easy to do, start a new file, and copy/paste the beginning of every "paragraph", that means every branch (if/else/unless) or loop (for/foreach/while/until)

Preserve the indentation level

This is the logic

Its like writing a good scientific essay/report/paper, simply reading the first and last paragraph and the first and last sentence of every intervening paragraph, will revel the main ideas of the paper

Are you going to try this?

  • Comment on Re: Main logic of this script (summary/abstract/outline)

Replies are listed 'Best First'.
Re^2: Main logic of this script (summary/abstract/outline)
by Anonymous Monk on Mar 09, 2015 at 09:21 UTC
    Here is my version, 1145 lines reduced to 208 comments

    This manual outline generation wouldn't be necessary if the original was skimmable code :)

      from 208 to 28 and 18

      options var init stuff

      meat and potatoes (read the log)

        So the skimmable version might have been (or the new refactored version might be)

        #!/usr/bin/perl -- Main( @ARGV ); exit( 0 ); sub Main { use Getopt::Long; my %opt; GetOptions( \%opt, ... ); my %needed = ValidateOptionsAndInitializeStuffWeNeed( \%opt ); return PrintHelp() if $opt{help_needs_to_happen}; return ReadTheLogBasedOnFormat( \%opt , \%needed ); } sub ValidateOptionsAndInitializeStuffWeNeed { my( $optref ) = @); ... if( ... ){ die "Unknown output type ..."; } ... }