Skip to content

Instantly share code, notes, and snippets.

@korjavin
Last active May 6, 2019 15:46
Show Gist options
  • Save korjavin/4737335 to your computer and use it in GitHub Desktop.
Save korjavin/4737335 to your computer and use it in GitHub Desktop.
perl reload
> perl reload.pl master!
router1
router1
router1
router1
router1
sig
$DB_USER = 'router1';
router1
router1
router1
router1
router1
sig
$DB_USER = 'router2';
router1
router1
router1
router1
router1
^C
package MyConfig;
use strict;
use base 'Exporter';
BEGIN {
our @EXPORT = qw($DB_USER );
}
our @EXPORT;
use vars @EXPORT;
$DB_USER = 'router2';
#!/usr/bin/perl -w
use MyConfig;
$SIG{ALRM} = sub { delete $INC{"MyConfig.pm"}; require MyConfig; MyConfig->import;alarm 5 ; print "sig \n"; };
alarm 5;
my $j=0;
while (1) {
print $DB_USER, "\n";
sleep 1;
print `cat ./MyConfig.pm | grep 'DB_USER = '` if ((++$j)%5==0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment