Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Sun, 28 Oct 2001 00:42:11 +0200 From: "Gerrit P. Haase" X-Mailer: The Bat! (v1.53d) Reply-To: "Gerrit P. Haase" Organization: Esse keine toten Tiere X-Priority: 3 (Normal) Message-ID: <149643146185.20011028004211@familiehaase.de> To: Goksun Ilhan CC: cygwin AT cygwin DOT com Subject: Re: Perl database problem In-Reply-To: <20011026225958.19008.qmail@web10804.mail.yahoo.com> References: <20011026225958 DOT 19008 DOT qmail AT web10804 DOT mail DOT yahoo DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Hops: 1 X-Sender: 320081107336-0001 AT t-dialin DOT net Hallo Goksun, Am 2001-10-27 um 00:59 schriebst du: > I am trying to run a Perl program in cygwin. When I > create the database using dbmopen command, it looks > like it's working (it's only creating .pag file, not > .dir file). However, when I try to read something from > the database, it cannot open the file. I run the > program on a UNIX machine and it works. Is there way > to run that program using cygwin? #!/usr/bin/perl -w # recipe 14.1 from the 'Perl Cookbook' use DB_File; $db = '/tmp/userstats.db'; # use tie or dbmopen, as you like it, # both works for me (on cygwin!) # tie(%db, 'DB_File', $db) # or die "Cannot open DB_File $db: $!\n"; dbmopen (%db, $db, 0666) or die "Cannot open DB_File $db: $!\n"; if (@ARGV) { if ("@ARGV" eq "ALL") { @ARGV = sort keys %db; } foreach $user (@ARGV) { print "$user\t$db{$user}\n"; } } else { @who = `who`; # execute who(1) if ($?) { die "Cannot execute who(1): $?\n"; } # extract usernames and update foreach $line (@who) { $line =~ /^(\S+)/; die "error in who(1) output: $line\n" unless $1; $db{$1}++; } } # untie %db; dbmclose %db; # Ciao, # Gerrit P. Haase mailto:gp AT familiehaase DOT de -- =^..^= -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/