Lost Password?

Go Back   CodeCall Programming Forum > Web Development Forum > Perl

Perl Discussion for the PERL language - Practical Extraction and Reporting Language, is a programming language often used for creating CGI programs.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-21-2008, 06:10 AM
ReekenX's Avatar   
ReekenX ReekenX is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 77
Rep Power: 6
ReekenX is on a distinguished road
Send a message via Skype™ to ReekenX
Default Do I need append first line to every source code?

Hello all.

I am new to PERL. I have question about this line:

#!/usr/local/bin/perl

Does all perl source files must be with that same line (path to compiler of perl)? What if path in other host is not the same as in others? I know that this line tells to run the file through Perl.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 01-21-2008, 06:44 AM
v0id's Avatar   
v0id v0id is offline
Super Mod
 
Join Date: Apr 2007
Location: Denmark
Posts: 1,940
Last Blog:
CherryPy(thon)
Rep Power: 23
v0id is a splendid one to beholdv0id is a splendid one to beholdv0id is a splendid one to beholdv0id is a splendid one to beholdv0id is a splendid one to beholdv0id is a splendid one to behold
Send a message via MSN to v0id
Default

Your file doesn't need or require it, so you can leave it out. What it does is to tell where the Perl-interpreter is located, so that you can run the script with a double-click or similar.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-21-2008, 06:52 AM
ReekenX's Avatar   
ReekenX ReekenX is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 77
Rep Power: 6
ReekenX is on a distinguished road
Send a message via Skype™ to ReekenX
Default

So I can write PERL scripts without these lines? And it will work?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-21-2008, 06:52 AM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Age: 26
Posts: 4,707
Last Blog:
PHP: gzip Compression
Rep Power: 50
Jordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud of
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default

If you do not include it you will not be able to execute the Perl script with "./scriptname.pl" and will have to call it as "perl scriptname.pl". It will also not work via the web executed from Apache/your webserver software.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
Don't hesitate to ask any questions that you have! Check out our ASCII Calculator!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-21-2008, 06:57 AM
ReekenX's Avatar   
ReekenX ReekenX is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 77
Rep Power: 6
ReekenX is on a distinguished road
Send a message via Skype™ to ReekenX
Default

But what if I move script to other server where value of this first line
#!/usr/local/bin/perl
will be other? I will must replace these lines by hand or what?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 01-21-2008, 07:02 AM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Age: 26
Posts: 4,707
Last Blog:
PHP: gzip Compression
Rep Power: 50
Jordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud of
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default

Yes. Or you could create a symbolic link in /usr/local/bin/ to the new location of Perl (only in Linux).
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
Don't hesitate to ask any questions that you have! Check out our ASCII Calculator!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-21-2008, 07:07 AM
ReekenX's Avatar   
ReekenX ReekenX is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 77
Rep Power: 6
ReekenX is on a distinguished road
Send a message via Skype™ to ReekenX
Default

Big thanks Jordan. What is symbolic link? Its made by .htaccess:
Options FollowSymlinks
or what?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-21-2008, 07:09 AM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Age: 26
Posts: 4,707
Last Blog:
PHP: gzip Compression
Rep Power: 50
Jordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud of
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default

It is done at the operating system with the command: "ln -s /path/to/link".
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
Don't hesitate to ask any questions that you have! Check out our ASCII Calculator!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 01-21-2008, 07:14 AM
ReekenX's Avatar   
ReekenX ReekenX is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 77
Rep Power: 6
ReekenX is on a distinguished road
Send a message via Skype™ to ReekenX
Default

Ok, thanks Jordan for answers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 01-23-2008, 03:25 AM
KevinADC KevinADC is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 87
Rep Power: 6
KevinADC is on a distinguished road
Default

Easier to just edit the shebang line than changing the server configuration, unless you are the server administrator that is.

Apache can also be setup to not use the shebang line, but again, this is a server configuration and you may not be able to edit the apache config file or restart the apache server.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft to Release .NET Framework Source Code in v3.5 Kernel Programming News 0 10-05-2007 07:45 AM
Making it Standalone from Source Code (Python) annannienann Delphi/Python 8 10-02-2007 11:45 PM
HTML Basic Formatting clookid Tutorials, Classes and Code 14 03-06-2007 03:10 PM
Valve: Half-Life 2 Source Code falco85 General Programming 3 10-28-2006 05:03 PM


All times are GMT -5. The time now is 02:04 AM.

Contest Stats

dargueta ........ 128.00000
John ........ 127.00000
Xav ........ 107.00000
gaylo565 ........ 18.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

Ads