# New Ticket Created by  mbere...@autoexec.demon.nl 
# Please include the string:  [perl #63872]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=63872 >


Just a one liner to copy the full pathname of the running Perl script, or
otherwise '-e' into $*PROGRAM_NAME. (The * twigil does not appear in the
patch).

Chris Dolan (http://rt.perl.org/rt3/Public/Bug/Display.html?id=63228) also
set out to do the same, but then a spec change froze his work.

The patch works on r37407 (2009-03-14). The test suite currently has no
facility for automated testing of command line processing :-(

diff --git a/src/builtins/guts.pir b/src/builtins/guts.pir
index fd46cb0..125cec4 100644
--- a/src/builtins/guts.pir
+++ b/src/builtins/guts.pir
@@ -341,6 +341,7 @@ first). So for now we just transform multis in user
code like this.
     ## We're running as main program
     ## Remove program argument (0) and set up @ARGS global
     $P0 = shift args
+    set_hll_global '$PROGRAM_NAME', $P0
     args = args.'Array'()
     set_hll_global '@ARGS', args
     ## run unitmain
PROGRAM_NAME.diff (END)


Reply via email to