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

Re: Modules as executable scripts?

by gerases (Sexton)
on Mar 16, 2017 at 17:08 UTC ( #1184906=note: print w/replies, xml ) Need Help??


in reply to Modules as executable scripts?

So no way to change to the "pm" extension so that the script could be named either with ".pl" or without any extension?

Replies are listed 'Best First'.
Re^2: Modules as executable scripts?
by RonW (Parson) on Mar 16, 2017 at 21:16 UTC

    use requires that the module's files have a ".pm" extension.

      It's true about "use", but "require" doesn't. And that could be the ticket for making modulinos less weird on the command line.

        True, but then it's "weird" to use from a program or other module:

        BEGIN { require "Modulino.pl"; Modulino::import; }

        instead of the usual:

        use Modulino;

        I think it's better to put up with the weirdness in the modulino than forcing weirdness into programs and other modules that try to use the modulino.

        It's true about "use", but "require" doesn't. And that could be the ticket for making modulinos less weird on the command line

        Hi

        modulinos are golf, which is a game, a gimmick, and not a feature to be used for work,

        so say no modulinos , an evil gimmick )

        If a user can be bothered to create a  symlink. I.e., /bin/something -> path_to_pm

        Then the user can be bothered to create

        cat>/bin/something use TheModule; TheModule::BinSomething( @ARGV );

        Its literally no effort at all to accomplish, esp if bin/something is created by the module installation software

        The only thing modulinos can accomplish is to substitute 1 symlink for 1 regular file -- what a ridiculous goal to write extra code for

Re^2: Modules as executable scripts?
by Anonymous Monk on Mar 16, 2017 at 17:18 UTC
    "This flexibility is a common feature in Python ..."

    And who needs it? Here's what you cannot do in Python that you can in Perl and Ruby: run Python as an ad hoc filter. So there is that. If you are trying to say Python is better than Perl then you just failed.

    perl -pi.bak -e's/foo/bar/g' python.txt
    You can't do that in Python! But you can run a .pm file as a script if you are dumb enough to think that's a good thing.
      I think it will work through a symlink. I.e., /bin/something -> path_to_pm

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2021-06-14 06:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (60 votes). Check out past polls.

    Notices?