Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: What's in a Name?

by Abigail-II (Bishop)
on May 29, 2002 at 10:17 UTC ( [id://170020]=note: print w/replies, xml ) Need Help??


in reply to What's in a Name?

First, I'd like to say something about the extension. There's a tendency to have Perl programs end in '.pl'. Why is that? We type 'ls', 'mutt' and 'netscape', not 'ls.exe', 'mutt.exe' or 'netscape.exe'. Why would you want to type 'tool.pl' to execute the tool? That requires users to remember in which language a tool is written. If you later replace the tool by a better version, this time written in Python, will users be pleased if they now have to type 'tool.py'?

I use '.pl' for files I'm still working on. But as soon as they escape from their development directory, and are place in a directory that might be in someones PATH, the '.pl' gets dropped.

Names should, IMO, be descriptive. "buch.pl" might be cute, and I can guess that it's dealing with books, but not that it actually orders books. If it orders books, I'd call it "orderbooks" or "order_books". No ".pl" - the language in which it's written should not matter for the results. I don't really care if a name is long. We don't live in the early 70s anymore, nowadays we have shells with filename and command completion, and we have aliases too.

Now, for scripts I only use once, or just to test things out, I usually use 'x.pl', 'y.pl', 'z.pl', and other one letter combinations. And more than 90% of the time, they will be placed in '/tmp'.

Abigail

Replies are listed 'Best First'.
Re: Re: What's in a Name? (extensions)
by Jenda (Abbot) on May 29, 2002 at 23:31 UTC

    Let's talk about Windows first:
    First if it's not a CGI, but a command line utility it is necessary to give those files an extension. The only other solution would be to force the users to use a Unix shell. That's be even harder on most of them.
    Second ... the fact that you do not have to enter the .exe should lead to a question "Is it possible to set the system so that you do not have to type .pl?" And of course it is. You just have to add that extension to the list in PATHEXT system variable. Easy to do in a network login script or something, isn't it?

    So then the script files do end with .pl, but everybody may call them without.

    Then CGIs under Windows:
    if you use Apache you do not need the extensions, if you use IIS you do. In either case it's not such a big problem to make a redirect there somewhere so that both addresses work.

    For Unix:
    yeah you are right that there the extensions are not needed. I find that way of handling files a bit crazy, but that's another point.

      Jenda

Re: Re: What's in a Name?
by shotgunefx (Parson) on May 29, 2002 at 10:53 UTC
    Many times I find using a pl extension convienent. I use probably about 90% of the time. For utils I don't use it. Then again most of my programs are run on my servers and not by end users.

    -Lee

    "To be civilized is to deny one's nature."
Re: Re: What's in a Name?
by schumi (Hermit) on May 29, 2002 at 11:42 UTC
    I do agree with you as long as we're talking about user-called scripts. However, webservers tend to insist on extensions.

    As far as why I'm using extensions for non-web scripts, I do admit that this is mainly a habit - I'm still mostly working on windoze.

    --cs

    There are nights when the wolves are silent and only the moon howls. - George Carlin

      However, webservers tend to insist on extensions.

      That's just a matter of configuration.

      Abigail

        <topic offness="slight">

        How would you configure Apache to be extension-less given that you need things like:

        AddType application/x-httpd-php3 .php3 # For PHP AddType application/x-tar .tgz # For 'shorthand' tar.gz AddType text/html .shtml # For server-parsed
        to have it send the proper 'content-type' to the broswer?
        </topic>

        As an aside, I completely agree that end user apps should be extensionless. I don't think extensions are a bad thing for webservers. How often do you enter http://www.perlmonks.org/index.pl?node_id=3628 in the location bar of your browser? Odds are you type http://www.perlmonks.org and click 'Newest Nodes' or just have a bookmark...

        /\/\averick
        OmG! They killed tilly! You *bleep*!!

      Even if they do, .pl has no reason to be. Call them .cgi if necessary. It may sound silly, but there's no reason to be telling anyone what language your scripts are written in.

      Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://170020]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-03-29 13:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found