[23256] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5476 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 10 06:05:45 2003

Date: Wed, 10 Sep 2003 03:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 10 Sep 2003     Volume: 10 Number: 5476

Today's topics:
    Re: $# is deprecated, $OFMT doesn't work <abigail@abigail.nl>
    Re: $# is deprecated, $OFMT doesn't work <tassilo.parseval@rwth-aachen.de>
    Re: $# is deprecated, $OFMT doesn't work <abigail@abigail.nl>
    Re: $# is deprecated, $OFMT doesn't work <tassilo.parseval@rwth-aachen.de>
    Re: $# is deprecated, $OFMT doesn't work (Anno Siegel)
    Re: $# is deprecated, $OFMT doesn't work <abigail@abigail.nl>
        attn: comp.lang.perl.announce readers moderator@comp.lang.perl.announce
    Re: calculation in string (Anno Siegel)
    Re: Converting C++ to Perl <krahnj@acm.org>
        Detecting duplicate keys in a hash I am "requiring" (Gupit)
    Re: Detecting duplicate keys in a hash I am "requiring" <tassilo.parseval@rwth-aachen.de>
    Re: Detecting duplicate keys in a hash I am "requiring" (Anno Siegel)
        Emacs modules for Perl programming (Jari Aalto+mail.perl)
    Re: exit() argument evaluation <peter.dintelmann@dresdner-bank.com>
    Re: Flocking Advise news@roaima.freeserve.co.uk
    Re: Help me beef up my cruddy program <REMOVEsdnCAPS@comcast.net>
    Re: illegal seek news@roaima.freeserve.co.uk
    Re: illegal seek (Anno Siegel)
        open2(), win2k, perl5.6.1, Win32::Daemon <aw_nospam@compuserve.com>
        Perl system() command failing under CYGWIN (Gordon)
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 10 Sep 2003 07:57:47 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: $# is deprecated, $OFMT doesn't work
Message-Id: <slrnbltmbr.20e.abigail@alexandra.abigail.nl>

Steven Smolinski (steven.smolinski@sympatico.ca) wrote on MMMDCLXII
September MCMXCIII in <URL:news:2fz7b.3002$z5.237577@news20.bellglobal.com>:
))  Dan Jacobson <jidanni@jidanni.org> wrote:
)) > $ perl -wle '$OFMT="%.2f";print 1/3'
)) > Name "main::OFMT" used only once: possible typo at -e line 1.
)) > 0.333333333333333
))  
))  Note to OP: in perlvar it should tell you that to use the long names of
))  the punctuation variables you need to:
))  
))  use English;
))  
))  But since $# is deprecated, see printf instead.
))  
))  
))  Question to everyone:
))  
))  Should perlvar in 5.8.0 still mention $OFMT when it has been removed
))  from English.pm?
))  
))  I don't know how to submit a documentation patch to p5p, but I suppose I
))  can learn.


I've submitted a patch. Note that in the 5.8.1 track the OFMT 
equivalent for $# was already removed from perlvar.



Abigail
-- 
($;,$_,$|,$\)=("\@\x7Fy~*kde~box*Zoxf*Bkiaox"," "x25,1,"\r"); 
{vec($_=>1+$"=>$^F<<$^F)=ord($/^substr$;=>$"=int rand 24=>1);              
 print&&select$,,$,,$,,$|/($|+tr/ //c);redo if y/ //>$^F**2};


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

Date: 10 Sep 2003 08:20:56 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: $# is deprecated, $OFMT doesn't work
Message-Id: <bjmmt8$gln$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Abigail:

> Steven Smolinski (steven.smolinski@sympatico.ca) wrote on MMMDCLXII
> September MCMXCIII in <URL:news:2fz7b.3002$z5.237577@news20.bellglobal.com>:

> ))  Question to everyone:
> ))  
> ))  Should perlvar in 5.8.0 still mention $OFMT when it has been removed
> ))  from English.pm?
> ))  
> ))  I don't know how to submit a documentation patch to p5p, but I suppose I
> ))  can learn.
> 
> 
> I've submitted a patch. Note that in the 5.8.1 track the OFMT 
> equivalent for $# was already removed from perlvar.

