[24221] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6413 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 19 14:16:37 2004

Date: Mon, 19 Apr 2004 11:15:52 -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           Mon, 19 Apr 2004     Volume: 10 Number: 6413

Today's topics:
        Call for an Impeachment Inquiry of Bush and Cheney <gtg321f@mail.gatech.edu>
    Re: Call for an Impeachment Inquiry of Bush and Cheney Mousey@Mousey.Com
        capturing stderr from windows (Brian)
    Re: capturing stderr from windows <ittyspam@yahoo.com>
    Re: capturing stderr from windows <for-spammers-only@web.de>
    Re: CGI::Carp and "useless quotes" <noreply@gunnar.cc>
        Changing perl script bnews-fetch from  by Carl Declerck <borniac@hotmail.com>
        compilation problem when adding a module (felipe200112)
        Conditional Operator not working like I expected <mikeflan@earthlink.net>
    Re: Conditional Operator not working like I expected <spamtrap@dot-app.org>
    Re: Conditional Operator not working like I expected <mikeflan@earthlink.net>
    Re: Conditional Operator not working like I expected ctcgag@hotmail.com
    Re: Create MD5 of files in directories and subdirectori (James Willmore)
    Re: Create MD5 of files in directories and subdirectori <bik.mido@tiscalinet.it>
    Re: Create MD5 of files in directories and subdirectori <bik.mido@tiscalinet.it>
    Re: Create MD5 of files in directories and subdirectori <Joe.Smith@inwap.com>
    Re: Create MD5 of files in directories and subdirectori <Joe.Smith@inwap.com>
    Re: Curses::UI (Anno Siegel)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 17 Apr 2004 19:55:19 GMT
From: william campbell <gtg321f@mail.gatech.edu>
Subject: Call for an Impeachment Inquiry of Bush and Cheney
Message-Id: <f8ea2e15.77df897d@host-69-48-73-244.roc.choiceone.net>

Call for an Impeachment Inquiry of Bush and Cheney, 
Get Congress to Take Action

Sign our online Petition and read below for more information:
   
   http://www.votenader.org/get_involved/impeach.php

HEY DUDE WHERE'S MY BUDDY!!!???
COME BACK HOME MICHAEL!!!

Ok Michael, you've had your realpolitik fling with ex-General Wesley
Clark. Your endorsed Presidential candidate in the Democratic Primaries
has withdrawn. It is time for you to come home, to join your buddies and
resume your only genuine role which is that of defiance and resistance.
Compliance and assistance with the Democrats does not accord with your
past, your character, your bold writings and, most memorably, your long
corrosive assaults on the Party that betrayed the working classes and
plunged our country into corporate globalization. Remember, Michael,
you're the flinty man from Flint, Michigan. You've never forgotten your
roots. The heady Hollywood, Manhattan scene with the celebrities and
Academy Awards have never gotten to your head but rather have gotten
into your deserving pockets. How we all recall your standing before one
billion people in Los Angeles at the televised Academy Awards in 2003
and, breaking the customary cant of the awardees, throwing the gauntlet
down to George W. Bush and his "fictitious" war mongering. 

Now the War has become a quagmire, with both Republicans and Democrats
complicit (check the votes in Congress). The Draft may be on the way. So
what are you doing going on the Al Franken Show very nearly breaking
down when Al Gore (he of the pro NAFTA/GATT, anti-worker, regime-change,
Iraq-bombing, lethal sanctions on half a million children
Administration) called and thought you were apologizing. You have
nothing to apologize for, Michael. Gore has a lot to apologize
for-blowing the election he won in Florida and the country as a whole
and for blowing, with Bill Clinton, the many opportunities the
rich-booming Nineties and the collapse of the Soviet Union gave this
country to turn a peace dividend into a pro-worker, pro-environment,
pro-consumer and anti-poverty resurgence. 

Come back and join our Presidential campaign, Michael. Talk to those
"Reagan Democrats"-those 35% of union members who still vote Republican
and against their own interests-as only you can. Michael, if you go
pumping for the Democratic Party this year, just what are you going to
say to the unemployed steelworkers near Sparrows Point in Maryland? To
the megathousands of laid off textile and furniture workers in North and
South Carolina? To the abandoned auto workers waiting and waiting near
their empty factories that went to repressive countries? To the millions
of blue-collar workers, who fought our wars, only to learn that the two
parties won't fight for their company pensions and health insurance? Are
you going to tell them how the Democratic Party pushed through the WTO,
let their pensions erode or disappear, were too busy collecting checks
from the corporate bosses to pay attention to the corporate crime wave
that looted and drained trillions of dollars from millions of workers,
their retirement and small investments? Will you tell them that the
cowardly Democrats, who couldn't win the fewer elections they are now
not losing without the labor vote, won't even mount a determined drive
to repeal the notorious, union-blocking Taft Hartley Act? 

How can you be free to be what you are, or to depress Bush's vote, to
jolt into consciousness the moribund Democratic Party? 

Hey Dude, join your real buddies! The ones you may be thinking about
just don't fit either your message, your vision, or our website
VoteNader.org. 

Come back home Michael. The workers and the youth of America are looking
for you. 

Best regards, 
Ralph Nader 


P.S. Will you put this invitation on your website and see how your fans
     react to Michael Moore returning to the Nader 2004 presidential
     campaign? Patti Smith will reserve a big singing spot, for you, on the
     stage for the customary finale, PEOPLE HAVE THE POWER. 


Wednesday April 14, 2004 

Join the Call for an Impeachment Inquiry of Bush and Cheney
Help us Get Congress to Take Action

You can help the call for an impeachment inquiry of President Bush and
Vice President Dick Cheney. Sign our online Petition.

   http://www.votenader.org/get_involved/impeach.php


George W. Bush and Dick Cheney should be impeached for two reasons: 

   They led the United States into an illegal, unconstitutional war in Iraq. 
   They misled the Congress and the American people with five falsehoods that led to war. 

All it takes is one Member of the House of Representatives to call for
an Impeachment Inquiry to start the process to investigate the two
grounds. If the House then votes by a simple majority for Articles of
Impeachment, the Senate would then undertake a trial of the President
and Vice President. They would only be convicted, and impeached, if
two-thirds of the Senate agrees. 

--

compiled frequent flier miles visiting Hanoi during the Vietnam War era. The
Muste Foundation funds groups like the War Resisters League, School of the
Americas Watch, Nicaragua Solidarity Network, International Peace bureau,
International Fellowship of Reconciliation, Coalition for Human Rights of
Immigrants, and WILPF.

NION: Castro and Islamist Terror

The Interreligous Foundation for Community Organization is a pro-Castro
proxy group. Members of their staff such as Lucius Walker (Executive
Director), Marilyn Clement (Treasurer) and Ellen Bernstein (Grants
Administrator) are all Castrophiles  In Havana in November 2000, Lucius
Walker proclaimed, "Long live the creative example of the Cuban Revolution!
Long live the wisdom and heartfelt concern for the poor of the world by
Fidel Castro!"  This was a follow-up to his pro-Castro speech in 1996,
commemorating the 75th anniversary of the Communist Party USA. Marilyn
Clement is a co-organizer of the WILPF's Sister-to-Sister Cuba project. The
WILPF also issued a condemnation of Clinton's Cuba policy in 1998. Bernstein
was also quoted as saying she believes Cuba is the paradigm of democracy.

IFCO does not limit its activity to pro-Castro factions, though.  Its
management maintains relationships with extremist Islamist groups as well.
Walker travels frequently to Iraq, usually alongside Ramsey Clark. IFCO is a
member of ANSWER Steering Committee.) Bernstein is a member of the American
Muslim Council's campaign against the use of secret evidence. Clement met
with Palestinians during a WILPF "solidarity" conference in May 2002. IFCO
is also a fiscal sponsor of the National Coalition to Protect Political
Freedom




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

Date: Sun, 18 Apr 2004 00:30:39 GMT
From: Mousey@Mousey.Com
Subject: Re: Call for an Impeachment Inquiry of Bush and Cheney
Message-Id: <Q_jgc.1$dl5.0@fe04.usenetserver.com>

You think that way get a Vote spam newsgroups i say this i will never vote
for you and i hope them people keep using your Email as spoofs they do it
because you SPAM so get LOST



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

Date: 19 Apr 2004 08:14:24 -0700
From: lucid1@mediaone.net (Brian)
Subject: capturing stderr from windows
Message-Id: <961d6f35.0404190714.61e5ec4f@posting.google.com>

I wrote a perl script which invokes system calls using system().

I want to be able to redirect the output of these calls to a file.  I
thought you could use 2>&1 to do this.  Such as:

system("mycommand 2>&1 > results.log");

But all I get in the logfile is stdout.  stderr still goes to the
screen.

Anyone have any clues?


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

Date: Mon, 19 Apr 2004 11:29:34 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: capturing stderr from windows
Message-Id: <20040419112726.Q21613@dishwasher.cs.rpi.edu>

On Mon, 19 Apr 2004, Brian wrote:

> I wrote a perl script which invokes system calls using system().
>
> I want to be able to redirect the output of these calls to a file.  I
> thought you could use 2>&1 to do this.  Such as:
>
> system("mycommand 2>&1 > results.log");
>
> But all I get in the logfile is stdout.  stderr still goes to the
> screen.
>
> Anyone have any clues?

What version of Windows?  That's mildly important.

On Windows 2000, what you had above gives me the same results.  If you
switch the arguments, however, like so:

system("mycommand >results.log 2>&1");

I get both STDOUT and STDERR messages in results.log.  Annoyingly,
however, all the STDERR prints are made before the STDOUT prints.  I'm
willing to bet that's a buffer setting that can be fiddled with though.
I'll leave that as an excercise to the reader. :-)

Paul Lalli


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

Date: Mon, 19 Apr 2004 17:50:15 +0200
From: Toni Erdmann <for-spammers-only@web.de>
Subject: Re: capturing stderr from windows
Message-Id: <4083F537.9060007@web.de>

Paul Lalli wrote:

> On Mon, 19 Apr 2004, Brian wrote:
> 
> 
>>I wrote a perl script which invokes system calls using system().
>>
>>I want to be able to redirect the output of these calls to a file.  I
>>thought you could use 2>&1 to do this.  Such as:
>>
>>system("mycommand 2>&1 > results.log");
>>
>>But all I get in the logfile is stdout.  stderr still goes to the
>>screen.
>>
>>Anyone have any clues?
> 
> 
> What version of Windows?  That's mildly important.
> 
> On Windows 2000, what you had above gives me the same results.  If you
> switch the arguments, however, like so:
> 
> system("mycommand >results.log 2>&1");
> 
> I get both STDOUT and STDERR messages in results.log.  Annoyingly,
> however, all the STDERR prints are made before the STDOUT prints.  I'm
> willing to bet that's a buffer setting that can be fiddled with though.
> I'll leave that as an excercise to the reader. :-)
> 

That's normal behaviour.

mycommand 2>&1 > result.log

1.) redirect STDERR to the *current* STDOUT setting/file descriptor
2.) redirect STDOUT to a file (leaving STDERR as is == screen)

It does what you want.

mycommand > result.log 2>&1

1.) redirect STDOUT to a file
2.) redirect STDERR to the *current* STDOUT setting/file descriptor

Toni


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

Date: Fri, 16 Apr 2004 22:42:01 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: CGI::Carp and "useless quotes"
Message-Id: <c5pggt$4enp3$1@ID-184292.news.uni-berlin.de>

Matt Garrish wrote:
> Gunnar Hjalmarsson wrote:
>> Matt Garrish wrote:
>>> Gunnar Hjalmarsson wrote:
>>>> As a result of this thread, I just reported this bug:
>>>> 
>>>> http://rt.cpan.org/NoAuth/Bug.html?id=5932
>>> 
>>> That would have been my advice had I had more time to get back
>>> to you. Not knowing the inner workings of the module I wouldn't
>>> want to speculate...
>> 
>> Agreed.
>> 
>> FYI, I noticed that Lincoln already has changed the status of the
>> bug report to "resolved". That was quick. :)
> 
> It will be interesting to see if it is mentioned in the next
> release, and whether he considered it a bug or not...

 From the Revision History of CGI version 3.05:

"3. Fixed CGI::Carp::die() so as to avoid problems from _longmess()
clobbering @_."

So yes, he obviously considered it a bug worth fixing (within a few
minutes!). Our discussion bore fruit. :)

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Sun, 18 Apr 2004 11:36:55 GMT
From: borniac <borniac@hotmail.com>
Subject: Changing perl script bnews-fetch from  by Carl Declerck
Message-Id: <180420041335320404%borniac@hotmail.com>


The problemm I have is that not al the post posted with yEnc are
retrieved with that script. Is there somebody that uses this and has
the same problem and can you help to change it.

This is the code in that perl script for look thing posted with yEnc up.

   } elsif ($subject =~ /^(.*\s+yEnc)\s+"([^"]+)"\s+\((\d+)\/(\d+)\)/
      || $subject =~ /^(.*)\s+"([^"]+)"\s+yEnc\s+\((\d+)\/(\d+)\)/
      || $subject =~ /^(.*)\s+"([^"]+)"\s+\((\d+)\/(\d+)\).*yEnc/
      || $subject =~ /^(.*)\s+"([^"]+)"\s+\d+\s+yEnc\s+bytes/) {

en this I have now.

   } elsif ($subject =~ /^(.*\s+yEnc)\s+"([^"]+)"\s+\((\d+)\/(\d+)\)/
      || $subject =~ /^(.*)\s+"([^"]+)"\s+yEnc\s+\((\d+)\/(\d+)\)/
      || $subject =~ /^(.*)\s+"([^"]+)"\s+\((\d+)\/(\d+)\).*yEnc/
      || $subject =~ /^(.*)\s+"([^"]+)"\s+\d+\s+yEnc\s+bytes/
      || $subject =~ /^(.*)\s+([^"]+)\s+yEnc\s+\((\d+)\/(\d+)\)/
      || $subject =~ /^(.*\yEnc)\s+"([^"]+)"\s+\((\d+)\/(\d+)\)/) {


but still doesn't see everything

Thanks
Borniac


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

Date: 19 Apr 2004 09:44:45 -0700
From: felipe200112@yahoo.com (felipe200112)
Subject: compilation problem when adding a module
Message-Id: <b1c37d24.0404190844.3228ebff@posting.google.com>

This is generic to my machine. Maybe is it an initialisation problem...
Do you have an idea ??

Thanks in advance.

Philippe

"Version_check" is not exported by the ExtUtils::MakeMaker module
Can't continue after import errors at -e line 0
==============================================

linux51:/usr/src/rpm/SOURCES/IO-Socket-SSL-0.93# perl Makefile.PL
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_US"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Writing Makefile for IO::Socket::SSL
linux51:/usr/src/rpm/SOURCES/IO-Socket-SSL-0.93# make
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_US"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
"Version_check" is not exported by the ExtUtils::MakeMaker module
Can't continue after import errors at -e line 0
BEGIN failed--compilation aborted.
make: *** [Version_check] Error 255
linux51:/usr/src/rpm/SOURCES/IO-Socket-SSL-0.93#


linux51:/usr/src/rpm/SOURCES/IO-Socket-SSL-0.93# uname -a
Linux linux51.fty 2.4.18-bf2.4 #1 Son Apr 14 09:53:28 CEST 2002 i686 GNU/Linux
linux51:/usr/src/rpm/SOURCES/IO-Socket-SSL-0.93# perl -v

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_US"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

This is perl, v5.8.3 built for i386-linux-thread-multi

Copyright 1987-2003, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

linux51:/usr/src/rpm/SOURCES/IO-Socket-SSL-0.93#


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

Date: Sat, 17 Apr 2004 17:52:23 GMT
From: Mike Flannigan <mikeflan@earthlink.net>
Subject: Conditional Operator not working like I expected
Message-Id: <40816EFB.AFDAA14D@earthlink.net>


This code produces 'no', when I expected it to print 'yes'.  I read
perlop and the write-up on conditional operators, but could
not locate my problem.  I challenge you to make me look
dumber than I already feel  :-)


use strict;
use warnings;

my $atan = 1.82447366204915;
my $deg;

($atan >= 0)? $deg = 'yes' : $deg = 'no';

print "$deg\n";

__END__



I tried a bunch of things (like ge) to make it work, but
I could only get this version to work as expected:

use strict;
use warnings;

my $atan = 1.82447366204915;
my $deg;

if ($atan >= 0) {
    $deg = 'yes';
}
else {
    $deg = 'no';
}

print "$deg\n";

__END__




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

Date: Sat, 17 Apr 2004 14:01:22 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Conditional Operator not working like I expected
Message-Id: <B72dnX_wjMJu7RzdRVn-tA@adelphia.com>

Mike Flannigan wrote:

This:

> ($atan >= 0)? $deg = 'yes' : $deg = 'no';

Should be:

$deg = ($atan >= 0) ? 'yes' : 'no';

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Sat, 17 Apr 2004 19:51:38 GMT
From: Mike Flannigan <mikeflan@earthlink.net>
Subject: Re: Conditional Operator not working like I expected
Message-Id: <40818AEC.19463B87@earthlink.net>



Sherm Pendley wrote:

> Should be:
>
> $deg = ($atan >= 0) ? 'yes' : 'no';
>
> sherm--

Thanks.  I appreciate it.


Mike




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

Date: 17 Apr 2004 20:03:21 GMT
From: ctcgag@hotmail.com
Subject: Re: Conditional Operator not working like I expected
Message-Id: <20040417160321.279$KU@newsreader.com>

Mike Flannigan <mikeflan@earthlink.net> wrote:
> This code produces 'no', when I expected it to print 'yes'.  I read
> perlop and the write-up on conditional operators, but could
> not locate my problem.  I challenge you to make me look
> dumber than I already feel  :-)
>
> use strict;
> use warnings;
>
> my $atan = 1.82447366204915;
> my $deg;
>
> ($atan >= 0)? $deg = 'yes' : $deg = 'no';
>
> print "$deg\n";

$ perl -MO=Deparse,-p
($atan >= 0)? $deg = 'yes' : $deg = 'no';
__END__
((($atan >= 0) ? ($deg = 'yes') : $deg) = 'no');
- syntax OK

The conditional operator has a higher precedence than assignment,
so "no" is assigned to the results of the conditional.  The results of the
conditional are always $deg.

You wanted:

($atan >=0) ? ($deg='yes') : ($deg='no');


Although really, you probably want:

my $deg = ($atan >=0) ? 'yes' :'no';

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 16 Apr 2004 16:39:10 -0700
From: jwillmore@myrealbox.com (James Willmore)
Subject: Re: Create MD5 of files in directories and subdirectories
Message-Id: <d61170e5.0404161539.85c0f7@posting.google.com>

nicogroen@planet.nl (nicogroen) wrote in message news:<b9343f9a.0404160206.59047d8f@posting.google.com>...
> Can somebody help me out with the following problem. I tried to use
> the following script of Ron Savage to create MD5 checksums of files in
> a directory and all subdirectories in it, posted here:
> 
> http://groups.google.nl/groups?hl=nl&lr=&ie=UTF-8&oe=UTF-8&selm=7dbo9s%24ekh2%40atbhp.corpmel.bhp.com.au&rnum=2
> 
> On OpenBSD:
> It takes a long time to create MD5 checksums of large files (about 4
> seconds of a file of 3MB, 12 sec of a file of 5.5MB, 43 sec of a file
> of 10,5MB).
> 
> On Windows:
> Files having the same filesize (all 14,5MB) creates the same MD5
> checksum. This process goes very fast (perhaps too fast).
> 
> On Redhat and FreeBSD:
> The script retuns the flowing error message: 
> 
> can't open (#path#
> ): No such file or directory at md5.pl line 39.
> 
> The script should work on all operation systems.

I figured I'd post an example of what I meant by 'filter'.  You'll
notice that I used 'warn' instead of 'die' if the script can't digest
a file.  This will prevent the script from bombing if it's run from
cron or some other method by a common user.  The output of the script
is, again, your call.  And to sort (or not) is your call.

I tested it on a Linux box with the following command:
find /home/jim | perl news.pl | sort

However, I'd refine the find command to avoid getting files from other
filesystems, NFS mounts, syslinks, etc.  And if you use it on a
Windows box, you'll have to find the right switches for `dir`.  I
don't really do Windows :-)

I didn't benchmark it.  There's going to be variations on this -
because each OS and filesystem is different.

Enjoy :-)

==start (what I called news.pl)==
#!/usr/gnu/bin/perl -w
#
# Name:
# MD5.pl.
#
# Purpose:
# Calculate the MD5 digest of all files in a directory and its
subdirectories.
#
# Parameter:
# File(s) provided to script from STDIN.
#
# Output:
# Digest of each file from STDIN.
#
# Output format:
# <Dirname/File name>: <MD5>\n
# <Dirname/File name>: <MD5>\n
# ...

use integer;
use strict;

use Digest::MD5;

# -------------------------------------------------------------------
my $md5 = Digest::MD5->new();

while(<>){
    chomp;
    newprocess($md5, $_);
}

sub newprocess{
    local $/ = undef;
    my($md5, $file) = @_;
    open(FILE, $_) 
        or warn "FAILED TO DIGEST $_: $!\n" and return;
    my $data = <FILE>;
    print "$_: ".$md5->add($data)->hexdigest()."\n";
    close FILE;
}

==end==


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

Date: Sat, 17 Apr 2004 10:25:22 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Create MD5 of files in directories and subdirectories
Message-Id: <21q180hghbp12shddpf0eavasma03eabdu@4ax.com>

On 16 Apr 2004 03:06:17 -0700, nicogroen@planet.nl (nicogroen) wrote:

>Can somebody help me out with the following problem. I tried to use
>the following script of Ron Savage to create MD5 checksums of files in
>a directory and all subdirectories in it, posted here:
>
>http://groups.google.nl/groups?hl=nl&lr=&ie=UTF-8&oe=UTF-8&selm=7dbo9s%24ekh2%40atbhp.corpmel.bhp.com.au&rnum=2

I didn't see that: well, on *nix (linux), I'd just do

  find <dir> -type f | xargs md5sums

but if you want it in Perl and running on virtually any system perl
runs on, then see if something like this is fine for you/can be
adapted to your needs:

  #!/usr/bin/perl -l
  
  use strict;
  use warnings;
  use File::Find;
  use Digest::MD5;
  
  @ARGV=grep { -d or !warn "`$_': not a directory!\n" } @ARGV;
  die "Usage: $0 <dir> [<dirs>]" unless @ARGV;
  
  find { no_chdir => 1,
         wanted => sub {
  	   return unless -f;
  	   open my $fh, '<:raw', $_ or 
  	     warn "Can't open `$_': $!\n" and return;
  	   print Digest::MD5->new->addfile($fh)->hexdigest,
  	     '  ', $_;
         } }, @ARGV;
  	   
  __END__


[Tested to work correctly in Linux (2.6.5) and W98...]

>On Windows:
>Files having the same filesize (all 14,5MB) creates the same MD5
>checksum. This process goes very fast (perhaps too fast).

Huh?!? Are you *really* sure that by any chance not only those files
have the same file size but are also actually identical?


HTH,
Michele
-- 
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
  "perl bug File::Basename and Perl's nature"


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

Date: Sat, 17 Apr 2004 15:19:47 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Create MD5 of files in directories and subdirectories
Message-Id: <194280dtmvfa78uuoq0j6qkepl3int4shi@4ax.com>

On Sat, 17 Apr 2004 10:25:22 +0200, Michele Dondi
<bik.mido@tiscalinet.it> wrote:

>I didn't see that: well, on *nix (linux), I'd just do
>
>  find <dir> -type f | xargs md5sums

  find <dir> -type f | xargs md5sum

actually! (sorry: a typo!)


Michele
-- 
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
  "perl bug File::Basename and Perl's nature"


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

Date: Mon, 19 Apr 2004 01:01:52 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Create MD5 of files in directories and subdirectories
Message-Id: <3yFgc.164953$K91.421668@attbi_s02>

nicogroen wrote:

> On OpenBSD:
> It takes a long time to create MD5 checksums of large files (about 4
> seconds of a file of 3MB, 12 sec of a file of 5.5MB, 43 sec of a file
> of 10,5MB).

That is expected if you are stuck the pure-perl implementation of
MD5 as opposed to the compiled XS module.

> On Windows:
> Files having the same filesize (all 14,5MB) creates the same MD5
> checksum. This process goes very fast (perhaps too fast).
> 
> On Redhat and FreeBSD:
> The script retuns the flowing error message: 
> 
> can't open (#path#
> ): No such file or directory at md5.pl line 39.
> 
> The script should work on all operation systems.

It works on all systems where Digest::MD5 is properly installed.

Looks like you're running into the slow method that is invoked
whenever the MD5.so loadable object cannot be found.

   eval {
     Digest::MD5->bootstrap($VERSION);	# Load the fast MD5.so object
   };
   if ($@) {
     eval {
         # Try to load the pure perl version if bootstrap fails
         require Digest::Perl::MD5;
         Digest::Perl::MD5->import(qw(md5 md5_hex md5_base64));
         push(@ISA, "Digest::Perl::MD5");  # make OO interface work
     };
   }

	-Joe


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

Date: Mon, 19 Apr 2004 01:12:00 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Create MD5 of files in directories and subdirectories
Message-Id: <AHFgc.14043$hw5.15781@attbi_s53>

Michele Dondi wrote:

> I didn't see that: well, on *nix (linux), I'd just do
> 
>   find <dir> -type f | xargs md5sum

Not recommended for Samba shares or anywhere that file names
and/or directory names have imbedded blanks.

   find <dir> -type f -print0 | xargs -0 md5sum

	-Joe


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

Date: 19 Apr 2004 10:40:55 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Curses::UI
Message-Id: <c60abn$s66$1@mamenchi.zrz.TU-Berlin.DE>

Keith Davies  <keithABUSE@araneid.com> wrote in comp.lang.perl.misc:
> 
> I'm not sure what I'm doing wrong:
> 
> #!/usr/bin/perl -w
> use strict ;
> use Curses::UI;
> 
> my $cui = new Curses::UI;
> my %w;
> 
> $w{1} = $cui->add(
>                   'w1', 'Window',
>                   -border => 1,
>                   -y => 1,
>                   -padbottom => 3,
>                  );
> my %notes = ('lblNotes', 'Label',
>              -text => 'Notes: ',
>              -x => 1,
>              );
> $w{1}->add(%notes);
> $cui->mainloop();
> 
> This results in the following error:
> 
> Fatal program error:
> ------------------------------------------------------------------------
> Could not load Curses::UI::Notes: from Curses/UI/Notes.pl:
> Can't locate....
> 
> Ultimately I want the %notes hash to live in another hash to give a
> hash of hashes.  Can someone tell me what I'm doing wrong.

Using a hash for the parameters is wrong.  ->add() expects the parameters
"id" and "class" in the first two positions, but the hash may deliver them
later.  It will then interpret some other parameter as a class (for
instance "Notes: "), which results in the error you see.

Replace "%notes" with "@notes" in both places.

Anno


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

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


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