Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^4: Supressing warnings

by morgon (Curate)
on Jul 22, 2010 at 23:27 UTC ( #850939=note: print w/replies, xml ) Need Help??

in reply to Re^3: Supressing warnings
in thread Supressing warnings

Yeah, ok there may be some uses like yours (which I would consider a hack), but in general (at least that would be the behaviour of least surprise) you (ok: I) would expect that when you run a script as "" you get your command-line flags from the shebang-line and when you run it as "perl <whatever flags>" your get it from - well - the command line.

With this behaviour I cannot run a script with different flags without having to modify it if it contains a shebang lines with flags.

Do Python and Ruby do this as well?

Replies are listed 'Best First'.
Re^5: Supressing warnings
by almut (Canon) on Jul 23, 2010 at 00:14 UTC
    With this behaviour I cannot run a script with different flags without having to modify it if it contains a shebang lines with flags.

    You could also argue the other way round, i.e. it provides for consistency independently of how exactly the interpreter is being invoked — in particular as there are some operating system that don't handle shebangs (one rather commonly used one is among them...).

    And some options might be an integral part of a script, or at least important to its proper functioning — like -n, -p, -l, -C (which didn't work on the shebang line until recently, btw), etc. — so I would rather want them to remain in effect when I call the script as perl .

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://850939]
[ambrus]: choroba: heh heh... I have such a doc bug report somewhere. fixed by now.
[Corion]: Once upon a time I had automatic tests for checking the synopsis, but I stopped doing that because the setup was too fragile on CPAN testers for extracting code from the SYNOPSIS.
[Corion]: Maybe I should move the extraction of the code from the SYNOPSIS section into the author tests, or something like that...
[choroba]: Corion Sounds reasonable
[Corion]: choroba: Yeah - I basically have the same for regenerating README and README.mkdown already, except that I do that in Makefile.PL, but I guess one or the other thing should somehow work ;)
[ambrus]: was this bug: https://rt.cpan. org/Public/Bug/ Display.html?id= 59814
[Corion]: ambrus: Oh - that one would be much harder to automate... The SYNOPSIS section should mostly be a runnable program IMO, but I write only small snippets in my documentation for single functions/methods, and creating the appropriate environment for ...
[Corion]: ... those in an automated fashion seems somewhat hard to me. Although it should do wonders for the test coverage ;)

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2017-02-27 12:14 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (383 votes). Check out past polls.