[8602] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2219 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 31 19:07:35 1998

Date: Tue, 31 Mar 98 16:00:35 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 31 Mar 1998     Volume: 8 Number: 2219

Today's topics:
        $SIG{INT} problems under NT... (Privacy First)
        ANNOUNCE: DateTime.pm v1.4 <gdfast@usgs.gov>
        Announce: IO-stringy 1.110 uploaded to CPAN <eryq@zeegee.com>
        ANNOUNCE: Lingua::EN::Inflect 1.02 (Damian Conway)
        ANNOUNCE: Math::MagicSquare 1.20 module <pivari@geocities.com>
        ANNOUNCE: PDFprint 2.0: to print PDF files <pivari@geocities.com>
        ANNOUNCE: Text::FillIn.pm (new) (Ken Williams)
        Creating Images in Perl <mindmore@mindless.com>
    Re: Creating Images in Perl (A. Deckers)
        file permissions <wentzel@umr.edu>
    Re: help needed with grep type function for perl script <dboorstein@shopcfn.com>
    Re: help needed with grep type function for perl script <cmargoli@world.northgrum.com>
        Help with small program <brian.charles@orst.edu>
    Re: How to generate a Cartesian product of a varying nu <scribble@pobox.com>
    Re: HTML::Parse Won't pull data out of tables <aas@sn.no>
        Is there a perl compiler yet? nospamno_garrett@autodataservices.com
    Re: mktime function inPerl <barnett@houston.Geco-Prakla.slb.com>
    Re: mktime function inPerl (Jonathan Stowe)
        Need process times for all processes in a group <Brett.W.Denner@lmco.com>
    Re: Need process times for all processes in a group <Brett.W.Denner@lmco.com>
    Re: need regexp help (Bart Lateur)
        newbie for NT perl, 501 error <orangutan@grungyape.com>
    Re: Perl BNF/Perl parser <bruce@cenderis.demon.co.uk>
    Re: Perl BNF/Perl parser (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
    Re: readdir/grep/map (Mike Stok)
    Re: The "Y2k-bugs-are-not-just-a-legacy-problem" FAQ <robf@geeks.com>
    Re: The "Y2k-bugs-are-not-just-a-legacy-problem" FAQ <robf@geeks.com>
    Re: The "Y2k-bugs-are-not-just-a-legacy-problem" FAQ (not an  MVP!)
    Re: User Interface Question (Jonathan Stowe)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 31 Mar 1998 22:11:43 GMT
From: private_party@hotmail.com (Privacy First)
Subject: $SIG{INT} problems under NT...
Message-Id: <3521680b.1634386132@news.seanet.com>

The below code catches the first instance of a ctrl-c interrupt, that
much is clear.

$SIG{INT} = \&catch_sig_int;
$| = 1;


while(1)
{
   print "Performing work.\n";
   sleep 1;
}

sub catch_sig_int
{   
   print "Closing down all files, performing complete cleanup.";
}

However, it exits immediately after performing the sub(s) work.

How do I continue to catch the interrupt so that my process does not
exit until completed? I have accomplished this using a recursive sub
call, but it is messy and unreliable (and must restart itself). There
must be an easier way. Using labels also fails.

Any help is very appreciated.

Privacy First!
'Hell no I don't use a spell checker. How else will I ever figure out
what I am doing rong?'


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

Date: 31 Mar 1998 23:37:49 GMT
From: The Mad Fishmonger <gdfast@usgs.gov>
Subject: ANNOUNCE: DateTime.pm v1.4
Message-Id: <6fruod$5es$1@news1.teleport.com>

Announcing DateTime.pm, v1.4

  I'd like to announce the public release for comment of DateTime.pm,
  a module for the representation and manipulation of (almost) arbitrary
  locations in time.  This module was developed for in-house use (for
  indexing the time-series axis in graphs of historical water data), and
  we've found it to be rather useful so we'd like to get feedback from
  others on it.  I'm tossing this out mostly for comment, feel free
  to ignore it.

  DateTime.pm is not intended to be a replacement for any of the
  existing Date:: or Time:: modules, but you may find it useful as a
  suplement.  Notable features:

  * Date is represented internally by a ordered non-unix-epoch
    identifier, so that dates as far back as the Beginning of Time
    (well, functionally the start of the Gregorian calendar) can be
    stored.

  * Functions are provided for doing date/time calculations.
    Increment and decrement, as well as round, floor and ceil
    functions by unit (second through year) are provided, as well as
    simple date-difference operations.

  * Functions are provided for input from and output to user-specified
    formats (dprintf and dscanf).
  

Module available at:

  http://www-il.usgs.gov/~gdfast/dist/DateTime-1.4.tar.gz

Some documentation is viewable at:

  http://www-il.usgs.gov/~gdfast/DateTime.html



    Frequently asked questions:

What?  Another date module?

  Yes.  The others didn't do what we needed.

Like what?

  Like the ability to index 15-minute time-series data from 1870 to the
  present, and the ability to read and print dates + times in arbitrary
  formats (well, that last's not really true, see Date::Parse and
  Date::Format.  I am a pathological liar, trust me in all things).

  Honestly, we had a set of requirements here which the existing date
  and time modules met clumsily.  You may find this useful, or you may
  hate it.  I'm curious to know either way.

Does it have any bugs or evil glitches?

  No.  Next question.  Well, ok, it's not year 10000 compliant, it
  doesn't handle time zones or the changeover to the Gregorian calendar, 
  and dates before AD 1 are not stable.  There's probably more.

And why is a top-level module?  Shouldn't it be at least
Date::DateTime?

  Oh, so you think that DateTime isn't a unique name?  Bah.  
  (Actually, it's high on the list of things-to-do.  But we've been
  using it as DateTime for a long time here, and we're basically lazy.)


-- 
Greg Fast




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

Date: 31 Mar 1998 23:31:20 GMT
From: Eryq <eryq@zeegee.com>
Subject: Announce: IO-stringy 1.110 uploaded to CPAN
Message-Id: <6fruc8$533$1@news1.teleport.com>

The latest version of IO-stringy has been uploaded to the
CPAN. It provides the following Perl modules... (* = new!)

  IO::
* ::Lines        bdpO  I/O handle to read/write to array of lines   ERYQ
  ::Scalar       RdpO  I/O handle to read/write to a string         ERYQ
  ::ScalarArray  RdpO  I/O handle to read/write to array of scalars ERYQ
  ::Wrap         RdpO  Wrap old-style FHs in IO::-like interface    ERYQ
* ::WrapTie      adpO  Tie your handles & retain full OO interface  ERYQ

The most interesting development has been IO::WrapTie, which can be
used with IO::Scalar, IO::ScalarArray, and the (new) IO::Lines.
It allows tiehandle-ready classes to provide instances which
look and feel almost exactly like real IO::Handles, even if such
classes don't use file descriptors at all.  That is, you can (under
5.004+) inherit your FooHandle class from IO::WrapTie::Mixin and say...

	my $foo = FooHandle->new_tie("bar", "baz");
	print $foo "this", "that";
	$foo->print("the other\n"); 
	
I would *very* much welcome comments on IO::WrapTie; future distributions
may have it seamlessly used by IO::Scalar and friends.

Numerous other suggested improvements/additions have been made.
Full distribution also on-line at:

        http://www.zeegee.com/code/perl/IO-stringy

Documentation online, at:

        http://www.zeegee.com/code/perl/IO-stringy/docs/IO/Scalar.pm.html

Enjoy!

-- 
  ___  _ _ _   _  ___ _   Eryq (eryq@zeegee.com)
 / _ \| '_| | | |/ _ ' /  President, Zero G Inc: http://www.zeegee.com/
|  __/| | | |_| | |_| |   
 \___||_|  \__, |\__, |___/\  Visit STREETWISE, Chicago's newspaper by/
           |___/    |______/ of the homeless: http://www.streetwise.org




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

Date: 31 Mar 1998 23:35:55 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Lingua::EN::Inflect 1.02
Message-Id: <6frukr$5d7$1@news1.teleport.com>
Keywords: perl, module, release

==============================================================================
                Release of version 1.02 of Lingua::EN::Inflect
==============================================================================

AVAILABILITY

Lingua::EN::Inflect has been uploaded to the CPAN
and is also available from:

	http://www.csse.monash.edu.au/~damian/CPAN/Lingua-EN-Inflect-1.02.tar.gz

==============================================================================

Apologies all round
(This is the *last* time I release software before breakfast!)

Damian
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 name: Damian Conway                           addr: School of Computer Science
email: damian@csse.monash.edu.au                        and Software Engineering
  web: http://www.cs.monash.edu.au/~damian           Monash University
  fax: +61-3-9905-5146                               Clayton 3168, AUSTRALIA




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

Date: 31 Mar 1998 23:32:20 GMT
From: Fabrizio Pivari <pivari@geocities.com>
Subject: ANNOUNCE: Math::MagicSquare 1.20 module
Message-Id: <6frue4$55q$1@news1.teleport.com>

What is Math::MagicSquare module?
The first purpose of this PERL module is to help you to check your
Square, to answer these questions
Is it a Semimagic Square?
Is it a Magic Square?

The second purpose of this PERL module is to help you to print your
Square.
At the moment the available methods are 'print' that prints the square
on
STDOUT and printhtml that prints the square in HTML format.
I'd like to add
- pringif     (to print the square in a GIF image)
- prinpdf   (to print the square in PDF format)

What is a Magic Square?
Do you like Magic Square?
Do you want to know more information about Magic Square?
Try to visit

A very good introduction on Magic Square
http://www.astro.virginia.edu/~eww6n/math/MagicSquare.html

A whole collection of links and documents in Internet
http://www.pse.che.tohoku.ac.jp/~msuzuki/MagicSquare.html

A good collection of strange Magic Square
http://www.geocities.com/CapeCanaveral/Lab/3469/examples.html

The only Magic Square checker and gif maker in Internet (I think)
http://www.geocities.com/CapeCanaveral/Lab/3469/squaremaker.html

What's new with version 1.20
Added printhtml method

Where can I find it?
http://www.geocities.com/CapeCanaveral/Lab/3469/Math-MagicSquare.html
is the primary location
You also can find it at CPAN archive

Enjoy it!

Send me your suggestions.




--
Fabrizio Pivari
mailto:pivari@geocities.com
http://www.geocities.com/CapeCanaveral/Lab/3469/
Member of ANFACE Software
http://www.geocities.com/CapeCanaveral/Hangar/4794/






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

Date: 31 Mar 1998 23:34:56 GMT
From: Fabrizio Pivari <pivari@geocities.com>
Subject: ANNOUNCE: PDFprint 2.0: to print PDF files
Message-Id: <6fruj0$5bq$1@news1.teleport.com>

Hi,

I'm glad to announce the version 2.0 of PDFprint.
PDFprint is a very flexible tool to print PDF files from different
directories and recursively from every subdirectories (in the
future, form FTP and HTTP sites) to a printer or to the monitor,
in PostScript format or in text format.
At the moment, if you want to print a PDF file you need a tool
that converts it in PostScript format (level 3 PostScript
printers will accept PDF format directly). Usually, the tool is a
reader, so you have to visualize the PDF file, then the
tool converts it in a PostScript file and sends the PostScript file
to the printer.
How can you print the first page of all your PDF files in your archive?
How can you read the first page of all your PDF files in your archive?
With PDFprint you can solve these problems

What's new with version 2.0
Added recursive option
Added support for pdftops and pdftotext included in xpdf tool
Remade documentation

This is the URL where you can find the tool
http://www.geocities.com/CapeCanaveral/Lab/3469


--
Fabrizio Pivari
mailto:pivari@geocities.com
http://www.geocities.com/CapeCanaveral/Lab/3469/
Member of ANFACE Software
http://www.geocities.com/CapeCanaveral/Hangar/4794/






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

Date: 31 Mar 1998 23:34:27 GMT
From: ken@forum.swarthmore.edu (Ken Williams)
Subject: ANNOUNCE: Text::FillIn.pm (new)
Message-Id: <6frui3$5ag$1@news1.teleport.com>

Hi,

I've just uploaded a new module, Text::FillIn.pm version 0.01, to CPAN. 
It is a class for implementing fill-in text templates.  It is designed to
be flexible and sub-classible.  It can handle tags inside other tags.

SYNOPSIS

   use Text::FillIn;

   $template = new Text::FillIn('some text with [[$vars]] and [[&routines]]');
   $filled_in = $template->interpret();  # Returns filled-in template

   $template->interpret_and_print();  # Prints template to currently 
                                      # selected filehandle, streaming output

   # Set parsing options:
   $Text::FillIn::HOOK{'$'} = sub { return ${$_[0]} };  # Hard reference
   $Text::FillIn::HOOK{'&'} = "main::run_function";     # Symbolic reference
   sub run_function { return &{$_[0]} }

   # Nested templates
   $template = new Text::FillIn();
   $template->set_text('the text is [[ $[[$var1]][[$var2]] ]]');
   $var1 = 'two_';
   $var2 = 'parter';
   $two_parter = 'interpreted';
   $template->interpret_and_print();  # Prints "the text is interpreted"


   $template = new Text::FillIn();
   $template->get_file('/etc/template_dir/my_template');  # Fetches a file


   $template = new Text::FillIn();
   @Text::FillIn::TEMPLATE_PATH = 
      ('.', '/etc/template_dir');  # Where to find templates
   $template->get_file('my_template'); # Gets ./my_template or 
                                       # /etc/template_dir/my_template


For more specific information, please see the documentation inside
FillIn.pm, by doing "pod2txt FillIn.pm", or "perldoc Text::FillIn" once
you've installed the module.

> 
>   file: $CPAN/authors/id/KWILLIAMS/Text-FillIn-0.01.tar.gz
>   size: 11921 bytes
>    md5: fcd15d853783f34959fb8a89e068f5d7




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

Date: Tue, 31 Mar 1998 11:30:04 +0300
From: Fain <mindmore@mindless.com>
Subject: Creating Images in Perl
Message-Id: <3520A98C.41CA5C18@mindless.com>

I would like to know if there is a way to create a image in Perl.
Actaully... what I want to do is create a Text Image (meaning the image
is just text). Is this possable... if so could you help me ob`n my way
to learning how (source code, good tutorials, faq's)?

thanks
- Nathan
mindmore@mindless.com



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

Date: 31 Mar 1998 23:50:38 GMT
From: Alain.Deckers@man.ac.uk (A. Deckers)
Subject: Re: Creating Images in Perl
Message-Id: <slrn6i30ae.4vv.Alain.Deckers@bashful.rediris.es>

In <3520A98C.41CA5C18@mindless.com>,
	Fain <mindmore@mindless.com> wrote:
>I would like to know if there is a way to create a image in Perl.

Yes, there is the GD module. Have a look on CPAN (URL in my signature) in
the modules/by-module subdirectory.

Dunno about creating ASCII images/art.

Alain
-- 
Perl reference: <URL:http://reference.perl.com/>
 Perl language: <URL:http://language.perl.com/>
  Perl archive: <URL:http://www.perl.com/CPAN/>
      Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>


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

Date: 31 Mar 98 21:53:43 GMT
From: Michael Wentzel <wentzel@umr.edu>
Subject: file permissions
Message-Id: <352165e7.0@news.cc.umr.edu>

I have a script that is being run with a POST method from a HTML document 
that will create a directory, on server side, if it does not exist then 
will create a file in this directory(this is to allow files that should 
be grouped together to reside in the same directory).  The problem is 
that the newly created directory has a owner id of 32766 and not the 
owner of the directory above, therefore when it tries to create a file in 
the newly create dir the script fails.  Any suggestions... The only thing 
I can think of is using 'exec "chown <user> <directory name>";'.


Michael Wentzel
wentzel@umr.edu


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

Date: Tue, 31 Mar 1998 17:07:54 -0500
From: Dan Boorstein <dboorstein@shopcfn.com>
Subject: Re: help needed with grep type function for perl script.
Message-Id: <3521693A.48B390B@shopcfn.com>

just another $wanna{$be} perl hacker wrote:
> 
> On Mon, 30 Mar 1998 21:18:59 -0800, Larry Rosler <lr@hpl.hp.com>
> wrote:
> 
> >> >:   if (/$ip_to_find/) {
> >
> >> >or better yet, use /\Q$ip_to_find\E/, so '128a0b0c2' won't be matched.
> >
> >Or best of all, use
> >
> >    if ($_ eq $ip_to_find) {
> >
> >which is what this comes down to!
> >
> >Larry Rosler
> 
> I cannot find the meanings for the \Q and \E in the blue camel book.
> hint please.

it is kind of hard to find if you don't know what it does. try page 67,
and look at the 'quotemeta' function. \Q allows for 'quotemeta'
functionality in interpolated strings. \E just tells it where to stop
acting like 'quotemeta'.

hope this helps,

-- 
# dan boorstein <dboorstein@shopcfn.com>
seek DATA,0,0;print scalar<DATA>,__END__
Just another Perl hacker,


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

Date: Tue, 31 Mar 1998 21:49:05 GMT
From: Charles Margolin <cmargoli@world.northgrum.com>
Subject: Re: help needed with grep type function for perl script.
Message-Id: <352164D1.3477@world.northgrum.com>

just another $wanna{$be} perl hacker wrote:
> I cannot find the meanings for the \Q and \E in the blue camel book.
> hint please.

Try a recent version of the perlre man page, which says...

    \E          end case modification (think vi)
    \Q          quote (disable) regexp metacharacters till \E

-- 
Charles G. Margolin                   DSSD Internal Information Services
cmargoli@world.northgrum.com          Northrop Grumman Corp. 0624/23
margolin@acm.org                      Hawthorne, California 90250-3277


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

Date: Tue, 31 Mar 1998 14:05:12 -0800
From: Brian Charles <brian.charles@orst.edu>
Subject: Help with small program
Message-Id: <35216897.857DECAA@orst.edu>

Hi,
    I have the following small program, but it doesn't work. What do you
think. It doesn't alphabetize and it only returns two strings.
The input file is simple a string of data separated by a '|'
I want to be able to return just a portion of it alphabetized by name.

#!/usr/bin/perl

require "CGI.pm";
######################################################################
print <<"html";
Content-type: text/html
html
######################################################################

open DB,"HT.TXT" or die "Cannot open myfile: $!";

while(<DB>) {
chomp; #remove newline
($type, $org, $district, $resp, $t1, $t2, $name, $address, $city,
$b1,$b2,$b3,$p
hone,$n1,$n2,$n3,$country) = split /\|/; #splits the string to arrays
$hash{$type} = {name => $name, t1 => $t1, t2 => $t2};
        }

for $type ( sort by_name keys %hash ) {
  print "$hash{$type}{name} $hash{$type}{t1} $hash{$type}{t2}<br>\n ";

}

sub by_name {
        $hash{$a}{name} cmp $hash{$b}{name}

}



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

Date: 31 Mar 1998 16:44:42 -0600
From: Tushar Samant <scribble@pobox.com>
Subject: Re: How to generate a Cartesian product of a varying number of sets?
Message-Id: <6frrkq$338@tekka.wwa.com>

Don't think of it as "multiple nested loops". You can take
a product of two sets, and then repeat. Here's some simple-
minded functions, which pass around array refs.


  sub product_of_two {
    my($set1, $set2) = @_;

    my @product = ();

    for my $i (@{$set1}) {
      for my $j (@{$set2}) {
        push @product, "$i $j";
      }
    }
    \@product;
  }

  sub product {
    my($cross, @sets) = @_;

    for my $s (@sets) {
      $cross = product_of_two($cross, $s);
    }
    $cross;
  }


  @l1 = qw(A B C);
  @l2 = qw(X Y Z);
  @l3 = qw(1 2 3);       

  print map "$_\n", @{product(\@l1, \@l2, \@l3)};


You will probably want to change the representations, and
look at efficiency and so on...



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

Date: 31 Mar 1998 23:38:18 +0200
From: Gisle Aas <aas@sn.no>
Subject: Re: HTML::Parse Won't pull data out of tables
Message-Id: <m3g1jyr16d.fsf@furu.g.aas.no>

Jon Drukman <jsd@hudsucker.gamespot.com> writes:

> my $p = myParser->new;
> 
> undef $/
> $p->parse(<>);
> 
> 
> note that due to a bug (or design limitation) in HTML::Parser
> regarding <>, it will only parse the first file handed to it on the
> command line.

Yes, HTML::Parser->parse() only cares about its first argument.  One
reason might be that subclasses are then free to use the subsequent
arguments for their own pupose if they wish.

You could always write:

   $p->parse(join("", <>));

if you want that.  It is probably runs faster if you write it as:

   while (<>) { $p->parse($_) }

-- 
Gisle Aas


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

Date: Tue, 31 Mar 1998 09:52:57 GMT
From: nospamno_garrett@autodataservices.com
Subject: Is there a perl compiler yet?
Message-Id: <3520bcc3.12497490@nntp.cts.com>

I am running Free BSD 2.x and am wodering if there is a stable perl
compilier yet?

Garrett
adms1@cts.com


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

Date: Tue, 31 Mar 1998 15:39:57 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: mktime function inPerl
Message-Id: <352162AD.5A6E3AEE@houston.Geco-Prakla.slb.com>

Mohan Hegde wrote:
> 
> Hi
> 
> Perl does not seem to have an equivalent of mktime in UNIX. I have day,
> date, month, year and time in hours and minutes and I have to convert it to
> time in seconds since epoch. How do I do this in Perl ?
> 
Have a look at Time::Local module.

You feed it sec, min, hrs, etc., it gives you sec since epoch.

Enjoy.

> Thanks
> Mohan

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

----------------------------------------------------------------------
Dave Barnett                 U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng    U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------


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

Date: Tue, 31 Mar 1998 23:54:07 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: mktime function inPerl
Message-Id: <35217b39.104466635@news.btinternet.com>

On Tue, 31 Mar 1998 11:27:17 -0800, "Mohan Hegde" <mohanh@neelum.com>
wrote:

>Hi
>
>Perl does not seem to have an equivalent of mktime in UNIX. I have day,
>date, month, year and time in hours and minutes and I have to convert it to
>time in seconds since epoch. How do I do this in Perl ?
>

The str2time() function in the Date::Parse module will take a date
string in a variety of formats and return a "unix time value".

/J\
Jonathan Stowe
See the MetaFaq at http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm


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

Date: Tue, 31 Mar 1998 16:15:41 -0600
From: Brett Denner <Brett.W.Denner@lmco.com>
Subject: Need process times for all processes in a group
Message-Id: <35216B0D.BBC650C5@lmco.com>

I'm using a Perl script to run a large executable on a Cray via
the NQS queuing system.  The job is only allowed to run for a
predetermined length of time before the queue manager (NQS)
kills the job for running out of CPU time.  I've written a
little monitoring subroutine that I fork to keep track of the
total CPU time for every job in the process group, but for some
jobs, the monitor subroutine doesn't work.  

Here's the guts of the code:

$max_time = 3600;                              # time limit
$monitor_pid = watch_cpu_time();               # fork monitoring process
start_running_main_executable();               # start executable to monitor
kill 'TERM', $monitor_id if $monitor_id >= 0;  # kill monitoring process

sub watch_cpu_time
{
    return $child_id if ($child_id = fork);
    $pgrp = getpgrp;

    while (1)
        {
        chomp(my @times = `ps -g$pgrp -o time=`);
        last if $?;
        $time = < snip code to add up total cpu time from @times >;  
        kill_main_executable(), exit if $time > $max_time;
        }

    exit;
}

I've simplified the code to emphasize the important bits.
The problem is that for certain jobs, the `ps -g$pgrp -o time=` 
produces the desired output, and for others, it returns nothing,
the $? is set to -1, and $! contains the text 'Too many open files'.

Can anyone help me with this problem?  Perhaps there is a better
way to get the total CPU time used by every process with a certain
group id, than what I'm trying here?

Thanks,

Brett

-- 
 Brett W. Denner                                Lockheed Martin TAS
 Brett.W.Denner@lmco.com                        P.O. Box 748            
 (817) 935-1144 (voice)                         Fort Worth, TX 76101
 (817) 935-1212 (fax)                           MZ 9333


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

Date: Tue, 31 Mar 1998 16:18:59 -0600
From: Brett Denner <Brett.W.Denner@lmco.com>
Subject: Re: Need process times for all processes in a group
Message-Id: <35216BD3.AA6A28F7@lmco.com>

Brett Denner wrote:

> I've simplified the code to emphasize the important bits.
> The problem is that for certain jobs, the `ps -g$pgrp -o time=`
> produces the desired output, and for others, it returns nothing,
> the $? is set to -1, and $! contains the text 'Too many open files'.

I neglected to mention that $! also occasionally reads 'not enough space'.

-- 
 Brett W. Denner                                Lockheed Martin TAS
 Brett.W.Denner@lmco.com                        P.O. Box 748            
 (817) 935-1144 (voice)                         Fort Worth, TX 76101
 (817) 935-1212 (fax)                           MZ 9333


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

Date: Tue, 31 Mar 1998 21:21:34 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: need regexp help
Message-Id: <3521570b.1589254@news.tornado.be>

david smith wrote:

>I see why {split "."} is equivalent to {split /./}, but explain to me why {split
>"\."} is the same.  Why isn't {split "\."} equivalent to {split /\./}?

No. Just try this (maybe just in your mind):

	print "\.";

What will you get? Just a dot. So { split "\." } is idential to 
{ split "." } thus also as {split /./ }.

You need either single quotes or double the backslash, so you'll end up
with exactly one backslash in your pattern string.

	Bart.


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

Date: Tue, 31 Mar 1998 09:21:14 -0500
From: "Franklin L. Petersen" <orangutan@grungyape.com>
Subject: newbie for NT perl, 501 error
Message-Id: <6fqu3b$93k$1@cletus.bright.net>

I just installed Perl 5.003(?) for NT 4.0 Server with IIS 3.0 and Front Page
98

I set the path, I made the file association, I set executable rights to the
cgi-bin directory in both FP and NT/IIS

I adjusted my html form paths to /cgi-bin/form.pl

but all I get are 501 errors, method not supported.  I am not 100% sure what
I did wrong.

I have tried to read all the FAQs before posting, but I am not getting
answers, can anyone help?

Thanks,
Frank

orangutan@grungyape.com




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

Date: 31 Mar 1998 22:17:17 +0100
From: Bruce Stephens <bruce@cenderis.demon.co.uk>
Subject: Re: Perl BNF/Perl parser
Message-Id: <m3afa6r25e.fsf@cenderis.demon.co.uk>

John Porter <jdporter@min.net> writes:

> I think what we need is a mode for the perl executable (indicated by
> a commandline switch) which makes it do "front-end"ish things... for
> example, write the parse tree to a file.

Yeah, I think that would be cool.  It would probably miss things (like
things created on the fly by eval), but it could still be useful for
some things.


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

Date: Wed, 01 Apr 1998 00:35:04 +0200
From: lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
Subject: Re: Perl BNF/Perl parser
Message-Id: <lassehp-0104980035050001@ygdrasil.imv.aau.dk>

In article <8c3efyyfsp.fsf@gadget.cscaper.com>, Randal Schwartz
<merlyn@stonehenge.com> wrote:
>            time /3 ;#/; print "hello";
>            sin /3 ;#/; print "goodbye";

Cool example! Obvious, when you think about it. (The prototype for time
doesn't expect any arguments, whereas sin does. Right?)

>There's no pure BNF in the world that'll handle that.

Are there (m)any languages that have a _pure_ BNF? Algol60 maybe?

I think it is an interesting property of Perl that it only has one
implementation, which is authoritative. At one point in time, I think
Eiffel may have been similar, but with several companies producing Eiffel
compilers, the ISE compiler is no longer special. Of course, Eiffel relies
heavily on formal definitions of the language. A more interesting Perl
project than writing a BNF for it would be to write a formal semantic
definition, I suppose! :-)

I have though about the advantages and disadvantages from having only a
single implementation, and I think it is actually a good thing. In the
past the world has seen various C implementations for example, that were
incompatible in many ways (and GCC is still a superset of both ANSI C and
C++, right?) so having a language that is the same everywhere is
wonderful. It will probably never become an international standard under
ISO (how would the specification be written, except as a transscript of
the source code?) but then that matters little. Having an ANSI and ISO
standard for C hasn't helped much in preventing problems, if I'm not
mistaken.

I can think of two slight disadvantages with Perl and perl.

One is that Perl is almost excessively expressive (TIMTOWTDI), but then,
that can also be considered an advantage, depending on how you view it.
(The vices of Perl are its virtues and vice versa.) Certainly the
verbosity and vocabular of Perl seems a lot more useful than COBOL.

The other is that perl currently doesn't produce really standalone
programs. (Or am I mistaken here?) Given the ubiquity of Perl that's not a
big problem, but I imagine Perl could be an ideal language for
microcontrollers. Having a Linux machine under the kitchen table to
control the coffee machine seems a bit extreme.

So given that the perfect (not just the best) implementation of Perl is
perl, what could we use a BNF for Perl for? I can't think of much, except
maybe an editor.

But how about some strict subsets of Perl? (With or without pure BNF
grammars.) How about a subset that could be useful for teaching Perl to
beginners, or a subset that would be useful for embedded realtime
applications? Subsets that would be correct Perl programs, but due to the
simpler language, perhaps easier to process, both for novices and
machines. Is this a silly idea? I could imagine the positive benefits it
would have for example, if all ISP's who provide for users to write CGI
script, had installed a Perl-subset, where it would be difficult to do bad
things, and where -w and use strict were mandatory.

>  And remember,
>with "use" and prototypes available, whether you parse something like
>"sin" or "time" depends on its definition in some other file,
>somewhere in the galaxy (or even decided by Perl code in a BEGIN
>block, that evals a prototype!).

So, eh, it is possible to have executable comments? :-)

This is unrelated to BNF, but while I was fudging with the above example,
I tried to use a reference (to find out what happens to the prototype):
$func = \&sin;
print &$func(3.14159265359/2);
It seems perl expects sin to be main::sin, and gets confused when it can't
find it. So is it possible to create a reference to a built-in function,
and if yes, how? I couldn't find anything on this in perldoc (but it could
be an oversight on my behalf.) Trying to specify CORE::sin instead didn't
help. Overriding sin with a real sub that calls CORE::sin helped, but
that's not what I wanted.

-Lasse


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

Date: 31 Mar 1998 22:16:47 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: readdir/grep/map
Message-Id: <6frq0f$15a@news-central.tiac.net>

In article <35215A57.6F5992E1@coam.usm.edu>,
Peter Sakalaukus  <sakalauk@coam.usm.edu> wrote:
>Using the readdir examples in the "Camel Book", I've tried to
>read in the contents of a directory (skipping . .. and the file
>region.area) and then map the pwd directory onto each array element.
>
>I can only seem to either skip the unwanted files OR map the pwd
>but not both. I'm sure it can be done, but I'll be darned if I
>know.
>
>Insight anyone? Please.  :)

What does your failing code look like.  Assuming DH is an opened dirhandle
and $pwd contains a path you want to prepend then does this untested code
fragnment help?

  @list = map {"$pwd/$_"} grep {not /^\.\.?$/} readdir DH;

In general if I think the data set might be large then I try and avoid grep
and map e.g.

  # something like this untested code:

  @list = ();
  while (defined ($_ = readdir DH)) {
    next if /^\.\.?$/;
    push @list, "$pwd/$_";
  }

which may take a few more lines, but on my system:

[mike@stok tmp]$ cat try.pl
#!/usr/local/bin/perl -w

$pwd = 'x';
@src = (0 .. 250_000);
@l = map {"$pwd/$_"} grep {not /^\.\.?$/} @src;
[mike@stok tmp]$ cat try2.pl
#!/usr/local/bin/perl -w

$pwd = 'x';
@src = (0 .. 250_000);
@l = ();
for (@src) {
  next if /^\.\.?$/;
  push @l, "$pwd/$_";
}
[mike@stok tmp]$ time ./try.pl
Name "main::l" used only once: possible typo at ./try.pl line 5.
15.16user 1.67system 1:01.05elapsed 27%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (6954major+16810minor)pagefaults 3875swaps
[mike@stok tmp]$ time ./try2.pl
10.04user 0.50system 0:11.27elapsed 93%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (301major+8670minor)pagefaults 0swaps

 
Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Tue, 31 Mar 1998 15:49:09 -0600
From: Rob Fugina <robf@geeks.com>
To: Theran Cochran <theranc@geocities.com>
Subject: Re: The "Y2k-bugs-are-not-just-a-legacy-problem" FAQ
Message-Id: <352164D5.C99EBB63@geeks.com>

Theran Cochran wrote:
> There are 136.192 years in a 32 bit field though (hence the year 2036
> bug in most Unix programs, or is that year 2106? I can't remember), and
> 584,942,417,355.1 years in a 64 bit field. Or about 100,000 times as
> long as multicellular life has existed on earth, plus a month to
> recompile all your programs to 128 bit date fields.

Unix (in general) use a SIGNED 32-bit integer, so maximum positive value
is roughly 2^31 seconds, or roughly 68 years.  The meaning of the time
value is seconds since the beginning of 1970, which puts the end of the
epoch somewhere in 2038.

Rob

--
Rob Fugina, robf@geeks.com
Unix Systems Administrator/Consultant


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

Date: Tue, 31 Mar 1998 15:54:27 -0600
From: Rob Fugina <robf@geeks.com>
To: Theran Cochran <theranc@geocities.com>
Subject: Re: The "Y2k-bugs-are-not-just-a-legacy-problem" FAQ
Message-Id: <35216613.B7AF67FF@geeks.com>

Theran Cochran wrote:
> There are 136.192 years in a 32 bit field though (hence the year 2036
> bug in most Unix programs, or is that year 2106? I can't remember), and
> 584,942,417,355.1 years in a 64 bit field. Or about 100,000 times as
> long as multicellular life has existed on earth, plus a month to
> recompile all your programs to 128 bit date fields.

Unix (in general) use a SIGNED 32-bit integer, so maximum positive value
is roughly 2^31 seconds, or roughly 68 years.  The meaning of the time
value is seconds since the beginning of 1970, which puts the end of the
epoch somewhere in 2038.

Rob

-- 
Rob Fugina, robf@geeks.com
Unix Systems Administrator/Consultant


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

Date: Wed, 1 Apr 1998 01:14:17 +0200
From: "Ton (not an  MVP!)" <nieuws@getwet.net>
Subject: Re: The "Y2k-bugs-are-not-just-a-legacy-problem" FAQ
Message-Id: <OFORhqPX9GA.154@uppssnewspub05.moswest.msn.net>

Jij MOET voor de telegraaf (gaan) werken met je paniek verhaaltjes. Waarom
maak je het niet echt duidelij kvoor de mensen, lees het verhaaltje
hieronder nog maar eens over die machine die pas over 99 jaar weer onderhoud
wil!

Ik word zo moe van dit soort sensatie zucht, zit je om werk verlegen of zo?

Ton

Zooko Journeyman heeft geschreven in bericht <6fmool$e0j$1@xs2.xs4all.nl>...
>[Greetings, Usenetters.  This is an article i've just hacked up
>that i intend to send to reporters and publications when i read
>that the year 2000 bug is caused by legacy programs.  I argue
>that a "sizeable fraction" of y2k bugs were written in the
>1990's, and i attempt to start a trend of calling them "y2k
>bugs" instead of "The Y2k Bug" since there are many of them and
>they come in many different flavors and they must be fixed
>individually.  All flames, compliments, comments, criticisms,
>questions and answers are welcome at "zooko@xs4all.nl".  --Z]
>
>
>
>Dear Sir or Madam:
>
>
>I am writing you in reference to a recent article of yours
>which propagated a common misperception about year 2000 bugs.
>
>
>I am a professional software engineer, and my motivation in
>writing this correction is solely to help inform the public
>about this very important issue.  Permission is granted to
>reproduce, distribute, and use this article in any way.
>
>
>It is often stated (even by knowledgeable engineers, analysts,
>and reporters) that year 2000 bugs are caused by programs
>written in the 1960's, 1970's and 1980's.  This misperception
>is dangerous, as it encourages people who depend only on modern
>programs to think that they are not at risk.  In fact, year
>2000 bugs abound in programs from all eras, including programs
>written during the 1990's.
>
>
>Examples:
>
>JavaScript, JScript, Netscape Navigator, Netscape Communicator,
>and Microsoft Internet Explorer suffer from y2k bugs
>themselves, and they also make it complicated for a programmer
>to write y2k-safe code using those systems:
>
>http://www.infoworld.com/cgi-bin/displayArchives.pl?97-t04-27.1.htm
>http://www.zdnet.com/intweek/printhigh/31698/cs1316.html
>
>
>American Megatrends was shipping its widely used PC BIOS
>software with year 2000 bugs until as late as July 1995 (or
>even later?  The web pages don't precisely state.):
>
>http://www.amibios.com/support/2000.html
>
>
>Award was shipping _its_ widely used PC BIOS software with year
>2000 bugs until as late as November 1996:
>
>http://www.award.com/tech/biosfaqs.htm#yr2000
>
>
>(I bought a brand new PC in June of 1997 and its BIOS had a
>year 2000 bug.)
>
>
>A y2k bug was discovered in a BeOS application (BeOS was first
>made public in the second half of the 1990's):
>
>http://ww2.altavista.digital.com/cgi-bin/news?msg@4@comp%2esys%2ebe%2eannou
nce
>
>
>The popular AltaVista search engine uses 2-digit year fields to
>constrain the dates of your search.  If there are any scripts
>out there which use AltaVista to e.g. find all articles on a
>certain topic posted during the last week, those scripts will
>break during the first week of the year 2000.
>
>http://www.altavista.digital.com/cgi-bin/query?pg=aq
>
>
>
>These are only a few examples.  Almost certainly there are
>millions of year 2000 bugs that remain undiagnosed or
>unreported, and by my estimate a sizable fraction of them were
>written during the 1990's (since the majority of code currently
>in use today was written during the 1990's).
>
>
>
>You may well ask "Why the heck would someone writing code in
>the 1990's create a year 2000 bug?".  There are 3 reasons:
>
>
>1.  Legacy data, legacy interfaces.  Often new programs are
>written, and the first task of these new programs is to read in
>the data from the old programs that they are replacing.  This
>means that the new programs usually use the same data formats.
>Also new programs are sometimes required to interoperate with
>old programs, which means that they often use the same data
>formats.
>
>
>2.  It's just a bug, like all bugs.  All bugs appear stupid
>once they are identified, but when you are actually
>constructing a complex system, many a bug will be generated out
>of misunderstandings or mistakes.  Year 2000 issues are not
>nearly as simple as the media tends to indicate.
>
>
>For example, let's say that you are writing a program in 1997
>in a modern programming language such as JavaScript or Perl.
>You invoke the standard routine to return the current year.  It
>returns "97".  Now you want to use this information for your
>own calculations, and export the information for the benefit of
>the user of your program.  What should you do?  Leave it as
>2 digits?  Prepend the string "19" to the year?  Add the number
>1900 to the year?  Do a check to see if the year is less than
>50, and then add the number 1900 to it if it is greater than 50
>and add the number 2000 to it in that case?
>
>
>The answer varies depending on which language you are using,
>which _version_ of the language (in the case of JavaScript),
>and what the users of your program expect to see.
>
>
>3.  And perhaps most important: human/computer interface.
>Humans routinely use two digits to indicate a year.  Think back
>to the last time you wrote a date onto a paper document or
>typed a date into a computer.  More than likely, you wrote
>"98".  When other humans read that number, they will use
>context to determine whether you meant 1898, 1998, 2098, or 98.
>
>
>But computers are very bad at using context to make such
>distinctions.  All software has to interact with humans at some
>points, and almost all software which uses dates allows the
>humans to enter 2-digit dates.  It then has to infer somehow
>whether that date belongs in the 20th century or the 21st (or
>the 19th or others).  This decision is still a problem for
>programs written in 1998 as it was for programs written in
>1968.
>
>
>
>
>I hope that this letter has been informative to you.  I am
>making a habit of sending this letter via e-mail to each
>publication or reporter who unwittingly propagates the "Y2k is
>a legacy problem" myth.  Feel free to contact me for more
>information.
>
>
>Regards,
>
>Zooko, Journeyman Engineer
>
>-------
>mailto: zooko@xs4all.nl
>http://www.xs4all.nl/~zooko/public.html
>




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

Date: Tue, 31 Mar 1998 23:54:04 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: User Interface Question
Message-Id: <35216f8d.101539517@news.btinternet.com>

On Tue, 31 Mar 1998 08:01:25 EST, twtmjctn@superlink.net (Kevin
Murphy) wrote:

>I am considering going to perl for Win95, 
Uh huh.
>I have been using big perl 4.036 i think, to manipulate ascii files..
perl -v should allay any doubts you have in this matter.
>Do i still have to use a dos prompt to run my existing scripts if I go
>to W95 ?  Is there a better way to do this in W95 ?  Like using the
>send to feature in windows explorer ?
>
Firstly you should get yourself perl 5 for win32.

In the "Standard" distribution (and I would advocate the standard
distribution unless you really *must* have ISAPI and <ahem> PerlScript
[shouldnt that be PScript ;-}]) there is a script called pl2bat that
will embed your perl script into a .BAT file that can be run from the
command line by itself.

If your script takes a single filename argument you can put a link to
it on the desktop and drag files onto it or alternatively you can
place a link to the BAT file as described above in the "Send To"
directory (which will be in your windows directory if no user profiles
are enabled or in the users profile directory if they are).

It is however my personal experiemce that the windows 95 command
interpreter is totally shagged up in respect of I/O redirection.
Infact it is so totally crap as to be virtually unusable for useful
work.  I dont know about anyone else but most shortish text handling
hacks that i write use redirection.  A good solution (short of the
infinitely preferable reformatting of the hard disk and installation
of Linux) is to get hold of the Cygnus Win32 ports of the GNU
utilities from your favourite online archive.  The port of the bash
shell works pretty much as a unix user would expect, #!/bin/perl lines
work as does redirection. You Know It Makes Sense. 

/J\


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 2219
**************************************

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