in reply to Re^2: Is it possible to determine last executed command line?
in thread Is it possible to determine last executed command line?

Rather than calling
system( "....." ); retcode_full_text();
you might consider modifying retcode_full_text to take the last command as an argument, and using

my_system( "....." );

with
sub my_system { my ( $cmd ) = @_; system( $cmd ); retcode_full_text( $cmd ); }

Replies are listed 'Best First'.
Re^4: Is it possible to determine last executed command line?
by graff (Chancellor) on Dec 04, 2007 at 00:42 UTC
    In case the caller wants to pass a list of command-line args to system(), you would want to do it like this (which seems simpler anyway):
    sub my_system { system( @_ ); retcode_full_text( "@_" ); }
      If you care about precision as opposed to readability, the following might be more appropriate.
      sub my_system { system( @_ ); retcode_full_text( join ' ', map quotemeta, @_ ); }

      At least for non-Windows systems.

Re^4: Is it possible to determine last executed command line?
by sgifford (Prior) on Dec 04, 2007 at 06:21 UTC
    Or overriding the global system:
    BEGIN { *CORE::GLOBAL::system = \&my_system; }

    I'm not sure how to do this for backticks or pipe-open, though.