http://qs321.pair.com?node_id=11100485


in reply to Modernizing a Deploy script to standard distro v5.10.1

(Sorry for the delayed reply. I started then got interrupted by an emergency.)

You might also want to consider having DEPLOYER do a little more of the "grunt work".

You have 3 lists of the same files: pathsToDep­loy, filesToDep­loy and filesToCon­vert. You only need one list/table, then derive the individual lists.

In DEPLOYER, do

my %pathsToDep­loy; my %filesToDep­loy; my @filesToCon­vert; sub Deploy { my %ToDep­loy = @_; %pathsToDep­loy = map { $_ => $ToDep­loy{$_}->[0] } keys %ToDep­l +oy; %filesToDep­loy = map { $_ => $ToDep­loy{$_}->[1] } keys %ToDep­l +oy; @filesToCon­vert = keys %ToDep­loy ); # other code }

Then in your deploy script, you only need:

DEPLOYER::Dep­loy ( "MY_LAUNCHER_1102320­0099.sh" => [ '/fancy/deploy/path', 0775 ]­, "fileSanity.pl" => [ '/fancy/deploy/path'­, 0775 ], "transferFile.sh" => [ '/fancy/deploy/path'­, 0775 ], );

This will make the deploy scripts easier to configure because each file is mentioned only once, instead of the 3 times the legacy deploy scripts works and your current new proposal.

Also, as long as DEPLOY.pm has use File::Copy; the deploy scripts only need use DEPLOY;