Perl panic!

Need help with C, C++, perl, python, etc?

Perl panic!

Postby Lavene » 2006-10-25 14:38

I have this little problem:
I run a website and an IRC channel. The channel is 'guarded' by a bot I have written in Python. The channel suffers from idiots stopping by an causing trouble. So I got this great idea to have the bot ask for username and password from my site's MySQL database only to find out that my hosting provider don't allow direct access to the database server. Nor do they support CGI scripts written in Python. Soooo... I have to learn a bit of Perl.

And here is my idea: The channel is set to mode +m. The bot /msg every new person joining the channel and asks for username and password (no problem). It then, somehow, asks the Perl script on my web server to look it up in the database and feed the result back to the bot (problem). If a match is found it gives the person voice... if not it kicks him (no problem)

Question: I don't know the first thing about perl and could really need some pointers to get started. Just in general... the actual code I can figure out my self.

Thanks
Tina
Lavene
Site admin
 
Posts: 5096
Joined: 2006-01-04 04:26
Location: Oslo, Norway

Postby drl » 2006-10-26 14:06

Hi.

If I understand your problem, you need to learn perl in the context of CGI so that you can query a database.

If that's correct, then I suggest you look at O'Reilly's web site http://www.oreilly.com/ and once you are there, search for "cgi". That will bring up a large number of hits. The first might be all you need, CGI Programming with Perl, Second Edition, but there are also lots of articles that you could look at first.

I have the first edition of the CGI book, and I thought it was useful, but it did not concentrate on perl as the 2nd edition apparently does.

Best wishes ... cheers, drl
["Sure, I can help you with that." -- USBank voice recognition system.
( Mn, 2.6.x, AMD-64 3000+, ASUS A8V Deluxe, 3 GB, SATA + IDE, NV34 )
Debian Wiki | Packages | Backports | Netinstall
User avatar
drl
 
Posts: 434
Joined: 2006-09-20 02:27
Location: Saint Paul, Minnesota, USA

Postby dawgie » 2006-10-26 16:44

The older editions of many of the Oreilly books can be read online.
You might be able to find what you are looking for here:
http://www.oreilly.com/openbook/cgi/
User avatar
dawgie
 
Posts: 431
Joined: 2004-06-16 21:30
Location: New Hampshire USA

Postby Lavene » 2006-10-28 08:54

Thanks for the links! What a pleasant surprice Perl CGI scripting was. Using the 'DBI' database interface, writing the script I needed was a breeze.
Very nice language indeed :)

Tina
Lavene
Site admin
 
Posts: 5096
Joined: 2006-01-04 04:26
Location: Oslo, Norway


Return to Programming

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable