Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Using alarm

Received: by 10.180.87.100 with SMTP id w4mr1693641wiz.3.1351481389175;
        Sun, 28 Oct 2012 20:29:49 -0700 (PDT)
Newsgroups: perl.beginners
Path: q13ni92372wii.0!nntp.google.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.131.MISMATCH!xlned.com!feeder3.xlned.com!news.astraweb.com!border5.a.newsrouter.astraweb.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news.nobody.at!goblin3!goblin.stu.neva.ru!nntp.develooper.com!nntp.perl.org
Return-Path: <knowsuperunkn...@gmail.com>
Mailing-List: contact beginners-h...@perl.org; run by ezmlm
Delivered-To: mailing list beginn...@perl.org
Received: (qmail 4475 invoked from network); 26 Oct 2012 14:47:58 -0000
Received: from x1.develooper.com (207.171.7.70)
  by x6.develooper.com with SMTP; 26 Oct 2012 14:47:58 -0000
Received: (qmail 9187 invoked by uid 225); 26 Oct 2012 14:47:58 -0000
Delivered-To: beginn...@perl.org
Received: (qmail 9182 invoked by alias); 26 Oct 2012 14:47:57 -0000
X-Spam-Status: No, hits=-2.7 required=8.0
	tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS
X-Spam-Check-By: la.mx.develooper.com
Received: from mail-lb0-f169.google.com (HELO mail-lb0-f169.google.com) (209.85.217.169)
    by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Fri, 26 Oct 2012 07:47:53 -0700
Received: by mail-lb0-f169.google.com with SMTP id k6so2172245lbo.14
        for <beginn...@perl.org>; Fri, 26 Oct 2012 07:47:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :content-type;
        bh=UdJlzL6NcuMcb8SiXuAcVs4ygSHSovLOySDoNsVGBT8=;
        b=AhBprOeMRD+tAYVQVRhY4PXAvix+eJoDsYpmHpf91l7bKz6D/UOErw5HLVeM0EF9wh
         A3MJOwXC+1+y7c1U6d/WMMo8Gh6bDMXJMAyje1YdQ3C7e6mR/pFJr+D3tH5sbTNjvqSE
         te6eN4ao2h56Pqkt3EjJU2+MHCbCrNEaPSzLGYqeR1n7Aw0180S9sMNMCnzXbgf2RJ8T
         bv4O0M3U4gw6FgLzNtfzYICQvRQwD7AosImh0MjfyBW4XysG/9HntrTr049ASzogmgkc
         jEjh+mIqmVBWU3U6zkXbdR7I1EaH0a5fitCI4A5xK+7jQAn1hpZ181kJLM8ZB1/bUQWq
         ElDg==
MIME-Version: 1.0
Received: by 10.152.47.148 with SMTP id d20mr20579601lan.42.1351262868980;
 Fri, 26 Oct 2012 07:47:48 -0700 (PDT)
Received: by 10.114.61.13 with HTTP; Fri, 26 Oct 2012 07:47:48 -0700 (PDT)
In-Reply-To: <CAHMBrL8vV-b3iKk-VeGVXEPswZLYuxm4dByKy8_7nr1aARh...@mail.gmail.com>
References: <CAHMBrL8vV-b3iKk-VeGVXEPswZLYuxm4dByKy8_7nr1aARh...@mail.gmail.com>
Date: Fri, 26 Oct 2012 20:17:48 +0530
Message-ID: <CAHMBrL8xZzRAW+jPLPtrSS3zmvoudrY445fpGZCW4_pc0BL...@mail.gmail.com>
Subject: Re: Using alarm
To: beginners <beginn...@perl.org>
Approved: n...@nntp.perl.org
From: knowsuperunkn...@gmail.com (Unknown User)
Bytes: 3224
Lines: 28
Content-Type: text/plain; charset=ISO-8859-1

On Fri, Oct 26, 2012 at 8:16 PM, Unknown User
<knowsuperunkn...@gmail.com> wrote:
> I have code that goes something like this:
>
>
> my $start = time();
> my $delay = 60;
> ...
>
> while (my $line = <$fh>) {
> my $err;
> ...
> ...
>         my $timenow = time();
>         if ( $timenow - $start >= $delay )  {
>                 $start = $t;
err, that would be:
                   $start = $timenow;
>                 dumpstats($err);
>                 $err = {};
>         }
> }
> ...
>
> I wonder if it would be possible to replace this loop with a handler
> based on alarm.
> If it is possible, which would be more efficient?
>
> Thanks