[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

M-x perld

From: Harry Putnam
Subject: M-x perld
Date: Wed, 31 Mar 2004 10:13:14 -0600


Calling M-x perld and running a command line that uses quotes to
enclose possible regex or other space (or other expansive characters)

perld sees command line quotes as part of the string.  An example of
where and when that might cause a problem as follows:

But as to why its a problem... it means one cannot run a cmdline
program inside emacs perld without changing how it will be run on

Using M-x perld to debug a perl program.  This program uses the
(%) hash function to override program defaults from the command line.

Program defaults are stored in an onboard %hash

(Phony regex are contrived) -ed hp)
%hash = ( "a" => "so {4}me *thing",
          "b" => "some thing",
          "c" => " *something"

One usefull property of hashes is that they only can have uniq keys.
(The first column of single letters are the keys).

So this provides a way to override by adding a new key value pair
that has the same key but different value.

$hash{"b"} = "something +_{3} different"
Now the old value of "b" has disappeared and the new one filled its

So, I'm using a home boy command line technique to override the
defaults like this.

  ./test.pl 'b=new_stuff' file
The script is programmed to split the b=new_stuff into 
  key   = b
  value = new_stuff
and push them into %hash

This works fine from the command line and even from cmdline perl -d.

But if run inside emacs M-x perld it fails to override the default.

It seems the single '' quotes are included into the cmdline arg or

The hash ends up with a new key value pair 'b new_stuff' and retains
                       the old              b something

Note the added quotes.  The perl program run inside emacs, outputs just
like above.  However run from cmdline `perl -d' The same addition from
the command line and the old value of "b" gets overwritten as

Something inside emacs is causing the new key value pair to be seen
I've tried using double quotes "", but get the same result inside

The single quotes are necessay since the stuff being passed are regex
and may contain things the shell would expand unexpectedly.

This can be reproduced by creating a perl program like this:

cat test.pl
  #!/usr/local/bin/perl -w
  @clargs = @ARGV;
  @ARGV = ();
    print "$_\n";

and run it from the command line like ./test.pl one two 'three'
Output is:

Now start the debugger inside emacs like this:

M-x perld <RET>
(Edit the default command line to)
  perl -d ./test.pl one two 'three'
Step thru the program and see the ouput:

In GNU Emacs (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2004-02-24 on reader.local.net0
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: C
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: CPerl

Minor modes in effect:
  encoded-kbd-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  column-number-mode: t
  line-number-mode: t
  abbrev-mode: t

Recent input:
C-f s o m e . p l <return> C-x 1 <down-mouse-1> <mouse-1> 
M-x b u g SPC <backspace> <backspace> <backspace> s 
e n d SPC SPC SPC <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> b SPC <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> C-c M-m <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <menu-bar> <help-menu> <report-emacs-bug> 
C-g <help-echo> <help-echo> <help-echo> <help-echo> 
<menu-bar> <help-menu> <report-emacs-bug>

Recent messages:
Loading font-lock...done
Invalid face text property value: temp-face- [3 times]
(New file)
Loading cperl-mode...done
Invalid face text property value: temp-face-
call-interactively: Text is read-only [8 times]
Menu-Bar mode enabled
Loading emacsbug...done
byte-code: Command attempted to use minibuffer while in minibuffer

reply via email to

[Prev in Thread] Current Thread [Next in Thread]