in reply to HTTP Requests and Threading

A further point has just occurred to me.

Don't hard-code values in your subroutines, pass those values when calling. The reasons are much the same as I gave for TIMEOUT in my earlier comments.

Change

sub Pending_HTTP { my $file_write = 'Out_Stats.txt'; ... }

to

sub Pending_HTTP { my ($file_write) = @_; ... }

(and similarly for sub Print_File {...})

The calling code would then become something like:

my $outfile = 'Out_Stats.txt'; ... Pending_HTTP($outfile); Print_File($outfile);

If the filename changes, you'll only need to change the $outfile assignment; currently, you'd need to search and replace every occurrence of 'Out_Stats.txt'.

-- Ken

Replies are listed 'Best First'.
Re^2: HTTP Requests and Threading
by carlriz (Beadle) on Mar 07, 2014 at 16:11 UTC

    That's a good tip. Thanks