LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-17-2007, 07:07 AM   #1
adam_blackice
Member
 
Registered: Apr 2006
Location: /*Egypt */ //cairo
Distribution: Ubuntu 7.04 , SLED 10 , Fedora , RHEL 5
Posts: 312

Rep: Reputation: 32
how to perl in linux


hello all ,

i want to use perl to make a program like webmin using web interface it will be suitable ???

and if i want to use it how can i use it it just making afile starting with #!/usr/bin/perl and write what i want to do ?

and if i want to use that script in web pages how can i do that ?

can i using apache an mysql in perl

and if i can do this can i use XAMMP tool ? like PHP ?

thanx 4 all

Last edited by adam_blackice; 02-17-2007 at 07:22 AM.
 
Old 02-17-2007, 07:48 AM   #2
Samoth
Member
 
Registered: Apr 2005
Distribution: Exherbo
Posts: 474
Blog Entries: 1

Rep: Reputation: 32
Yes, you can put #!/usr/bin/perl at the top of your program, but I don't think modern shells use that anymore, correct me if I am wrong, but that is pretty much for ash. Yes, you can use apache with perl and mysql. Lots of CGI scripts are made of perl, and there is a lot of basework so you pretty much just have to integrate multiple scripts together. It is sort of like building blocks, only you have to use glue.

Most programs are called using
Code:
perl /foo.pl
Hope this helps.
 
Old 02-17-2007, 07:56 AM   #3
adam_blackice
Member
 
Registered: Apr 2006
Location: /*Egypt */ //cairo
Distribution: Ubuntu 7.04 , SLED 10 , Fedora , RHEL 5
Posts: 312

Original Poster
Rep: Reputation: 32
so u mean i make the script and save it with foo.pl and it can be opend with any browser so i can use it in the web interface ?

and what about configuring perl by using XAMMP tool ?

thanx for replay
 
Old 02-17-2007, 01:49 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911
If you mean "looked at" by opened: yes, by all means. If
you mean "something gets executed on the server side": no,
for that you need to configure apache (or whatever xampp
uses/does) to allow CGI/Perl.


Cheers,
Tink
 
Old 02-19-2007, 04:59 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Debian, Mint, Puppy, Raspbian
Posts: 3,421

Rep: Reputation: 200Reputation: 200Reputation: 200
you got apache installed?

http://localhost/manual should work if so.
you need to enable a cgi directory in apache
put scripts in directory (named blah.cgi) and chmod +x 'em
 
Old 02-19-2007, 07:13 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,488

Rep: Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408
Samoth, there are 2 ways to run a perl script:

1. #!/usr/bin/perl at the top of the script (although I recommend #!/usr/bin/perl -w )
or
2. perl foo.pl

The first enables you to run a script just by naming it ala bash (must have x perm(s) of course)
The second works if no x perms on the file.
Personally I find (1) neater/tidier.
I believe you'll find most perl scripts are written the first way, even though you can invoke them the either way I believe.
I've never heard of it having anything to do with the shell eg ash.
bigearsbilly and matthewg42 seem to be keen perlers, so I'll await their comments....
 
Old 02-20-2007, 02:18 AM   #7
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Debian, Mint, Puppy, Raspbian
Posts: 3,421

Rep: Reputation: 200Reputation: 200Reputation: 200
very correct
-w is a verygood idea and use strict in all but the most trivial scripts.

there is an interesting difference between -w and
use warnings namely the first will invoke warnings in used modules and
the other does not. useful for avoiding warnings in modules you call in your script.
 
Old 02-20-2007, 06:13 AM   #8
adam_blackice
Member
 
Registered: Apr 2006
Location: /*Egypt */ //cairo
Distribution: Ubuntu 7.04 , SLED 10 , Fedora , RHEL 5
Posts: 312

Original Poster
Rep: Reputation: 32
thanx all for replaying
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RHEL4u2 perl localtime() call issues (perl & glibc) Brad.Scalio@noaa.gov Linux - Enterprise 3 01-23-2007 09:27 PM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 10:22 AM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM
chrooting apache v2 (php, ssl, perl support) ; perl configuration markus1982 Linux - Security 3 01-26-2003 06:15 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration