....same code needs to run on win and unix.
Well this will not run on Windows open SQLP, "|sqlplus -s /nolog >> $output_file_name "
If you want it portable you will just have to write some more code probably using DBI. You will be hard pressed to get system calls that will port although you can branch. For example in some of my application installation scripts I will often do this sort of thing to get the required behaviour, quotes, grammar, etc, etc:
my $OS = $^O; my $cwd = cwd(); my $script = $0; $OS =~m/MSWin32/ ? system('cls') : system('clear'); [blah] sub cpan_install { my ( @modules ) = @_; # get the right quotes for the OS Win wants " *nix wants ' my $quote = $OS =~m/MSWin32/ ? '"' : "'"; print " I will now try to install the missing modules using the CPAN shell. If you have not used this before you will need to answer a number of initialization questions. You can generally just accept the defaults and it will work. Unfortunately if you have not used it before and try + to use it here it will hang invisibly waiting for your input, so you w +ill need to run it from the command line using the command below....\n\n"; for my $module ( @modules ) { my $cmd = 'perl -MCPAN -e ' . $quote . 'install '. $module . $ +quote; print "Trying to install $module command line $cmd\nPlease be +patient.....\n"; print `$cmd`; } }
It works on *nix and Win but the code per se is not portable - there is just different code for each system....
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: read return value from a sql script using piped open
by tachyon
in thread read return value from a sql script using piped open
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |