On 2010-04-19 21:21:45 +1200, newbie01 perl wrote:
> I need to convert a lot of UNIX scripts into Perl.

No, you are trying to convert a Perl script written for Unix into a Perl
script which runs on Windows.

> 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.

Then why do you ask on the DBI mailing list?

> The scripts will be running locally on the servers so technically it
> should be able to connect to the database without using a password.

I don't see what that has to do with your problem.


> 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."

I assume that error comes from cmd.exe when it tries to execute 
the line 

>    sqlplus -S "/as sysdba" <<SQLEND

It has been a long time since I wrote DOS/Windows style batch files, but
I doubt that cmd.exe has learned about here documents since then. 


> Can anyone please advise what I needed to change to get both
> running for UNIX and Windows?

Use DBI. Seriously. use DBI.

If you really can't, you could write the input to sqlplus into a
temporary file and then invoke it like
sqlplus -S "/as sysdba" <$tmpfile.
Or you could use IPC::Open2 (but I'm not sure whether that works on
Windows).

        hp

-- 
   _  | Peter J. Holzer    | Auf jedem Computer sollte der Satz Ludwigs II
|_|_) | Sysadmin WSR       | eingeprägt stehen: "Ein ewig Rätsel will ich
| |   | h...@wsr.ac.at      | bleiben, mir und andern."
__/   | http://www.hjp.at/ |    -- Wolfram Heinrich in desd

Attachment: signature.asc
Description: Digital signature

Reply via email to