Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Do I need append first line to every source code?

  1. #1
    ReekenX's Avatar
    ReekenX is offline Programmer
    Join Date
    Jan 2007
    Location
    Lithuania
    Posts
    135
    Rep Power
    0

    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.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    v0id is offline Retired
    Join Date
    Apr 2007
    Posts
    2,937
    Blog Entries
    3
    Rep Power
    42
    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.

  4. #3
    ReekenX's Avatar
    ReekenX is offline Programmer
    Join Date
    Jan 2007
    Location
    Lithuania
    Posts
    135
    Rep Power
    0
    So I can write PERL scripts without these lines? And it will work?

  5. #4
    Jordan Guest
    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.

  6. #5
    ReekenX's Avatar
    ReekenX is offline Programmer
    Join Date
    Jan 2007
    Location
    Lithuania
    Posts
    135
    Rep Power
    0
    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?

  7. #6
    Jordan Guest
    Yes. Or you could create a symbolic link in /usr/local/bin/ to the new location of Perl (only in Linux).

  8. #7
    ReekenX's Avatar
    ReekenX is offline Programmer
    Join Date
    Jan 2007
    Location
    Lithuania
    Posts
    135
    Rep Power
    0
    Big thanks Jordan. What is symbolic link? Its made by .htaccess:
    Options FollowSymlinks
    or what?

  9. #8
    Jordan Guest
    It is done at the operating system with the command: "ln -s /path/to/link".

  10. #9
    ReekenX's Avatar
    ReekenX is offline Programmer
    Join Date
    Jan 2007
    Location
    Lithuania
    Posts
    135
    Rep Power
    0

  11. #10
    KevinADC is offline Programmer
    Join Date
    Jan 2007
    Posts
    125
    Rep Power
    0
    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.

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 09-05-2011, 03:33 AM
  2. How do i put a line break on this code?
    By lil-fino in forum PHP Development
    Replies: 8
    Last Post: 05-12-2010, 09:18 PM
  3. ned code on-line casino
    By volk2777 in forum General Programming
    Replies: 0
    Last Post: 04-24-2010, 03:48 PM
  4. Can someone please explain this line of code to me?
    By Demodex in forum C# Programming
    Replies: 4
    Last Post: 12-24-2009, 07:07 AM
  5. strange line of code
    By probashi in forum General Programming
    Replies: 4
    Last Post: 11-16-2009, 10:24 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts