[11253] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4852 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 9 11:07:23 1999

Date: Tue, 9 Feb 99 08:00:28 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 9 Feb 1999     Volume: 8 Number: 4852

Today's topics:
    Re: 8-bit input (or, "Perl attacks on non-English langu <mso@jimpick.com>
    Re: 8-bit input (or, "Perl attacks on non-English langu (Bruno Haible)
    Re: 8-bit input (or, "Perl attacks on non-English langu (Rainer Joswig)
    Re: Bug and cool debugging technique (5.004_04) <conmara@tcon.net>
    Re: Bug and cool debugging technique (5.004_04) ajs@ajs.com
    Re: Bug and cool debugging technique (5.004_04) ajs@ajs.com
        Changing passwords on a UNIX-based server using Perl <bgibby@iinet.net.au>
        die in a PIPE signal handler in an eval (Stephen Hebditch)
        directory tree <griggsw@logica.com>
    Re: directory tree <Tony.Curtis+usenet@vcpc.univie.ac.at>
        Expanding Perl Arrays in a loop <gibsonc@aztec.asu.edu>
    Re: Expanding Perl Arrays in a loop <jglascoe@giss.nasa.gov>
        Getting Perl to run on IIS 4.0 using .bat extensions bmurray@promedix.com
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 9 Feb 1999 02:42:50 -0800
From: Mike Orr <mso@jimpick.com>
Subject: Re: 8-bit input (or, "Perl attacks on non-English language communities!")
Message-Id: <36c0112a.0@news.oz.net>

In comp.lang.python Matt Curtin <cmcurtin@interhack.net> wrote:

> [Please honor followups.  I don't *really* want to start a flamewar.
> But this should be entertaining for the readers of these groups...]

OK, here's a comment from a Pythoneer.  I don't read
comp.lang.perl.misc, though, so Cc: me if you want me to see any
followups.

> How about Python?

>     #!/usr/local/bin/python 
>     def icrivez (m):
>         print m;
>     icrivez("Bonjour, monde!");

>     $ ./foo.py 
>       File "./foo.py", line 5
>         def icrivez (m):
>         ^
>     SyntaxError: invalid syntax

> What a bore! 

That e' character (which I can't type on my keyboard) is problematic for
reasons explained in Python's Language Reference manual [Chapter 2:
Lexical Analysis].  Quoting http://www.python.org/doc/ref/lexical.html:

> Python uses the 7-bit ASCII character set for program text and
> string literals. 8-bit characters may be used in string literals and
> comments but their interpretation is platform dependent; the proper way
> to insert 8-bit characters in string literals is by using octal or
> hexadecimal escape sequences.
>  
> The run-time character set depends on the I/O devices connected
> to the program but is generally a superset of ASCII.
     
> Future compatibility note: It may be tempting to assume that the
> character set for 8-bit characters is ISO Latin-1 (an ASCII
> superset that covers most western languages that use the Latin
> alphabet), but it is possible that in the future Unicode text
> editors will become common. These generally use the UTF-8
> encoding, which is also an ASCII superset, but with very
> different use for the characters with ordinals 128-255. While
> there is no consensus on this subject yet, it is unwise to
> assume either Latin-1 or UTF-8, even though the current
> implementation appears to favor Latin-1. This applies both to
> the source character set and the run-time character set.

The character e' is represented by a 2-byte sequence in UTF-8, as are
the Polish (?) c' and the Esperanto c^.  The latter two characters
aren't represented in Latin-1 at all, which is why UTF-8 is necessary.
This is also why the e' in your example will turn into something else
when viewed in, say, Russia.

Wild ideas are being thrown about for Python 2.0 (which may appear in
a couple years), and it's possible that it may be more international
in terms of variable names.  In the meantime, variable names have to be
ASCII.  Regarding string processing, this is what I've seen in the
Python newsgroup, although I haven't used these features first hand:

Support for Unicode strings is currently available via third-party
modules, and will likely be folded into the Python 1.6 distribution
(because it's needed for the XML module).  [1.5.2 is in beta; I don't
know the timeline for 1.6.]  The modules include functions to convert
between character sets and analogues to the standard string-manipulation
functions.  

Because the "string-literal syntax using quotes" doesn't recognize
characters above 255, wide strings have to be constructed by a function
call.  In the future, string literals will probably have a prefix letter
(e.g., L or U or W, as in    
	W"wide-character string"
so the parser knows to expect 16-bit characters, in analogue to the 
	R"raw string containing fou\\r \backslashes including \001" 
syntax which makes the backslashes non-magic).

JPython (a Python interpreter written in Java) uses Unicode strings
natively, because the underlying Java environment provides support for
this.  The Java documentation specifically gives the example of a Thai
programmer using Thai characters in her variable names, but I doubt
JPython allows this.  In any case, it would make a script non-portable
to standard Python.

-- 
-Mike Orr, mso@jimpick.com


------------------------------

Date: 9 Feb 1999 12:04:37 GMT
From: haible@clisp.cons.org (Bruno Haible)
Subject: Re: 8-bit input (or, "Perl attacks on non-English language communities!")
Message-Id: <79p88l$8h2$1@news.u-bordeaux.fr>
Keywords: Emacs vs. vi, Perl vs. Lisp, Holy Wars, Let's see what I can start

Matt Curtin  <cmcurtin@interhack.net> wrote:
>
> Let's see ... what other (programming) languages might support this
> sort of thing?  How about Lisp?  XEmacs Lisp, at that?
>
>    (defun icrivez (m)
>      "Icrivez un message."
>      (message m))
>
> Sure enough, evaluating the expression `(icrivez "Bonjour, monde!")'
> will write `Bonjour, monde!' in the minibuffer completely sans
> complaint.

CLISP Common Lisp has no problems with this either:

[1]> (defun icrivez (m)
       "Icrivez un message."
       (write-line m))
ICRIVEZ
[2]> (icrivez "Bonjour, tout le monde!")
Bonjour, tout le monde!
"Bonjour, tout le monde!"
[3]> 
@ bienttt!

The next release of CLISP will not only be 8-bit clean, it will also support
Unicode 16-bit characters.

              Bruno                              http://clisp.cons.org/



------------------------------

Date: Tue, 09 Feb 1999 14:46:23 +0100
From: joswig@lavielle.com (Rainer Joswig)
Subject: Re: 8-bit input (or, "Perl attacks on non-English language communities!")
Message-Id: <joswig-0902991446230001@pbg3.lavielle.com>

In article <79p88l$8h2$1@news.u-bordeaux.fr>, haible@clisp.cons.org (Bruno Haible) wrote:

> [1]> (defun icrivez (m)
>        "Icrivez un message."
>        (write-line m))
> ICRIVEZ
> [2]> (icrivez "Bonjour, tout le monde!")
> Bonjour, tout le monde!
> "Bonjour, tout le monde!"
> [3]> 
> @ bienttt!
> 
> The next release of CLISP will not only be 8-bit clean, it will also support
> Unicode 16-bit characters.
> 
>               Bruno                              http://clisp.cons.org/

With Macintosh Common Lisp you can program in Kanji, if you like. ;-)

-- 
http://www.lavielle.com/~joswig


------------------------------

Date: Tue, 09 Feb 1999 07:56:30 -0500
From: Ken McNamara <conmara@tcon.net>
To: ajs@ajs.com
Subject: Re: Bug and cool debugging technique (5.004_04)
Message-Id: <36C0307E.BCB3108A@tcon.net>

AJS -

I tried something similiar and it dumped me out of debugger on 5.005_54 - then I
read the manual.

"GOTO...may not be used to go inside any construct that requires initialization."

I think that's the problem.

KenMc

ajs@ajs.com wrote:

> I've discovered a bug (causes SEGV) in 5.004_04, and was wondering if anyone
> with quick access to 5.005 could test this for me:
>
> for($i=0;$i<2;$i++) {
>   if ($i==1) {
>     $m++;
>     goto X; # Try to simulate switch/case drop-through
>   } elsif ($i == 0) {
>    X:
>     $m--;
>   }
> }
>
> This crashes 5.004_04 reliably on my RedHat Linux systems. It's the goto that
> does it.
>
> However, while I was trying to find it, I found this really neat way of
> tracking down SEGV's (which, thankfully isn't all that useful for perl, in
> the general case):
>
> $SIG{SEGV}=sub{ package foo; use Carp; croak("SEGV") };
>
> This line will cause perl to tell you what perl code was executing when the
> interpreter woofed it's cookies, because it puts the signal handler in a
> different package. croak() reports the first caller in a different package, so
> it finds the code that gacked.
>
>    -AJS
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own





------------------------------

Date: Tue, 09 Feb 1999 15:22:35 GMT
From: ajs@ajs.com
Subject: Re: Bug and cool debugging technique (5.004_04)
Message-Id: <79pjre$9o9$1@nnrp1.dejanews.com>



  ajs@ajs.com wrote:
> I've discovered a bug (causes SEGV) in 5.004_04, and was wondering if anyone
> with quick access to 5.005 could test this for me:
>
> for($i=0;$i<2;$i++) {
>   if ($i==1) {
>     $m++;
>     goto X; # Try to simulate switch/case drop-through
>   } elsif ($i == 0) {
>    X:
>     $m--;
>   }
> }

Correction: this does not die unless "use strict" is placed at the top! Now,
I'm really confused....

-AJS

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Tue, 09 Feb 1999 15:21:10 GMT
From: ajs@ajs.com
Subject: Re: Bug and cool debugging technique (5.004_04)
Message-Id: <79pjop$9ni$1@nnrp1.dejanews.com>



  ilya@math.ohio-state.edu (Ilya Zakharevich) wrote:

> <ajs@ajs.com>],
> who wrote in article <79oig7$dqk$1@nnrp1.dejanews.com>:
> > $SIG{SEGV}=sub{ package foo; use Carp; croak("SEGV") };
> >
> > This line will cause perl to tell you what perl code was executing when the
> > interpreter woofed it's cookies, because it puts the signal handler in a
> > different package. croak() reports the first caller in a different package,
so
> > it finds the code that gacked.
>
> Why not just run your code under Perl debugger?  It will provide the
> same info (using basically the same technique).

Actually, as it turns out, this did not work because the bug does not show up
under the debugger. I don't know why. In general, the perl debugger tends to
modify the state of the perl interpreter too much for actuall perl bugs to
show up in the same way, so I found this technique most useful, where it only
comes into play once the SEGV has already been raised, and otherwise leaves
the program alone.

   -AJS

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Tue, 9 Feb 1999 18:32:58 +0800
From: "Bradley J. Gibby" <bgibby@iinet.net.au>
Subject: Changing passwords on a UNIX-based server using Perl
Message-Id: <79p2rs$mcn$1@news.iinet.net.au>

Just wondering how I could change my password ( like most ISP's have their,
enter username and password and your new password ) using Perl.

Thanks in Advance q:)

--

Bradley J. Gibby
http://www.iinet.net.au/~bgibby/index.html






------------------------------

Date: 9 Feb 1999 13:07:50 GMT
From: steveh@mediasurface.com (Stephen Hebditch)
Subject: die in a PIPE signal handler in an eval
Message-Id: <36c03326.0@nnrp1.news.uk.psi.net>

I have a piece of code

        eval
                {
                local ($SIG{PIPE} = sub { die "client socket closed\n" });
                local ($SIG{ALRM} = sub { die "request timeout\n" });

                alarm (600);
                dosocketstuff ();
                alarm (0);
                };
  
The ALRM signal handler works entirely as documented, leaving the eval
once called. However, the die in the PIPE handler causes the process to
exit with the die. Anyone have any ideas why this is so or if there are
any workarounds that can achieve the same result?


------------------------------

Date: Tue, 09 Feb 1999 11:49:32 +0000
From: William Griggs <griggsw@logica.com>
Subject: directory tree
Message-Id: <36C020CB.E0473F67@logica.com>

Ok, how do I go through a directory tree of unknown structure in Perl,
putting all files (and their paths) into an array. Any shortcuts?

Cheers,

Bill



------------------------------

Date: 09 Feb 1999 12:52:57 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: directory tree
Message-Id: <83g18fx086.fsf@vcpc.univie.ac.at>

Re: directory tree, William <griggsw@logica.com>
said:

William> Ok, how do I go through a directory tree of
William> unknown structure in Perl, putting all
William> files (and their paths) into an array. Any
William> shortcuts?

perldoc File::Find

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien.  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


------------------------------

Date: Tue, 9 Feb 1999 08:00:52 -0700
From: "gip" <gibsonc@aztec.asu.edu>
Subject: Expanding Perl Arrays in a loop
Message-Id: <79piad$fti@bmw.hwcae.az.Honeywell.COM>

Why can't I repetitively ask for an array to be expanded?

Hope I haven't overlooked the obvious.  Below the code is the run-time
output:

Thanks for your time.

