develooper Front page | perl.perl5.porters | Postings from November 1999

perl 5.005_03 hangs while flock-ing?

From:
Alex Farber
Date:
November 19, 1999 11:17
Subject:
perl 5.005_03 hangs while flock-ing?
Message ID:
38359F72.7305F6A1@kawo2.rwth-aachen.de
Dear porters,

hopefully I am not doing some very stupid mistake at the end of a hard
working week, but the following script hangs (probably while trying to 
flock) when I run it on the command line on my Debian Linux (unstable):

    #!/usr/bin/perl -w

    use strict;
    use POSIX;
    use Fcntl ':flock';

    my $FILE = '/home/alex/data.txt';
    my $url = $ENV{HTTP_REFERER} || '???';
    my %hash;

    open  FILE, "+<$FILE" or die "Не могу открыть $FILE: $!\n";
    flock FILE,  LOCK_EX  or die "Не могу поиметь $FILE: $!\n";

    seek  FILE, 0, SEEK_SET;

    while (<FILE>)
    {
        $hash{$1} = $2 if /^(\S+) (\d+)$/;
    }

    seek  FILE, 0, SEEK_SET;

    $hash{$url}++;

    for (keys %hash)
    {
        printf FILE "%s %i\n", $_, $hash{$_};
    }

    close FILE;

I am using the following Debian packages

ii  perl-5.005      5.005.03-4     Larry Wall's Practical Extracting and Report
ii  perl-5.005-base 5.005.03-4     The Pathologically Eclectic Rubbish Lister

And the perl -V gives:

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=linux, osvers=2.0.36, archname=i386-linux
    uname='linux perv 2.0.36 #2 wed nov 18 03:00:48 pst 1998 i686 unknown '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=2.95.1 19990809 (prerelease)
    cppflags='-Dbool=char -DHAS_BOOL -D_REENTRANT -DDEBIAN -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -D_REENTRANT -DDEBIAN -I/usr/local/include'
    stdchar='char', d_stdstdio=undef, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Built under linux
  Compiled at Sep 22 1999 00:22:21
  @INC:
    /usr/lib/perl5/5.005/i386-linux
    /usr/lib/perl5/5.005
    /usr/local/lib/site_perl/i386-linux
    /usr/local/lib/site_perl
    /usr/lib/perl5
    .

I will be glad to provide more information
Regards
Alex

PS: My disk is not full.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About