Hmmh, was it? I get (for RC1 though):

    ethan@ethan:~$ perldoc5.8.1 -t perlvar | grep -A1 -m1 OFMT
        $OFMT
        $#      The output format for printed numbers. This variable is a

Even in my not-so-lang-ago-synced blead perlvar.pod still mentions it.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: 10 Sep 2003 08:46:21 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: $# is deprecated, $OFMT doesn't work
Message-Id: <slrnbltp6s.782.abigail@alexandra.abigail.nl>

Tassilo v. Parseval (tassilo.parseval@rwth-aachen.de) wrote on MMMDCLXII
September MCMXCIII in <URL:news:bjmmt8$gln$1@nets3.rz.RWTH-Aachen.DE>:
""  Also sprach Abigail:
""  
"" > Steven Smolinski (steven.smolinski@sympatico.ca) wrote on MMMDCLXII
"" > September MCMXCIII in <URL:news:2fz7b.3002$z5.237577@news20.bellglobal.com>:
""  
"" > ))  Question to everyone:
"" > ))  
"" > ))  Should perlvar in 5.8.0 still mention $OFMT when it has been removed
"" > ))  from English.pm?
"" > ))  
"" > ))  I don't know how to submit a documentation patch to p5p, but I suppose I
"" > ))  can learn.
"" > 
"" > 
"" > I've submitted a patch. Note that in the 5.8.1 track the OFMT 
"" > equivalent for $# was already removed from perlvar.
""  
""  Hmmh, was it? I get (for RC1 though):
""  
""      ethan@ethan:~$ perldoc5.8.1 -t perlvar | grep -A1 -m1 OFMT
""          $OFMT
""          $#      The output format for printed numbers. This variable is a
""  
""  Even in my not-so-lang-ago-synced blead perlvar.pod still mentions it.


You are right. After submitting the patch, I grepped for OFMT as well,
but grepped against the patched file.



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: 10 Sep 2003 08:49:17 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: $# is deprecated, $OFMT doesn't work
Message-Id: <bjmoid$ie4$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Abigail:

> Tassilo v. Parseval (tassilo.parseval@rwth-aachen.de) wrote on MMMDCLXII
> September MCMXCIII in <URL:news:bjmmt8$gln$1@nets3.rz.RWTH-Aachen.DE>:
> ""  Also sprach Abigail:

> "" > I've submitted a patch. Note that in the 5.8.1 track the OFMT 
> "" > equivalent for $# was already removed from perlvar.
> ""  
> ""  Hmmh, was it? I get (for RC1 though):
> ""  
> ""      ethan@ethan:~$ perldoc5.8.1 -t perlvar | grep -A1 -m1 OFMT
> ""          $OFMT
> ""          $#      The output format for printed numbers. This variable is a
> ""  
> ""  Even in my not-so-lang-ago-synced blead perlvar.pod still mentions it.
> 
> 
> You are right. After submitting the patch, I grepped for OFMT as well,
> but grepped against the patched file.

Haha, you first removed those occurances and immediately after that
checked whether they had been there at all in the first place? ;-)

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: 10 Sep 2003 09:43:30 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: $# is deprecated, $OFMT doesn't work
Message-Id: <bjmro2$2ce$3@mamenchi.zrz.TU-Berlin.DE>

Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote in comp.lang.perl.misc:

[how to prepare a perl patch]

>     diff -u pod/perlvar.pod~ pod/perlvar.pod > patch
> 
> and send the patch as attachment to perl5-porters@perl.org while

Minor correction:  Simply append the patch to the mail.  Sending it
as an attachment actually makes it harder for the receiver, since
the patch program can deal directly with a mail message that ends
with a patch.

Anno


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

Date: 10 Sep 2003 09:53:37 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: $# is deprecated, $OFMT doesn't work
Message-Id: <slrnbltt51.879.abigail@alexandra.abigail.nl>

Tassilo v. Parseval (tassilo.parseval@rwth-aachen.de) wrote on MMMDCLXII
September MCMXCIII in <URL:news:bjmoid$ie4$1@nets3.rz.RWTH-Aachen.DE>:
}}  Also sprach Abigail:
}}  
}} > Tassilo v. Parseval (tassilo.parseval@rwth-aachen.de) wrote on MMMDCLXII
}} > September MCMXCIII in <URL:news:bjmmt8$gln$1@nets3.rz.RWTH-Aachen.DE>:
}} > ""  Also sprach Abigail:
}}  
}} > "" > I've submitted a patch. Note that in the 5.8.1 track the OFMT 
}} > "" > equivalent for $# was already removed from perlvar.
}} > ""  
}} > ""  Hmmh, was it? I get (for RC1 though):
}} > ""  
}} > ""      ethan@ethan:~$ perldoc5.8.1 -t perlvar | grep -A1 -m1 OFMT
}} > ""          $OFMT
}} > ""          $#      The output format for printed numbers. This variable is
}} > ""  
}} > ""  Even in my not-so-lang-ago-synced blead perlvar.pod still mentions it.
}} > 
}} > 
}} > You are right. After submitting the patch, I grepped for OFMT as well,
}} > but grepped against the patched file.
}}  
}}  Haha, you first removed those occurances and immediately after that
}}  checked whether they had been there at all in the first place? ;-)


Yeah, because in English.pm there were 4 variables outcommented, and
only two of them were still mentioned in perlvar. And I've an attention
span of approx. 0.2 seconds, so I forgot which ones were already
removed.


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: Wed, 10 Sep 2003 07:38:06 GMT
From: moderator@comp.lang.perl.announce
Subject: attn: comp.lang.perl.announce readers
Message-Id: <25e54838.6435b78b@comp.lang.perl.announce>

In the coming months a black spot will pop up everywhere . . . 
on store windows and newspaper boxes, on gas pumps and supermarket 
shelves.  Open a magazine or newspaper - it's there.  It's on TV. 
It stains the logos and smears the nerve centers of the world's 
biggest, dirtiest corporations.

This is the mark of the people who don't approve of Bush's plan to
control the world, who don't want countries "liberated" without UN
backing, who can't stand anymore neo-con bravado shoved down their
throats.

This is the mark of the people who want the Kyoto Protocol for the
environment, who want the International Criminal Court for greater
justice, who want a world where all nations, including the U.S.A., 
are free of weapons of mass destruction, and who pledge to take their
country back.

--
http://www.unbrandamerica.org
Abdellah Zahir
She might expect good tailors, do you attempt them?

People I want to know how long will you sleep, how long will you blame
each other, it already is getting a bit late, how long will you stand
aside. When will these corrupt jews stop raping Muslims and Christians,
and when will you question the game they have been playing with Muslims
and Christains for centuries. 

May God end the days of extermists and terrorists soon, may God free us
all soon, may bring unbaised justice and truth to this world agian, may
God unite all the Muslims and give them ability to pray.

wa'Salam
Mohsin 

Jews travel big distance to rape others.

Assalam u'Alekum all,

My sister went to the teacher of our cousine at his primary school. On
her way to school, we was intercepted by three man, including Abu Omar,
Abu Omar who travelled all this to rape my family and bomb Australian
embassy. Apparently my step sister was forced in a room, where this man
Abu Omar raped her. I want to know why he did this, did he do this
because he forced to me to sleep with his Muslim wife, I didn't. Did he
do this, because he thinks we Muslims are his slave? or did he do this,
because all the GGs are Jews and Jews can do what they like to
Christians and Muslims. 

I personally feel sorry for her, I don't think this should have been her
fate. But then again where they have raped entire Christainity and Islam
why wouldn't these jews travel all this way to rape my family members.
firstly Abu Omar tried to get me killed, probably because I have no
feelings and I wasn't like him, then he told the cops who were involved
in protecting me that I want to kill them, special thanks to his other
brothers like Mahmud Kurchu, Amir Butler, and GG. All of them knew this
was going on, they supported each other when and where they could and
threatened the cops around me.

May God end the days of extermist




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

Date: 10 Sep 2003 09:31:20 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: calculation in string
Message-Id: <bjmr18$2ce$2@mamenchi.zrz.TU-Berlin.DE>

Trent Curry <tcurrey@no.no.no.i.said.no> wrote in comp.lang.perl.misc:
> "Daniel" <dvdoord@planet.nl> wrote in message
> news:3f4c7dbf$0$49114$e4fe514c@news.xs4all.nl...
> > I've a dynamic variable
> > $var_tmp = "/18";
> > where the "/18" can also be "/18+100"
> > I also got a variable
> > $var_prize = 2000
> > now the thing is I have to get this
> > $var_total = 2000/18+100;
> >
> > anybody knows how this works ?!?
> 
>    $var_total = eval($var_tmp);
> will do what you want.
> 
> Also, alt.comp.lang.perl & comp.lang.perl are very rare if not virtually
> extinct news groups. I don't think too many people get them. Though there
> seems to be SOME activity in those two said groups...
> 
> Or is alt.comp.lang.perl just a lesser known group?

alt.comp.lang.perl is a legit alternative to the mainstream Perl groups.
comp.lang.perl has been decommissioned many years ago -- it *shouldn't*
exist anywhere, but a sizeable minority of news server still carry it.

Anno


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

Date: Wed, 10 Sep 2003 09:47:24 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Converting C++ to Perl
Message-Id: <3F5EF329.F46A314F@acm.org>

Kenny McCarty wrote:
> 
> I am trying to convert this snippet of c++ code to perl and am having
> some problems getting the results to match up.  I was hoping someone
> might be able to help me out.  Here is the snippet of C++ code:
> 
> DWORD dwVolSerial;

DWORD is I believe an unsigned long (32 bit) integer.


> BOOL  bIsRetrieved;
> char *tmp;
> char Data[6];
> // Get the serial number
> bIsRetrieved =
>    GetVolumeInformation("C:\\",NULL,NULL,&dwVolSerial,NULL,NULL,NULL,NULL);
> 
> // Display the serial number
> printf("Serial number of drive C is %X\n",dwVolSerial);
> 
> tmp = (char*)&dwVolSerial;
> 
> Data[0] = tmp[0];
> Data[1] = tmp[1];
> Data[2] = tmp[2];
> 
> printf("Data is %d-%d-%d\n",Data[0],Data[1],Data[2]);
> 
> And here is what I tried in perl:
> 
> #just hard coded volume serial number here
> $str = '303C-6B38';
> @pieces = split(/-/,$str);
> @data = split(//,$pieces[0]);
> printf("Data: %d-%d-%d\n",ord($data[0]),ord($data[1]),ord($data[2]));

The equivalent perl code is:

my $str = '303C-6B38';
my @pieces = map hex, $str =~ /[[:xdigit:]]{2}/g;
printf "Data: %d-%d-%d\n", @pieces[ 0 .. 2 ];


> The C++ is run on Windows XP and the perl is run on Free-BSD.  For the
> perl part I want the user to input the volume serial number of their C
> drive and I want to create a strign using this data.  I think that the
> conversions are different between windows and unix and that is where
> my problem is but I am not sure.  In windows the "3" becomes a "056"
> but in unix it becomes a "53".  Any help would be apprecieated.

Are both OSs running on Intel compatible CPUs?  Intel's little-endian
format means that an integer like 0x12345678 converted to a char array
will be { 0x78, 0x56, 0x34, 0x12 } so your volume serial number
'303C-6B38' is really the integer 0x386B3C30.



John
-- 
use Perl;
program
fulfillment


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

Date: 10 Sep 2003 00:09:22 -0700
From: gupit@yahoo.com (Gupit)
Subject: Detecting duplicate keys in a hash I am "requiring"
Message-Id: <1ea0ec40.0309092309.1eac2374@posting.google.com>

Hi,
I have a configuration file which is in a perl hash (of hashes and
arrays) format.

$hash = {
   key1 => { key2 => val2,
             key3 => val3,
           },
   key4 => [ vala,valb,],
   key1 => {key5 => val5,
            key6 => val6
           ),
};

In my script I do
use vars ($hash);
if (eval "require config_file") {
   print "Required config_file";
} else {
   print "Couldn't require config_file\n";
}

Now if you notice in the config_file, $hash has two duplicate keys
i.e. key1 has been specified twice. When using require, perl simply
keeps the last value it encountered for key1.

I would like to detect these duplicates. Is there a stricter mode in
perl that will print warnings when perl encounters duplicate keys in
hashes. I could turn it on for the eval require bit.

Is there any other way to detect these duplicates? Unfortunately the
config_file is really huge and uses hash of hashes of hashes and
arrays and so on and writing a script to parse the file would be
painful.

Thanks in advance
G


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

Date: 10 Sep 2003 08:12:43 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Detecting duplicate keys in a hash I am "requiring"
Message-Id: <bjmmdr$g93$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Gupit:

> I have a configuration file which is in a perl hash (of hashes and
> arrays) format.
> 
> $hash = {
>    key1 => { key2 => val2,
>              key3 => val3,
>            },
>    key4 => [ vala,valb,],
>    key1 => {key5 => val5,
>             key6 => val6
>            ),
> };
> 
> In my script I do
> use vars ($hash);
> if (eval "require config_file") {
>    print "Required config_file";
> } else {
>    print "Couldn't require config_file\n";
> }
> 
> Now if you notice in the config_file, $hash has two duplicate keys
> i.e. key1 has been specified twice. When using require, perl simply
> keeps the last value it encountered for key1.
> 
> I would like to detect these duplicates. Is there a stricter mode in
> perl that will print warnings when perl encounters duplicate keys in
> hashes. I could turn it on for the eval require bit.

No, there's no such mode I know of. You can implement that however, but
you'd need to change your logic a little. First of all, you need a tied
hash that will do the warning:

    package Tie::StrictHash;
    require Tie::Hash;
    @Tie::StrictHash::@ISA = qw(Tie::StdHash);
    use Carp;
    sub STORE {
        my ($hash, $key, $val) = @_;
        carp "Duplicate key '$key' detected" if exists $hash->{ $key };
        # store it nonetheless, overwriting the previous key/value pair
        $hash->SUPER::STORE($key, $val);
    }

    package main;
    use vars qw(%hash);
    tie %hash => 'Tie::StrictHash';
    require 'config_file';

For the above, you have to turn the toplevel hash-ref into a real hash
to make it work.

> Is there any other way to detect these duplicates? Unfortunately the
> config_file is really huge and uses hash of hashes of hashes and
> arrays and so on and writing a script to parse the file would be
> painful.

I'd say any attempt to parse it yourself is extremely likely to fail.
The above solution is more realistic, however it's only a partial one.
Tie::StrictHash cannot detect duplicate keys in nested hashes, only in
the top-level one. I tried a recursive tie/STORE for each sub-hash but
then I realized that those attempts are futile since the subhash has
already been processed by perl before STORE gets to see it.

It's an interesting problem. But I don't see how it could be solved.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: 10 Sep 2003 09:23:00 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Detecting duplicate keys in a hash I am "requiring"
Message-Id: <bjmqhk$2ce$1@mamenchi.zrz.TU-Berlin.DE>

Gupit <gupit@yahoo.com> wrote in comp.lang.perl.misc:
> Hi,
> I have a configuration file which is in a perl hash (of hashes and
> arrays) format.
> 
> $hash = {
>    key1 => { key2 => val2,
>              key3 => val3,
>            },
>    key4 => [ vala,valb,],
>    key1 => {key5 => val5,
>             key6 => val6
>            ),
> };
> 
> In my script I do
> use vars ($hash);
> if (eval "require config_file") {
>    print "Required config_file";
> } else {
>    print "Couldn't require config_file\n";
> }
> 
> Now if you notice in the config_file, $hash has two duplicate keys
> i.e. key1 has been specified twice.

There are no duplicate keys in a hash, hash keys are unique by
construction.  Every entry for the same key overwrites the previous
one.

>                                     When using require, perl simply
> keeps the last value it encountered for key1.

Not only with require -- the hash doesn't ever contain the duplicate.

> I would like to detect these duplicates. Is there a stricter mode in
> perl that will print warnings when perl encounters duplicate keys in
> hashes. I could turn it on for the eval require bit.

Then specify you configuration structure as a list(ref), not a hash.
Replace the outermost pair of "{}" with "[]" (and change the name from
$hash to something descriptive).  Then read "perldoc -q duplicate"
to see how to detect duplicates in the list you are importing.

> Is there any other way to detect these duplicates? Unfortunately the
> config_file is really huge and uses hash of hashes of hashes and
> arrays and so on and writing a script to parse the file would be
> painful.

Whatever the structure of the hash, the top level structure is one
of key/value pairs.  That isn't so hard to parse.

Anno


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

Date: 10 Sep 2003 09:50:40 GMT
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Emacs modules for Perl programming
Message-Id: <perl-faq/emacs-lisp-modules_1063187332@rtfm.mit.edu>

Archive-name: perl-faq/emacs-lisp-modules
Posting-Frequency: 2 times a month
URL: http://tiny-tools.sourceforge.net/
Maintainer: Jari Aalto <jari.aalto@poboxes.com>

Announcement: "What Emacs lisp modules can help with programming Perl"

    Preface

        Emacs is your friend if you have to do anything comcerning software
        development: It offers plug-in modules, written in Emacs lisp
        (elisp) language, that makes all your programmings wishes come
        true. Please introduce yourself to Emacs and your programming era
        will get a new light.

    Where to find Emacs/XEmacs

        o   Unix:
            http://www.gnu.org/software/emacs/emacs.html
            http://www.xemacs.org/

        o   Unix Windows port (for Unix die-hards):
            install http://www.cygwin.com/  which includes native Emacs 21.x.
            XEmacs port is bundled in XEmacs setup.exe available from
            XEmacs site.

        o   Pure Native Windows port
            http://www.gnu.org/software/emacs/windows/ntemacs.html
            ftp://ftp.xemacs.org/pub/xemacs/windows/setup.exe

        o   More Emacs resources at
            http://tiny-tools.sourceforge.net/  => Emacs resource page

Emacs Perl Modules

    Cperl -- Perl programming mode

        ftp://ftp.math.ohio-state.edu/pub/users/ilya/perl
        http://www.perl.com/CPAN-local/misc/emacs/cperl-mode/
        <ilya@math.ohio-state.edu>    Ilya Zakharevich

        CPerl is major mode for editing perl files. Forget the default
        `perl-mode' that comes with Emacs, this is much better. Comes
        standard in newest Emacs.

    TinyPerl -- Perl related utilities

        http://tiny-tools.sourceforge.net/

        If you ever wonder how to deal with Perl POD pages or how to find
        documentation from all perl manpages, this package is for you.
        Couple of keystrokes and all the documentaion is in your hands.

        o   Instant function help: See documentation of `shift', `pop'...
        o   Show Perl manual pages in *pod* buffer
        o   Grep through all Perl manpages (.pod)
        o   Follow POD references e.g. [perlre] to next pod with RETURN
        o   Coloured pod pages with `font-lock'
        o   Separate `tiperl-pod-view-mode' for jumping topics and pages
            forward and backward in *pod* buffer.

        o   Update `$VERSION' variable with YYYY.MMDD on save.
        o   Load source code into Emacs, like Devel::DProf.pm
        o   Prepare script (version numbering) and Upload it to PAUSE
        o   Generate autoload STUBS (Devel::SelfStubber) for you
            Perl Module (.pm)

    TinyIgrep -- Perl Code browsing and easy grepping

        [TinyIgrep is included in Tiny Tools Kit]

        To grep from all installed Perl modules, define database to
        TinyIgrep. There is example file emacs-rc-tinyigrep.el that shows
        how to set up dattabases for Perl5, Perl4 whatever you have
        installed

        TinyIgrep calls Igrep.el to to do the search, You can adjust
        recursive grep options, set search case sensitivity, add user grep
        options etc.

        You can find latest `igrep.el' module at
        <http://groups.google.com/groups?group=gnu.emacs.sources> The
        maintainer is Jefin Rodgers <kevinr@ihs.com>.

    TinyCompile -- To Browse grep results in Emacs *compile* buffer

        TinyCompile is a minor mode for *compile* buffer from where
        you can collapse unwanted lines or shorten file URLs:

            /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file1:NNN: MATCHED TEXT
            /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file2:NNN: MATCHED TEXT

            -->

            cd /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/
            file1:NNN: MATCHED TEXT
            file1:NNN: MATCHED TEXT

End



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

Date: Wed, 10 Sep 2003 10:13:11 +0200
From: "Dr. Peter Dintelmann" <peter.dintelmann@dresdner-bank.com>
Subject: Re: exit() argument evaluation
Message-Id: <bjml5l$joo2@news-1.bank.dresdner.net>

    Hi John,

"John W. Krahn" <krahnj@acm.org> wrote in message
news:3F5C4F58.A0C4CD38@acm.org...

    [snip]

> exit (a named unary operator) has higher precedence than == while print
> and die (list operators (rightward)) have lower precedence.


    ok; this was a fairly stupid question, sorry. It seems that I expected
    unary builtins to behave like list operators called with a one element
    list. Is this counter-intuitive ;-)?

        Peter




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

Date: Wed, 10 Sep 2003 10:36:33 +0100
From: news@roaima.freeserve.co.uk
Subject: Re: Flocking Advise
Message-Id: <1u7331-cta.ln1@moldev.cmagroup.co.uk>

David Efflandt <efflandt@xnet.com> wrote:
> Actually I had problems with a CGI script that just read a file without
> flocking it.  If more than one instance tried to read from the file at the
> same time, it apparently got confused where the file pointer was and the
> Perl (CGI) scripts would go into endless loops (the host notified me about
> the endless processes).

That'll be something to do with the way CGI processes have been
implemented in your web server.

Chris
-- 
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}


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

Date: Wed, 10 Sep 2003 04:58:52 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Help me beef up my cruddy program
Message-Id: <Xns93F23D068A08Dsdn.comcast@206.127.4.25>

Dan Jacobson <jidanni@jidanni.org> wrote in 
news:8765k1qkti.fsf@jidanni.org:

> Help me beef up my cruddy program.  It should then even run on Microsoft,
> by the way.

What's wrong with it?

-- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print


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

Date: Wed, 10 Sep 2003 10:34:35 +0100
From: news@roaima.freeserve.co.uk
Subject: Re: illegal seek
Message-Id: <bq7331-cta.ln1@moldev.cmagroup.co.uk>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> That's a good description of the scenario where a lock upgrade looks
> tempting.  But, as you say, it can't be done.  To get a write lock, you'd
> have to give up the read lock, which means someone else can change the
> file before you do.  End of story, until an OS gives us LOCK_UPGD.

Hmm. It gets worse - and not just in perl but also in native C (I've
tested both). When you "upgrade" a flock from LOCK_SH to LOCK_EX the
kernel actually releases the lock transiently whilst *appearing* to
succeed atomically. Ouch.

The issue here (as far as I'm concerned) is that flock *appears* to let
you upgrade atomically but it doesn't really do so. Can this warning be
added explicitly to perldoc for flock?

(This is on GNU/Linux kernel 2.4.20. I haven't checked Solaris.)

Chris


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

Date: 10 Sep 2003 09:53:52 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: illegal seek
Message-Id: <bjmsbg$2ce$4@mamenchi.zrz.TU-Berlin.DE>

 <chris-usenet@roaima.co.uk> wrote in comp.lang.perl.misc:
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> > That's a good description of the scenario where a lock upgrade looks
> > tempting.  But, as you say, it can't be done.  To get a write lock, you'd
> > have to give up the read lock, which means someone else can change the
> > file before you do.  End of story, until an OS gives us LOCK_UPGD.
> 
> Hmm. It gets worse - and not just in perl but also in native C (I've
> tested both). When you "upgrade" a flock from LOCK_SH to LOCK_EX the
> kernel actually releases the lock transiently whilst *appearing* to
> succeed atomically. Ouch.
> 
> The issue here (as far as I'm concerned) is that flock *appears* to let
> you upgrade atomically but it doesn't really do so. Can this warning be
> added explicitly to perldoc for flock?

This doesn't belong in perldoc -- it depends on the underlying OS and
isn't a property of Perl.  The documentation of all system calls in
Perl must be read in conjunction with the man page of that call.

In the case of flock(), the man page is quite explicit that "lock
upgrading" implies giving up the previous lock and acquiring a new one
(with the consequence that other processes can get access to the file
in between).  The choice of the term "upgrading" is certainly unfortunate
for that action.

Anno


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

Date: Wed, 10 Sep 2003 11:29:48 +0200
From: Andre Warnier <aw_nospam@compuserve.com>
Subject: open2(), win2k, perl5.6.1, Win32::Daemon
Message-Id: <bjmqqd$9l7$1@ngspool-d02.news.aol.com>

Help requested, probably from a Win2K/ActivePerl specialist :

I wrote a program which starts up another process via an open2() call 
and writes commands and reads answers to that other process's STDIN & 
STDOUT.
That program runs under ActivePerl 5.6.1 build 633, both under Unixes 
and under Win32, and can run in both "daemon" mode (service under Win32) 
and on a terminal (console under Win32) for debugging.
(Under Win32, it uses Win32::Daemon to run as a Service).
The program has been running fine for about a year under various 
platforms and circumstances.  Specifically, the exact same code runs 
under Unix(es) both as a daemon and on a terminal, it runs under Windows 
NT 4.0 both as a Service and on a console, and it runs under Windows 
2000 on the console.  The only case in which it doesn't run properly is 
under Windows 2000 as a service.

In this last case, the program fails when trying to start the external 
process via the open2() call, with the following error message :
"open2: Can't call method "close" on an undefined value at 
c:/Perl/lib/IPC/Open3.pm line 327." and does not start the external program.
The user-id under which it tries to run as a service under Win2k is not 
Administrator, but is a member of the Administrators group, and has the 
"run as service" permission.  The Win2k service starts up fine, the 
program starts to run, only this open2() call fails.  The program 
catches the error and recovers and continues to run, but each time it 
tries this open2(), it fails with the same message, thus the external 
program never gets started.

My questions would thus be :
1) Is there a specific problem known with the open2() call with 
ActivePerl 5.6.1 build 633 under Win2k that would explain the above ?
2) If not, I suspect some kind of Win2k "user privileges" question may 
be the cause.  Does anyone have any information (or suspicions) about this ?

Thanks in advance,
Andre Warnier



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

Date: 10 Sep 2003 01:19:21 -0700
From: gordonp@myrealbox.com (Gordon)
Subject: Perl system() command failing under CYGWIN
Message-Id: <721544eb.0309100019.6adf42ad@posting.google.com>

Hi,
I am trying to install a software product that uses Perl under CYGWIN
and am having a problem with the Perl system() command failing.

The following script works from a Windows 2000 cmd prompt:
!#g:\perl\bin
print "dir\n";
system ( "dir");

The following script run from the CYGWIN prompt (on the same PC),
prints 'ls[return]' but fails to execute the 'system ("ls") command;
no error is displayed it just skips over the system() line:
!#g:/perl/bin
print "ls\n";
system("ls");

Perl & Cygwin are supplied with the software, so I am hesitant to
upgrade them. Perl is v5.005_002. PC is running Windows 2000 Server
SP3 as recommended by the software supplier.

I have tried the usual Google and mailing list archive searches with
no luck. So, any suggestions are much appreciated.

TIA,
Gordon


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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

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.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.

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 V10 Issue 5476
***************************************


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