[25953] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8172 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 14 18:05:39 2005

Date: Tue, 14 Jun 2005 15: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           Tue, 14 Jun 2005     Volume: 10 Number: 8172

Today's topics:
        Fixed: ActiveState: Can't spawn "cmd.exe"? <occitan@esperanto.org>
    Re: Fixed: ActiveState: Can't spawn "cmd.exe"? <1usa@llenroc.ude.invalid>
        Hash Sorting <pj_sammie@hotmail.com>
    Re: Hash Sorting <mark.clementsREMOVETHIS@wanadoo.fr>
    Re: Hash Sorting <pj_sammie@hotmail.com>
    Re: increase performance (Anno Siegel)
    Re: increase performance (Anno Siegel)
    Re: increase performance <someone@example.com>
    Re: Masking by columns for grep <djames@thehub.com.au>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 14 Jun 2005 23:00:42 +0200
From: Daniel Pfeiffer <occitan@esperanto.org>
To: Sisyphus <sisyphus1@nomail.afraid.org>
Subject: Fixed: ActiveState: Can't spawn "cmd.exe"?
Message-Id: <42AF457A.9060709@esperanto.org>

la 13.06.2005 13:15 Sisyphus skribis:
> "Daniel Pfeiffer" <occitan@esperanto.org> wrote in message
> news:42AD4610.8060109@esperanto.org...
> 
>>la 13.06.2005 04:23 Sisyphus skribis:
>>>When testing with MinGW perl what shell are you running in ?
>>
>>/usr/bin/sh which is MinGW's bash 2.04.
> 
> Normally, perl is built using MinGW in the cmd.exe shell, following the
> instructions in the README.win32 (which involves editing the
> Win32\makefile.mk). It's also normal to run that perl in the cmd.exe shell.
> I believe it's quite a trivial thing to run MinGW-built perl (and
> ActiveState perl, too) in a bash shell, though I've not personally done
> that. Not sure why I'm mentioning this .... I guess it's just that the
> reference to MinGW's bash shell makes me wonder whether you've built perl
> with MinGW in some unusual way .... and if that's the case I'm further
> wondering whether it should be brought to your attention :-)

I had a hard time getting MinGW together, even though Msys is supposed to give 
all you need.  I picked up a lot of packages, before I finally had a Perl. 
It's the Perl 5.6.1 they deliver on their server.  I compiled nothing myself.

>>>Could it be that you're invoking the wrong shell without realising it?
>>
>>Probably!  In all three environments, I reduce the PATH to a minimum, so
> 
> as to
> 
>>not get any "goodies" from another environment.  E.g. ActiveState would
>>happily pick up Unix commands from MKS, MinGW and Cygwin, so I do
>>
>>set PATH=C:\WINNT\system32;C:\WINNT;C:\Perl\bin
>>
>>The first directory contains CMD.EXE.  (Which answers your 2nd post).

I finally sorted this one out.  Coming from Unix, makepp assumes PATH to be 
colon separated and splits it on that.  I haven't tracked where it gets put 
together again (after all we still have the full PATH intact as well) but 
splitting it on ';' and stripping the quotes has solved the cmd.exe problem :-)

So now finally makepp works on Windows.  The remaining issues are to teach it 
to parse typical Windows compiler invocations, because it figures out implicit 
dependencies from -I and -l/-L options, such that you don't need makedep.

It would also be great to have it implicitly add .exe, such that you don't 
need separate handling of Windows targets, and being case-preserving on file 
names, rather than lowercasing everything.  These issues can be a bit tricky, 
because  makepp knows about potential files from the rules, even before they 
actually exist, but then it can only guess these things.

Thanks again for all your support!
Daniel


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

Date: Tue, 14 Jun 2005 21:36:16 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Fixed: ActiveState: Can't spawn "cmd.exe"?
Message-Id: <Xns9675B313082F6asu1cornelledu@127.0.0.1>

Daniel Pfeiffer <occitan@esperanto.org> wrote in
news:42AF457A.9060709@esperanto.org: 
> Coming from Unix, makepp assumes PATH to be colon separated and 
> splits it on that.

And what is your excuse for not using File::Spec?

> I haven't tracked where it gets put together again 

Very confidence inspiring.

Indeed, these posts have helped me decide never to give makepp a shot.

> but splitting it on ';' 

Oh yeah! Repeat again, what is your excuse for not using File::Spec?

<URL: http://search.cpan.org/~kwilliams/PathTools-3.08/lib/File/Spec.pm>

  File::Spec - portably perform operations on file names

> and stripping the quotes has solved the cmd.exe problem :-) 

And probably introduced a bunch more given the haphazard way you are 
approaching this.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html


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

Date: Tue, 14 Jun 2005 13:49:56 -0700
From: "Brad" <pj_sammie@hotmail.com>
Subject: Hash Sorting
Message-Id: <j-idnRzQAdto3zLfRVn-jQ@comcast.com>

I have a hash like this:

$HASH{'key'}{'date'} = some date
$HASH{'key'}{'status'} = some status

I'd like to sort and display this by date:

key | date | status

I cannot seem to find any references to sorting this type of hash in this 
way. I need some assistance finding some documentation, or a copy/paste of 
the code for this type of sort.

Thanks for any help,
Brad 




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

Date: Tue, 14 Jun 2005 22:59:57 +0200
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: Hash Sorting
Message-Id: <17yxa132mrxi2$.1glvhfm9chl0q$.dlg@40tude.net>

On Tue, 14 Jun 2005 13:49:56 -0700, Brad wrote:

> I have a hash like this:
> 
> $HASH{'key'}{'date'} = some date
> $HASH{'key'}{'status'} = some status
> 
> I'd like to sort and display this by date:
> 
> key | date | status
> 
> I cannot seem to find any references to sorting this type of hash in this 
> way. I need some assistance finding some documentation, or a copy/paste of 
> the code for this type of sort.
> 
You can do it with a double map and sort.

Google for 

"schwarzian transform" perl

Mark


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

Date: Tue, 14 Jun 2005 14:02:58 -0700
From: "Brad" <pj_sammie@hotmail.com>
Subject: Re: Hash Sorting
Message-Id: <sPKdnZl6BPSa2zLfRVn-jg@comcast.com>

> You can do it with a double map and sort.
>
> Google for
>
> "schwarzian transform" perl
>
> Mark

Thanks Mark... kept searching, after my post, and I found the answer:

foreach my $spc ( sort { $hoh{$a}->{'cpu'} <=> $hoh{$b}->{'cpu'} } keys 
%hoh) {
        print $spc, " has got ", ${hoh}{$spc}{cpu}, "\n";
}




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

Date: 14 Jun 2005 18:15:50 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: increase performance
Message-Id: <d8n6sm$1th$1@mamenchi.zrz.TU-Berlin.DE>

A. Sinan Unur <1usa@llenroc.ude.invalid> wrote in comp.lang.perl.misc:
> Mike Heins <mikeh@perusion.net> wrote in
> news:slrndafcq9.n99.mikeh@bill.heins.net: 

[...]

> However, the easiest way to speed this task up by an order of magnitude 
> is to avoid printing. As (I think) Anno says: Print rarely, print late.

Uri.  I agree with him.

Anno


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

Date: 14 Jun 2005 18:33:10 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: increase performance
Message-Id: <d8n7t6$1th$3@mamenchi.zrz.TU-Berlin.DE>

John W. Krahn <krahnj@telus.net> wrote in comp.lang.perl.misc:
> Rodrick Brown wrote:

[...]

> my %months = qw( 01 jan 02 feb 03 mar 04 apr 05 may 06 june
>                   07 jul 08 aug 09 sep 10 oct 11 nov 12 dec );

We have seen various ways of setting up this hash in this thread.  I'd
go out of my way to let the computer do the counting:

    my %months;
    @months{ 1 .. 12} = qw(jan feb mar apr may jun jul aug sep oct nov dec);

Anno



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

Date: Tue, 14 Jun 2005 19:57:14 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: increase performance
Message-Id: <uEGre.63562$tt5.52194@edtnps90>

Anno Siegel wrote:
> John W. Krahn <krahnj@telus.net> wrote in comp.lang.perl.misc:
> 
>>Rodrick Brown wrote:
> 
> 
> [...]
> 
> 
>>my %months = qw( 01 jan 02 feb 03 mar 04 apr 05 may 06 june
>>                  07 jul 08 aug 09 sep 10 oct 11 nov 12 dec );
> 
> 
> We have seen various ways of setting up this hash in this thread.  I'd
> go out of my way to let the computer do the counting:
> 
>     my %months;
>     @months{ 1 .. 12} = qw(jan feb mar apr may jun jul aug sep oct nov dec);

And with the leading zeros:

@months{ '01' .. '12' } = qw(jan feb mar apr may jun jul aug sep oct nov dec);


John
-- 
use Perl;
program
fulfillment


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

Date: Tue, 14 Jun 2005 22:00:05 GMT
From: Damian James <djames@thehub.com.au>
Subject: Re: Masking by columns for grep
Message-Id: <slrndauhb2.gf6.djames@puli.home>

On 14 Jun 2005 11:16:37 GMT, Anno Siegel said:
> ...
> Rewriting it
> 
>     @foo = grep /\G\Q$theString/, map { pos = 50; $_ } @foo;
> 
> still suffers from the fact that the elements that map() returns don't
> have their pos() set.  I admit that I don't quite understand that.

Me either from my reading of the docs. 

> $_ in map should be an alias to the current element of @foo, and
> grep should see an alias to that, with its position set.
> 
> This works as intended:
> 
>     pos = 50 for @foo;
>     @foo = grep /\G\Q$theString/, @foo;

Curious. I would find the following more obvious about what it does:

    @foo = grep { pos = 50; /\G\Q$theString/ } @foo; 

I don't really understand where the position is being kept in your
version (or rather, how map() knows about it).

--damian


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 8172
***************************************


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