| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
| List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
| 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" <gp AT familiehaase DOT de> |
| X-Mailer: | The Bat! (v1.53d) |
| Reply-To: | "Gerrit P. Haase" <cygwin AT cygwin DOT com> |
| Organization: | Esse keine toten Tiere |
| X-Priority: | 3 (Normal) |
| Message-ID: | <149643146185.20011028004211@familiehaase.de> |
| To: | Goksun Ilhan <goksun_ilhan AT yahoo DOT com> |
| 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 |
| 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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |