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.
Do I need append first line to every source code?
Started by ReekenX, Jan 21 2008 04:10 AM
10 replies to this topic
#1
Posted 21 January 2008 - 04:10 AM
www.jarmalavicius.lt | www.github.com/reekenx | www.twitter.com/reekenx
|
|
|
#2
Posted 21 January 2008 - 04:44 AM
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.
#3
Posted 21 January 2008 - 04:52 AM
So I can write PERL scripts without these lines? And it will work?
www.jarmalavicius.lt | www.github.com/reekenx | www.twitter.com/reekenx
#4
Guest_Jordan_*
Posted 21 January 2008 - 04:52 AM
Guest_Jordan_*
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.
#5
Posted 21 January 2008 - 04:57 AM
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?
#!/usr/local/bin/perl
will be other? I will must replace these lines by hand or what?
www.jarmalavicius.lt | www.github.com/reekenx | www.twitter.com/reekenx
#6
Guest_Jordan_*
Posted 21 January 2008 - 05:02 AM
Guest_Jordan_*
Yes. Or you could create a symbolic link in /usr/local/bin/ to the new location of Perl (only in Linux).
#7
Posted 21 January 2008 - 05:07 AM
Big thanks Jordan. What is symbolic link? Its made by .htaccess:
Options FollowSymlinks
or what?
Options FollowSymlinks
or what?
www.jarmalavicius.lt | www.github.com/reekenx | www.twitter.com/reekenx
#8
Guest_Jordan_*
Posted 21 January 2008 - 05:09 AM
Guest_Jordan_*
It is done at the operating system with the command: "ln -s /path/to/link".
#9
Posted 21 January 2008 - 05:14 AM
Ok, thanks Jordan for answers.
www.jarmalavicius.lt | www.github.com/reekenx | www.twitter.com/reekenx
#10
Posted 23 January 2008 - 01:25 AM
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.
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.
#11
Guest_Jordan_*
Posted 23 January 2008 - 05:13 AM
Guest_Jordan_*
This is true, you will need root access to accomplish these things. Why does the shebang line concern you?


Sign In
Create Account


Back to top









