GithubHelp home page GithubHelp logo

Comments (8)

zoffixznet avatar zoffixznet commented on July 30, 2024

Given the docs for the two variables:

$*PROGRAM-NAME	Path to the current executable as it was entered on the command line, or C<-e> if perl was invoked with the -e flag.
$*PROGRAM	Location (in the form of an C<IO::Path> object) of the Perl program being executed.

Wouldn't your proposal break all possible usefulness of these variables, save displaying a name to a human? For example say "This program has {+$*PROGRAM.lines} of code in it" will error out with file not found error.

from ecosystem.

jonathanstowe avatar jonathanstowe commented on July 30, 2024

I guess this is somewhat complicated by the original script (which is installed with the hashed name,) being executed by a wrapper which is installed with the original name.

The script is run by the wrapper with something like:

 exit run($*EXECUTABLE, @binaries[0].hash.<files><bin/originalname>, @*ARGS).exitcode

Where @binaries is the result of searching for matching distributions.

So as far as everything is concerned when it gets to run the original script the installed hashed name is the program name.

I guess the wrapper could set an environment variable with the original name of the script which could then be used by USAGE if set, or even set some further dynvar (such as $*ORIGINAL-PROGRAM-NAME, but I agree you probably don't want to be changing the $*PROGRAM or $*PROGRAM-NAME for the reasons stated.

from ecosystem.

zoffixznet avatar zoffixznet commented on July 30, 2024

which could then be used by USAGE if set

Pretty sure the USAGE is already fixed to display a friendly name

from ecosystem.

jonathanstowe avatar jonathanstowe commented on July 30, 2024

Ah yes, so it is, but it's done by setting an environment variable in the wrapper so for anything installed before that changed it won't be there :-\ I do have a plan to move more of the actual code of the wrapper into Compunit::Respository so it's easier to take advantage of these kind of changes, but obviously that won't help in this case :)

from ecosystem.

jonathanstowe avatar jonathanstowe commented on July 30, 2024

@tbrowder in this case I think it's upgrade your Rakudo if you didn't already and then reinstall the distribution that provides the script with --force - that should get you the fixed wrapper :)

from ecosystem.

tbrowder avatar tbrowder commented on July 30, 2024

Okay, I wasn't aware of those changes, and I just updated my rakudo to latest nom branch a few days ago. So that is a reinstall of zef with --force?

ALso, "$?USAGE" seems not to be defined unless you define a MAIN sub.

from ecosystem.

JJ avatar JJ commented on July 30, 2024

Ping?

from ecosystem.

zoffixznet avatar zoffixznet commented on July 30, 2024

This issue has been resolved in rakudo awhile back.

from ecosystem.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.