in reply to Re^2: RFC: beginner level script improvement (various comments)
in thread RFC: beginner level script improvement
First of all thank you very much for taking the time to read through and comment on the script.
I was very unhappy with the locally disabling warnings thing to begin with but failed to come up with a better solution and the entire loop construct is required so the different device output cases are tested and responded accordingly, with respective timeouts and further actions.
Using the return value of the expect method itsself hadn't occured to me at all, which is very sad considering how obvious it should have been (always is in hindsight when someone else did the thinking for you). Thank you very much for this hint. I will change that section and remove the ugly warnings thing.
I like some of the "useless" \%{$} and a-like constructs (as long as they don't constitute mistakes) as well as
captitalization of some vars because it helps me keep track of where what comes from and why, what it contains and who accesses it, purely by naming and how it is referred to. However I still haven't fixed all inconsistency mistakes in the system.
The config-hash related changes you propose make a lot more sense than what I'm doing and I'll change the respective parts. Thank you very much for the pointers.
Same goes for the tempfile part.
regarding the unpacking a sub argument part
I read the unshift and sub documentation again and I still don't understand your hint.
As far as I understand the @_ is a list that contains all arguments the sub was called with and consequently $_[x] would contain the element of that array with index x. I would understand using any of the three below because they produce the identical result in regards to $bar_ref, (while I think shift only makes sense if something might or might not be present at a specific index after 0)
But the unshift thing I don't understand at all.foo(\%bar); sub bar { my $bar_ref = $_[0]; #I know what is at index 0 and that's what I +want my ($bar_ref) = @_; #same as above but I can not process anything +else from the list my $bar_ref = shift; # same as #1 but I want to continue processin +g @_ and am unsure about indexes and/or presence }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: RFC: beginner level script improvement (various comments)
by smls (Friar) on Oct 31, 2013 at 03:20 UTC | |
by georgecarlin (Acolyte) on Nov 04, 2013 at 13:25 UTC | |
by smls (Friar) on Nov 05, 2013 at 07:32 UTC |