Re: Any good Perl coders out there?



In <GMhMh.21970$Uk6.15371@xxxxxxxxxxxxxxxxxxxxxxxxxx>,
Timo Jokinen <jokinentimo@xxxxxxxxxxxxxxxxxxx> mentions:
Michael Vilain wrote:
In article <1174493670.753360.57970@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"amerar@xxxxxxx" <amerar@xxxxxxx> wrote:

Hi All,

I need to convert a PHP script into Perl. This PHP script interacts
with our Oracle database. It executes some stored procedures and
returns values. I've pasted the PHP code below, I'm just not sure how
to code it in Perl & DBI. Can anyone help?? I would really
appreciate it.

PHP CODE
----------------
$conn = ociplogon("scott", "tiger", "ABCD.world");
$curs = OCINewCursor($conn);
$stmt = OCIParse($conn,"BEGIN AUTO_CHARGE.EXP_RENEW_SUBSCR(:data);
end ;");
ocibindbyname($stmt,"data",&$curs,-1,OCI_B_CURSOR);
ociexecute($stmt);
ociexecute($curs);

while (OCIFetchInto($curs,&$data)) {
$customer_id = $data[0];
$owner_name = $data[1];
$type = $data[2];
$code = $data[3];
.
.
.
}

Sorry but if you doesn't want to help him/her don't bother to
write your sarcastic's answer's.

Well said!

This is part of the reason perl is loosing ground to other languages like PHP.


Here we have a perfectly good opportunity to introduce someone to the wonders
of perl and we've thrown it away. The original poster will probably walk away
from all this thinking

"Perl? phew! no thanks!"


As far as offering a helpful answer, (to the original post) what you'll want to
do is check out the DBI and DBD modules at your friendly neighborhood CPAN
archive.

DBI is the modern way perl programs communicate with databases, DBI is a
generic interface. DBD is the actual database driver for it. (there is
one DBI and separate DBD's for each particular database.)

You'll find that with with the standard interface of DBI, porting your
application to other databases is a bit easier.

Do a 'perldoc DBI' for the details, it's quite easy once you get around to
understanding statement handles and connection handles. (these are a bit like
Resource handles of PHP)

You'll also want to glance over the DBD driver for oracle to find the connection
string details.

Jamie
--
http://www.geniegate.com Custom web programming
Perl * Java * UNIX User Management Solutions
.



Relevant Pages

  • Re: How to access MS Access from Perl?
    ... if you were to later migrate to MS SQL Server or Oracle ... minimize your load on the database server's compiled procedure cache. ... On the other hand, if startup time for your perl script is an issue, and ... slightly preferable to the bulkier DBI + DBD::ODBC. ...
    (comp.lang.perl)
  • Re: DBD::Informix and SIGBUS in perl
    ... use DBI; ... > My program is a CGI script in perl, which provides web-access to a database ... assigned to a DBD::Informix database handle. ... > LANGUAGE (unset) ...
    (perl.dbi.users)
  • ANNOUNCE : DBIx::DataModel
    ... This is to announce yet another wrapper module on top of DBI, ... Please have a look and see whether it can help suit your needs. ... base DBI layer and to the basic Perl datastructures, ... will not create the database itself. ...
    (perl.dbi.users)
  • Re: Coverting perl to php
    ... I am bout ready to convert it to php but wonder if there are ... but there's nothing to match a good perl person porting their ... The reason for the rewrite is because a large chunk of the ancilary ... code to talk to the database, recreating what they did, and having 2 ...
    (comp.lang.php)
  • Re: file parsers
    ... Try DBI and DBD::ODBC. ... Most database programming in Perl is done with the DBI (database ... On Windows, most database programming goes through the ODBC bridge, ...
    (perl.beginners)

Loading