This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub addDashes | |
{ | |
my $originalFileName = shift; | |
#split along uscores into array | |
my @parts = split('_',$originalFileName); | |
# take the third index of the array and add dashes in this pattern ####-##-## and put it back in the array | |
$parts[2] = join('-', unpack('A4A2A2', $parts[2])); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $path = '/home/opuperl'; | |
opendir my($dirh), $path or die "can't opendir $path: $!"; | |
my @flist = sort { -M $a <=> -M $b } # sort by mod time | |
map { "$path/$_" } # need full paths for sort | |
grep ! m/^\./ # remove dotfiles | |
,readdir $dirh; | |
closedir $dirh; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub flipSwitch{ | |
my $file = shift; | |
my $fileHandle; | |
my $value; | |
open($fileHandle,'<',$file) || warn "cant open switch file $!"; | |
$value = <$fileHandle>; | |
close($fileHandle); | |
chomp($value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while(){ | |
runUntilEnterPressed(); | |
enterWasPressed(); | |
} | |
sub runUntilEnterPressed{ | |
my $input; | |
my $select_object = IO::Select->new(); $select_object->add(\*STDIN); | |
my $sleep = .1; | |
until($input){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $PARTITION = "================================================================================\n"; | |
my $PARTITIONLENGTH = length($PARTITION)-1;#-1 to remove newline from count | |
my $emptySpaceLen = $PARTITIONLENGTH - length($partOne.$partTwo.$partThree.$partFour); | |
my $divider = makeDivider($emptySpaceLen, 4); | |
my $return = "$partOne$divider$partTwo$divider$partThree$divider$partFour\n"; | |
$return .= $PARTITION; #for this application i needed a partition after each section | |
return $return; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub getCount{ | |
my $DH; # Directory Handle | |
my $WD = $_[0]; # Working Directory | |
my $DE; # Directory Entry (file) | |
my $CT; # Count | |
$CT=0; | |
opendir($DH, $WD) or die "Cannot open working directory |$WD|: $!"; | |
while ($DE= readdir($DH)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub clearScreen{ | |
system $^O eq 'MSWin32' ? 'cls' : 'clear'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $switchName = "Debug Switch"; | |
open($switchFileHandle,'<',$switchFile) || warn "cant open switch file $!"; | |
$switch = <$switchFileHandle>; | |
close($switchFileHandle); | |
chomp($switch); | |
if($switch){$switch = "ON";} | |
else{$switch = "OFF";} | |
$switchString = "$switchName($switch)"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get the submodule initially | |
git submodule add ssh://bla submodule_dir | |
git submodule init | |
# time passes, submodule upstream is updated | |
# and you now want to update | |
# change to the submodule directory | |
cd submodule_dir |