Closed Thread Icon

Topic awaiting preservation: Perl + MySQL (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12472" title="Pages that link to Topic awaiting preservation: Perl + MySQL (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Perl + MySQL <span class="small">(Page 1 of 1)</span>\

 
elitecodex
Obsessive-Compulsive (I) Inmate

From: Unknown, MD, USA
Insane since: Aug 2002

posted posted 10-15-2002 17:09

Ive been teaching myself Perl recently, and starting to get into the more advanced topics (like database interaction). I have found that I should use DBI::mysql to do this. However, I also found out that it is not a standard Perl package. So here is my question.

Is there a way to interact with the database via a standard perl installation (similar to that of PHP). If not, can I package DBI.pm with my apps to the program to use, and not have to install it on the system with super-user priveleges.

This way, a person can use my programs without needing to rely on installing other packages as well.

Thanks for any and all input.

Will



mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 10-15-2002 21:37

In order to use MySQL from PERL, you'll have to install DBI perl module and DBD::MySQL perl module (this module comes in two different versions 1.X and 2.X). And AFAIK, you can't simply distribute *.pm files with your script, because these modules also rely on libraries written in C that have to be compiled and installed together with them (everything is automated with make script)...


WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 10-15-2002 21:38

I may in no way be near 100% correct on this one. However, I do believe that you will have to have the DBI.pm installed on the system.

I also believe that the files need to be in the correct directory under the perl install, which I would guess would require super user privilages to install, since the directory should be protected. I also believe that many of the perl functions you are going to be working with will require a C or C++ interface to the database, and that is what the perl calls use. I don't think perl does this on its own. I might again be completely wrong on this, but that is how I thought it worked, therefore you can not if/else for loop your way into the database without the addon.

I think you must have SU to do it, if all else fails you might want to ask the system admin to find out just how this should work.

Piper
Paranoid (IV) Inmate

From: California
Insane since: Jun 2000

posted posted 10-15-2002 21:53

Hi Will,

You need to have the Driver (DBD) and the Interface (DBI::Mysql) installed to interact with the database. I've found that although these modules are not in the standard perl library they are usually already installed. I've only run into a couple of hosts that didn't have the modules installed and there was really no problem getting support to install them. I don't think you can package the modules with your apps but I don't know for sure. I do know that a non-root user can install the modules in a private directory for their use if they have shell access. cpan.org has deatils on installing the modules in a private library.

Regards,
Charlie

[edit]Oops, that should be DBD::Mysql and DBI...[/edit]

[This message has been edited by Piper (edited 10-15-2002).]

elitecodex
Obsessive-Compulsive (I) Inmate

From: Unknown, MD, USA
Insane since: Aug 2002

posted posted 10-15-2002 23:26

Thats what I was affraid of. Ill do that, just use the DBI with the MySQL DBD and require that they have it to use. Thanks for all the input

Will

« BackwardsOnwards »

Show Forum Drop Down Menu