Re: Help on using << on *nix and Windows

[email protected] (Shlomi Fish)
Newsgroups perl.dbi.users,perl.beginners
Message-ID <[email protected]>
Hi newbie01,

On Monday 19 Apr 2010 12:21:45 newbie01 perl wrote:
> Hi all,
> 
> I need to convert a lot of UNIX scripts into Perl. Most of them uses the
> UNIX's EOF/EOL functionality. These scripts are mostly used to connect to
> Oracle databases. At the moment, installing a DBI is not an option. 

See:

http://www.shadowcat.co.uk/blog/matt-s-trout/but-i-cant-use-cpan/

> The
> scripts will be running locally on the servers so technically it should be
> able to connect to the database without using a password.
> 
> Example of a very simple test script is as below. If I run the script on
> UNIX, it is all good. But on Windows, it gives the error "<< was unexpected
> at this time." Can anyone please advise what I needed to change to get both
> running for UNIX and Windows?
> 
> Thanks in advance.
> 
> Sample test code below:
> 
> 
> sub test_01()
> {
>    print "+-------------------------------------+ \n";
>    print "Running :: sub test-01 !!! \n";
>    print "+-------------------------------------+ \n";
> 
>    print << `EOL`;
>    sqlplus -S "/as sysdba" <<SQLEND

The <<SQLEND here document is parsed and executed by the UNIX shell, and it is 
not supported on the Win32 excuse for a shell called CMD.EXE. You can try 
doing it using cygwin or something if that is an option or alternatively 
writing these command to a file first and then loading it using 
"< input-file.txt" which is more portable.

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
"The Human Hacking Field Guide" - http://shlom.in/hhfg

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.