in reply to Creating Variables Just to Pass into Subroutine?
Since your job is to refactor, i recommend using named parameters with defaults:
sub ampNotify { my %args = @_; # set defaults $args{severity} = defined $args{severity} ? $args{severity} : 3; $args{othercontact} ||= 'None'; .... }
And then you can call like so:
ampNotify( message => join( "\n", "Server: $server", "File: $origfile", "Erro +r: foo" ), subject => "Error processing $filename", who => 'su_and_it', path => $work_dir, file => $missingdeptfilename, );
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Creating Variables Just to Pass into Subroutine?
by mdskrzypczyk (Novice) on Jul 22, 2015 at 13:42 UTC |