Created
March 7, 2009 10:06
-
-
Save frioux/75293 to your computer and use it in GitHub Desktop.
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
module Ghetto; | |
sub run($cmd) { | |
# create a random filename to store output in | |
my $tmp = ".tmp-{(1..100).pick}-ghetto"; | |
# use the real run command, :: means root namespace | |
::run("$cmd > '$tmp'"); | |
# open the file | |
my $data_file = open($tmp, :r); | |
# put the data from the file into a variable | |
my $val; | |
for =$data_file { $val ~= "$_\n"; } | |
# delete the file | |
unlink($tmp); | |
#gimme my data! | |
return $val; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment