Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

"Is it a Perl program or a Perl script?" What would p5p think ? What do you think ? :)

by zgrim (Friar)
on Feb 16, 2007 at 15:43 UTC ( [id://600458]=perlmeditation: print w/replies, xml ) Need Help??

A(nother) funny difference in attitude stroke me around December 2k6, as i was comparing some of the "dynamic languages" compilers for some problem.
Well, nevermind that problem, let's see this attitude thingie. :)
]$ python x.py python: can't open file 'x.py': [Errno 2] No such file or directory ]$ ruby x.rb ruby: No such file or directory -- x.rb (LoadError) ]$ perl x.pl Can't open perl script "x.pl": No such file or directory

I think it's nice that Perl is humbler here, but enter "web2.0 hype bulls**t bingo" age: given the pejorative attitude towards this word ("script"/"scripting"/etc - already discussed a few times even here, at the monastery), wouldn't we be happier to remove references to it from the source and get over this ? :)
There is a small note on the subject in the Perl documentation:
perldoc -q"Is it a Perl program or a Perl script?"
I'll just quote here its final phrase:
〈〈 Now that "script" and "scripting" are terms that have been seized by unscrupulous or unknowing marketeers for their own nefarious purposes, they have begun to take on strange and often pejorative meanings, like "non serious" or "not real programming". Consequently, some Perl programmers prefer to avoid them altogether. 〉〉

You do know this is true. :)
So, I thought to myself, let's take action, get past this denial phase. ( first with a small, "test-the-idea" patch )
Do you think p5p would ever accept a patch in this vein ? :)
@@ -3710,7 +3710,7 @@ if (PL_e_script) Perl_croak(aTHX_ "Can't open "BIT_BUCKET": %s\n", Strerror +(errno)); else - Perl_croak(aTHX_ "Can't open perl script \"%s\": %s\n", + Perl_croak(aTHX_ "Can't open Perl source file \"%s\": %s\n +", CopFILE(PL_curcop), Strerror(errno)); } return fdscript;
in perl.c.

( some may object that in its tradition, p5 would probably need this to go through a deprecation cycle, as there might be some code out there relying on this particular error message. hm, or maybe not.)

So, what do you think ? Should such a "bug" be submitted ? :)
PS: And ... well, yes, maybe the smart attitude would be to not care about this non-issue at all. But hey, wth, it's Friday. :)
PPS: Do take it as the half-joke it is. Which half you see, well that i'm interested in. :) Thanks.

--
perl -MLWP::Simple -e'print$_[rand(split(q|%%\n|, get(q=http://cpan.org/misc/japh=)))]'
  • Comment on "Is it a Perl program or a Perl script?" What would p5p think ? What do you think ? :)
  • Select or Download Code

Replies are listed 'Best First'.
Re: "Is it a Perl program or a Perl script?" What would p5p think ? What do you think ? :)
by Joost (Canon) on Feb 16, 2007 at 15:54 UTC
    web2.0 hype bulls**t bingo
    Web 2.0 / Ajax oddly enough is rehabilitating JavaScript as a serious language. :-) I think the current tide is just the reverse of what you describe; "interpreted" (edit: and "dynamic") languages like javascript, ruby and python are hot, "serious", "compiled" languages like java and C++ are not.

    edit2: please note that I am not at all interested in debating the definitions of the "quoted" words

      Yup, of course you're right there, but given the context, i meant it as to label the "scripting" vs "dynamic" languages dispute, as in the "web2.0 hot" ones are those labeled "dynamic". :)

      --
      perl -MLWP::Simple -e'print$_[rand(split(q|%%\n|, get(q=http://cpan.org/misc/japh=)))]'
Re: "Is it a Perl program or a Perl script?" What would p5p think ? What do you think ? :)
by perrin (Chancellor) on Feb 16, 2007 at 20:51 UTC
    I think I see a typo in your patch:
    + Perl_croak(aTHX_ "Can't open Perl Enterprise Application \ +"%s\": %s\n
Re: "Is it a Perl program or a Perl script?" What would p5p think ? What do you think ? :)
by Old_Gray_Bear (Bishop) on Feb 16, 2007 at 19:35 UTC
    I have always referred to the things I write to be run by a machine as 'code'. As in "This FORTRAN code calculates the centroid of an object", or "That Perl code monitors these logs and sends alerts".

    I know folks who really try hard to make a distinction between 'compiled' and 'interpreted', the former being "code" and the latter "script"; but they are having a tough go explaining to me why Java is code and preprocessed C isn't script.

    Personally, I have always thought the distinction was merely semantic. "Code versus Script" serves the niche in Geekdom that "How 'bout them Dogs" serves for Football fanatics. It's a good starting place for a conversation in the Local after work, and a reason for ordering another round of beer; but it's not really meaningful in the larger scheme of things.

    ----
    I Go Back to Sleep, Now.

    OGB

Re: "Is it a Perl program or a Perl script?" What would p5p think ? What do you think ? :)
by chromatic (Archbishop) on Feb 16, 2007 at 19:39 UTC
    package Foo; # some code here package main; return 1 if caller(); print "as a program\n";

    Calling it as a program:

    $ perl Foo.pm Called as a program!

    ... and as a module:

    $ perl -MFoo -e 1 $

    Calling a non-existent module as a program:

    $ perl Bar.pm Can't open perl script "Bar.pm": No such file or directory

    The word "script" does seem inaccurate.

Re: "Is it a Perl program or a Perl script?" What would p5p think ? What do you think ? :)
by shmem (Chancellor) on Feb 16, 2007 at 22:33 UTC
    Have to dig up where I got this one from...
    A script is what you give to actors. A program is what you give to the audience.

    So, if it barfs, it's a script. If it runs smooth, it's a program.

    update: Doh! There's a link in a davorgs's post to Larry's quote in this thread...

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re: "Is it a Perl program or a Perl script?" What would p5p think ? What do you think ? :)
by rinceWind (Monsignor) on Feb 16, 2007 at 16:01 UTC
    See perl FAQ 1.8

    --

    Oh Lord, won’t you burn me a Knoppix CD ?
    My friends all rate Windows, I must disagree.
    Your powers of persuasion will set them all free,
    So oh Lord, won’t you burn me a Knoppix CD ?
    (Missquoting Janis Joplin)

Re: "Is it a Perl program or a Perl script?" What would p5p think ? What do you think ? :)
by starX (Chaplain) on Feb 22, 2007 at 18:43 UTC
    Since I work in the entertainment industry (mostly in theatre), I think it's actually valuable to look at the etymology of why we call them "scripts" in the first place. I always made the connection that a script is a series of commands that tell a bunch of programs how to work together to make something meaningful happen.

    Have you seen live improv theatre? Sometimes, and only very rarely and/or with very good actors, does it ever work. Actors tend not to do very well on their own. That's why we have playwrights and directors to help them out. You can toss a bunch of them up on stage and let them play, just like you can have a bunch of executables in your path, but they all work so much better when you have something telling them what to do.

    So a script relies on external programs to do the bulk of its work, and a program does not. We have a lot of modules and libraries kicking around, so the distinction gets blurred somewhat, but there is an important difference. Most of what makes a shell script work can be used on its own; not so with a program.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 15:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found