Stop Microsoft

Miscellaneous => The Lounge => Topic started by: reactosguy on 6 October 2010, 21:01

Title: PHP or Perl?
Post by: reactosguy on 6 October 2010, 21:01
Which one should I go with?


My PHP scripts have been screwing up lately.


Perl is a bit insecure due to its CGI nature.


I need DB features.


PHP or Perl?
Title: Re: PHP or Perl?
Post by: Refalm on 6 October 2010, 23:50
JSP ;)

You'd be amazed at how many webhosters support it. It's also very stable and secure.

Also on PHP, it's kind of a hacked together language, so it's up to the coder to find a way to structure all the code, or fuck up completely (which is easy with PHP if you're just fucking around).

Perl is a bit more structured, and a lot of good websites are built on it. I'm sure most of the CGI exploits have been fixed over the years, since Perl as webscript is older than PHP and ASP.
Title: Re: PHP or Perl?
Post by: reactosguy on 7 October 2010, 01:08
JSP ;)

Why don't you use a JSP-based forum if JSP works?

I need something that's not Java, because I heard Oracle is taking it over and making it proprietary. I also asked, PHP or Perl?

Also on PHP, it's kind of a hacked together language, so it's up to the coder to find a way to structure all the code, or fuck up completely (which is easy with PHP if you're just fucking around).

True. PHP does take some concepts from other languages.

Perl is a bit more structured, and a lot of good websites are built on it. I'm sure most of the CGI exploits have been fixed over the years, since Perl as webscript is older than PHP and ASP.

I agree. I'd rather use Perl over PHP because Perl gets CGI.pm, which makes CGI on Perl heck a lot easier!

I wonder, how do you connect to a MySQL database in Perl? I know part of it, but how do I slam the MySQL username and password in there?
Title: Re: PHP or Perl?
Post by: Refalm on 7 October 2010, 09:39
Like this:
Code: [Select]
#!/usr/bin/perl

# PERL MODULE WE WILL BE USING
use Mysql;

# MySQL CONFIG VARIABLES
$host = "localhost";
$database = "store";
$tablename = "inventory";
$user = "username";
$pw = "password";
You need the MySQL module installed obviously.
Title: Re: PHP or Perl?
Post by: reactosguy on 7 October 2010, 21:01
Like this:
Code: [Select]
#!/usr/bin/perl

# PERL MODULE WE WILL BE USING
use Mysql;

# MySQL CONFIG VARIABLES
$host = "localhost";
$database = "store";
$tablename = "inventory";
$user = "username";
$pw = "password";
You need the MySQL module installed obviously.

I was thinking like this:
Code: [Select]
$db_handle = DBI->connect(dbi:mysql:database, undef, undef);

Page 368 of Perl In A Nutshell (1999, O'Reilly Media, ISBN 1-56592-286-7) taught me that, if you have it.

I could use your reply as well! It looks more up to date.
Title: Re: PHP or Perl?
Post by: piratePenguin on 16 October 2010, 13:09
Why aren't you considering Python I'd like to know?
Title: Re: PHP or Perl?
Post by: reactosguy on 16 October 2010, 19:05
Why aren't you considering Python I'd like to know?


Perl already has CGI.pm, amplifying forms. It makes CGI form processing simple. In addition, I am familiar with Perl, like my father.


Pyhton, on the other hand, is something I never want to get bitten by. My dad says that Python is another sub-par language used by fools.


PHP is easy to use and includes a lot of functions, but the "used more than max RAM" error is annoying me.


I should check into Python though. I've used Plone (another Python product), and it works great when you modify the Zope Database. In addition, Python doesn't require semicolons (Wikipedia said that) and it's growing.
Title: Re: PHP or Perl?
Post by: piratePenguin on 19 October 2010, 21:15
Python is used by Google and by NASA.
Title: Re: PHP or Perl?
Post by: reactosguy on 9 November 2010, 05:33
My dad says that Python is outclassed. In reality, it's not; it's popular with corporations. Heck, even an MMORPG is made from Python. Sadly, I tried it, but my inexperience and failure with mod_python led me to ditch it.

In the end, I'm happier with PHP or Perl. Python was a great suggestion, but I need more experience on it.
Title: Re: PHP or Perl?
Post by: piratePenguin on 11 November 2010, 18:36
forget mod_python and learn how to use Pylons or Django. Python+mod_python is hardly comparable to PHP: that's a very low-level interface. Pylons provides a much MUCH simpler, and better envirnment

but yeah its up to you. if you're used to php, python will be a little bit different.