CG

                for ($a=0; $a < $arrayLimit; $a++) {

                  $name = &ExpandArray($arrayName, $a, %Array);

                  print "a is $a; name is $name.\n" if $DEBUG2 ;

                  foreach $str (keys %Struct) {

                    $nI = 0;
                    my $who;
                    for $who ( @{ $Struct{$str}{members} } ) {
                      $structures{$structureName}{members}[$nStr]{name}   =
$name . "." . $Struct{$str}{members}[$nI]{name};

    print "nI:nStr=$nI:$nStr, $who, $str,
$Struct{$str}{members}[$nStr]{name},
$structures{$structureName}{members}[$nStr]{name}.\n";

                      $structures{$structureName}{members}[$nStr]{type}   =
$Struct{$str}{members}[$nI]{type};
                      $structures{$structureName}{members}[$nStr]{size}   =
$Struct{$str}{members}[$nI]{size};
                      $structures{$structureName}{members}[$nStr]{offset} =
$offset;
                      $offset += $size + ($size % $byteOffset);

                      $structures{$structureName}{members}[$nStr]{default} =
$Struct{$str}{members}[$nI]{default};
                      $structures{$structureName}{members}[$nStr]{range}   =
"0";
                      $structures{$structureName}{members}[$nStr]{rangeLO} =
$defaults[$iDefs+1];
                      $structures{$structureName}{members}[$nStr]{rangeHI} =
$defaults[$iDefs+2];
                      $structures{$structureName}{members}[$nStr]{res}     =
$defaults[$iDefs+3];

                      $nStr++;
                      $nI++;
                      if (@defaults > 4) { $iDefs = $iDefs+4; }

                      $totalSize += $size;
                    }
                  }
                }
              }


Output is:

a is 0; name is A2D_Channel[CHL_ORDER_BW].
nI:nStr=0:0, HASH(0xdea718), A2D_READING_T, Output,
A2D_Channel[CHL_ORDER_BW].Output.
nI:nStr=1:1, HASH(0xdea850), A2D_READING_T, Raw,
A2D_Channel[CHL_ORDER_BW].Raw.
nI:nStr=2:2, HASH(0xde1bf0), A2D_READING_T, Status,
A2D_Channel[CHL_ORDER_BW].Status.
a is 1; name is A2D_Channel[CHL_ORDER_RLS].
nI:nStr=0:3, HASH(0xdea718), A2D_READING_T, ,
A2D_Channel[CHL_ORDER_RLS].Output.
nI:nStr=1:4, HASH(0xdea850), A2D_READING_T, ,
A2D_Channel[CHL_ORDER_RLS].Raw.
nI:nStr=2:5, HASH(0xde1bf0), A2D_READING_T, ,
A2D_Channel[CHL_ORDER_RLS].Status.
nI:nStr=3:6, HASH(0xde04a0), A2D_READING_T, , A2D_Channel[CHL_ORDER_RLS]..
nI:nStr=4:7, HASH(0xde1c44), A2D_READING_T, , A2D_Channel[CHL_ORDER_RLS]..
nI:nStr=5:8, HASH(0xde1d7c), A2D_READING_T, , A2D_Channel[CHL_ORDER_RLS]..
nI:nStr=6:9, HASH(0xde1e0c), A2D_READING_T, , A2D_Channel[CHL_ORDER_RLS]..
nI:nStr=7:10, HASH(0xde2858), A2D_READING_T, , A2D_Channel[CHL_ORDER_RLS]..
nI:nStr=8:11, HASH(0xde2a80), A2D_READING_T, , A2D_Channel[CHL_ORDER_RLS]..
nI:nStr=9:12, HASH(0xde1ee4), A2D_READING_T, , A2D_Channel[CHL_ORDER_RLS]..
nI:nStr=10:13, HASH(0xde2ac8), A2D_READING_T, , A2D_Channel[CHL_ORDER_RLS]..
nI:nStr=11:14, HASH(0xdea7c0), A2D_READING_T, , A2D_Channel[CHL_ORDER_RLS]..
nI:nStr=12:15, HASH(0xde1eb4), A2D_READING_T, , A2D_Channel[CHL_ORDER_RLS]..
nI:nStr=13:16, HASH(0xdebfe0), A2D_READING_T, , A2D_Channel[CHL_ORDER_RLS]..




------------------------------

Date: Tue, 09 Feb 1999 10:16:36 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: gip <gibsonc@aztec.asu.edu>
Subject: Re: Expanding Perl Arrays in a loop
Message-Id: <36C05154.454792A@giss.nasa.gov>

gip wrote:
> 
> Why can't I repetitively ask for an array to be expanded?

I'm sorry, what is "ExpandArray"?

> Hope I haven't overlooked the obvious.  Below the code is the run-time
> output:

What's wrong with the output?  How is the code failing?
Could you provide a minimal example reproducing the error?

 ....


------------------------------

Date: Tue, 09 Feb 1999 15:06:51 GMT
From: bmurray@promedix.com
Subject: Getting Perl to run on IIS 4.0 using .bat extensions
Message-Id: <79piu2$8vi$1@nnrp1.dejanews.com>

I was given a perl script with a .bat extension. When I tried to run it, it
just displays the perl script. So I mapped the .bat extension in IIS 4.0 to
cmd.exe. Now I get the 404 not found error. Any Suggestions?
Brandon

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 4852
**************************************

home help back first fref pref prev next nref lref last post