[10522] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4114 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 30 18:07:01 1998

Date: Fri, 30 Oct 98 15:01:00 -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           Fri, 30 Oct 1998     Volume: 8 Number: 4114

Today's topics:
    Re: ANN: "pgrep" = perl grep (Steffen Beyer)
        Cookie help snackeru@my-dejanews.com
    Re: Cookie help (Larry Rosler)
        CPAN problems - aghhhhh (Alan Young)
        filehandle ? - why does this work <alexb@sig.net>
    Re: Forcing perl to garbage collect (Ilya Zakharevich)
    Re: Help with memory in Perl (Ilya Zakharevich)
    Re: HTTP Get not working? <rbridal@bcl.net>
        Need help with OLE <chad@anlon.com>
    Re: Not to start a language war but.. <jorendorff@ixl.com>
    Re: Not to start a language war but.. (Paul Jackson)
    Re: Not to start a language war but.. <jorendorff@ixl.com>
        Ok.  Please Explain This (simple?) Regex. (Danny Groppo)
    Re: Ok.  Please Explain This (simple?) Regex. (Ilya Zakharevich)
        Perl 5.004 install problem on Solaris 2.6 (Stuart Cracraft)
        Problems setting up script on Vservers lux_interior@my-dejanews.com
        Question about example from Mastering Regular Expressio (Danny Groppo)
    Re: Question about example from Mastering Regular Expre (Larry Rosler)
    Re: Question about example from Mastering Regular Expre <dgris@rand.dimensional.com>
    Re: regexp question - re: {n} (Brand Hilton)
        scoping troubles <Ian_Lowe@fanniemae.com>
        Suggest some good books/websites on Perl & databases? <atlee@ou.edu>
    Re: Syntactic flexibility (was: Re: psychology of langu (Ilya Zakharevich)
    Re: Trapping the output of a system call... <rbridal@bcl.net>
        Using system( ) command to copy files <lfs97@tm.net.my>
    Re: Using system( ) command to copy files (Darren Greer)
    Re: Why is perl better than shell scripting language? (Kevin Reid)
    Re: Why is perl better than shell scripting language? (Ben Coleman)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 30 Oct 1998 17:15:19 GMT
From: sb@engelschall.com (Steffen Beyer)
Subject: Re: ANN: "pgrep" = perl grep
Message-Id: <71cs77$hk7$1@en1.engelschall.com>

In comp.lang.perl.misc clay irving <clay@panix.com> wrote:

>>Where is something comparable to The Perl 5 Module List for
>>scripts?

> Perl Reference?
> http://reference.perl.com

Thanks for the hint!

The problem is none of the other tools that have been suggested here in
this thread figure under the category "text tools" (as one would expect)
on that page...

Yours,
-- 
    Steffen Beyer <sb@engelschall.com>
    Free Perl and C Software for Download: www.engelschall.com/u/sb/download/


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

Date: Fri, 30 Oct 1998 22:14:44 GMT
From: snackeru@my-dejanews.com
Subject: Cookie help
Message-Id: <71ddoj$tgp$1@nnrp1.dejanews.com>

Hopefully, someone out there can help me.  I can set a cookie with multiple
values but I don't know how to split those values when printing to a web page.
For example, I call the cookie back by typing $cookie{MyCookie} and it prints
this:

John DoePhysicsJohnson
101MinneapolisMN5545512345678555-5555777-7777jdoe@tc.umn.eduE-mail

Notice there are 11 fields in my HTML form which all write to the one cookie.
The delimeter is \1 and it prints as .  What I'd like to do is print it out
like this:

Name:  John Doe
Department:  Physics ...etc.

Does anyone out there know how I can yank these kind of values out of the
cookie?  Any help would be greatly appreciated.

Shane Nackerud
snackeru@tc.umn.edu

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 30 Oct 1998 14:45:26 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Cookie help
Message-Id: <MPG.10a3e15cf11f18c6989853@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <71ddoj$tgp$1@nnrp1.dejanews.com> on Fri, 30 Oct 1998 
22:14:44 GMT, snackeru@my-dejanews.com <snackeru@my-dejanews.com> 
says...
 ...
> John DoePhysicsJohnson
> 101MinneapolisMN5545512345678555-5555777-7777jdoe@tc.umn.eduE-mail
> 
> Notice there are 11 fields in my HTML form which all write to the one cookie.
> The delimeter is \1 and it prints as 
 ...
> Does anyone out there know how I can yank these kind of values out of the
> cookie?  Any help would be greatly appreciated.

@fields = split /\1/, $line;

`perldoc -f split` for more details.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 30 Oct 1998 20:57:46 GMT
From: alany@2021.com (Alan Young)
Subject: CPAN problems - aghhhhh
Message-Id: <363af211.55484132@news.supernews.com>

Hello.

I've finally managed to get perl and CPAN installed and working on my
shell account at work (HPUX 9.something) and am slowly whittling away
problems here and there.

I've run into a problem I can't seem to get past.

When I try to install anything that has a tar.gz extension I get the
following error message:

CPAN.pm needs either both external programs tar and gzip installed or
both the modules Archive::Tar and Compress::Zlib. Neither prerequisite
is available. Can't continue.

If I install something that has a zip or gz (no tar) extension, it
installs fine.  I've already checked to make sure tar is in my path,
and just for kicks, copied it to my ~/bin dir (which is the first path
after . )

Also, if I try to manually extract and compile I get the following
error message:

LD_RUN_PATH="/usr/local/lib" ld -o
blib/arch/auto/Compress/Zlib/Zlib.sl
 -b -L/usr/local/lib Zlib.o    -lz
collect2: ld returned 1 exit status
/bin/ld: Invalid loader fixup needed
*** Error code 1

When I asked someone who knows, he just said check my path.
RRRRRGGGHHHH.  *What* about my path?!?!  I'm not even sure what to
look for.

Yes ... I'm a relative newbie to both Unix and Perl, but not to
computers or programming.

Alan Young
Technical Support
2021.Interactive, LLC


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

Date: Fri, 30 Oct 1998 16:54:45 -0600
From: Alexander Bibighaus <alexb@sig.net>
Subject: filehandle ? - why does this work
Message-Id: <363A43B5.35643CE3@sig.net>

Below, is some code that confuses me.

I define a package called logger.
In package main I do the following:

logger->open_log("mylog");
logger->log_msg("my message");
logger->close_log();

If I understand things correctly, LOG is a localized variable
within the package logger?  Am I right here?

My question is:
how does function log_msg have access to LOG?

thanks in advance,

alexander

---------------------------
package logger;

sub open_log
{
    my($pkg) = shift;
    my($logfile) = shift;
    
    open(LOG, ">> $logfile")
	|| die "Could not open logfile $logfile $!";

}
sub close_log
{
    my($pkg) = shift;
    close(LOG);
}

sub log_msg
{
    my($pkg) = shift;
    my($msg) = shift;
    my($date) = `date`;
    chomp($date);

    print LOG "$date\t$msg\n";
}


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

Date: 30 Oct 1998 22:38:03 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Forcing perl to garbage collect
Message-Id: <71df4b$o02$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to 
<droby@copyright.com>],
who wrote in article <71cjm8$ktm$1@nnrp1.dejanews.com>:
> No.  There's another copy somewhere.  As noted in the previous message,
> eliminating the `` leaves one copy.

Which is the constant string you have in your modified script.

Hope this helps,
Ilya


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

Date: 30 Oct 1998 22:30:12 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Help with memory in Perl
Message-Id: <71delk$nll$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Rob Clark
<rclark@adc.metrica.co.uk>],
who wrote in article <909742053.12937.0.nnrp-05.c246a7ae@news.demon.co.uk>:
> Hi everyone,
> 
> Sorry if this has been asked before or is in a FAQ.
> 
> I've got a program that runs fine with small inputs but falls over with a
> 135mb core file when run under greater loads. I'm assuming that what we have
> here is a memory leak of some sort.
> 
> I didn't write the code so I'm not in a good position to debug it without
> help. What I'd like to know is whether there is a way I can see how Perl's
> internal usage of memory is going as the program executes and maybe track
> down the part that is causing the problem. Also anything that can flag data
> that is not being reused by the garbage collector for whatever reasons would
> be an enormous help.

  perldoc perldebug

starting from 5.005.

Ilya


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

Date: Fri, 30 Oct 1998 15:26:27 -0600
From: Rob Bridal <rbridal@bcl.net>
Subject: Re: HTTP Get not working?
Message-Id: <363A2F03.15128CC5@bcl.net>

Warren Miller wrote:
> 
> Hiya
> 
> Can anyone help me . I kinda adapted this code to get a webpage off a site
> can anyone tell me why it's not working, thanx
> 
> #!/usr/local/bin/perl
>  use IO::Socket;
> $host="mars.cs.unp.ac.za";
> $document="index.html";
> $remote =  IO::Socket::INET->new(Proto =>"tcp",
>                                 PeerAddr => $host,
>                                 PeerPort => "http(80)",
>                                 );
> 
> $remote->autoflush(1);
> print $remote "GET $document HTTP/1.0\en\en";
> while (<$remote>) {print}
> close $remote;

Try LWP::UserAgent of LibWWW-Perl.  You can get it at CPAN, and it'll
make it much easier...

require LWP::UserAgent;
$ua = new LWP::UserAgent;
$req = new HTTP::Request GET => "http://mars.cs.unp.ac.za/index.html"
$res = $ua->Request($req);

$res->Is_Success() || die "Couldn't Connect";

print $res->Content();


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

Date: Fri, 30 Oct 1998 16:05:00 -0600
From: Chad Moston <chad@anlon.com>
Subject: Need help with OLE
Message-Id: <363A380B.EB52FD7B@anlon.com>

I have searched extensively to find documentation on the web about OLE
and have come up short.  Can anyone send me some URL's of some good
sites to get me started with this?

I appreciate the help.

Chad Moston
Anlon Systems



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

Date: Fri, 30 Oct 1998 15:35:02 -0800
From: Jason Orendorff <jorendorff@ixl.com>
Subject: Re: Not to start a language war but..
Message-Id: <363A4D26.D064009D@ixl.com>

> > These 3 symbols look like they bind tightly - high precedence.
> > So $a[0] looks like it binds "($a)([0])" or in Quine's dot
> > notation, "$a.[0]". But actually they have low precedence, applying
> > to "all the dereferencing" term, as in "$(a[0])", or "$.a[0]".

I think the main problem is in thinking of $@% as operators; they
really aren't.  If they were operators, you could expect to do
things like:

  $x = [3, 4, 5];   # ok
  print @$x;        # also ok
  print @($x);      # bad
  print $(@$x)[2];  # bad
  print $(x);       # bad

Maybe it's a personal bias, but I expect operators to work like
mathematical operators-- they should nest and parenthesize and all
that.  But these symbols are not meant to be mathematical operators.
They're actually more like English punctuation.  They're important
to the meaning, but when you diagram the sentence you don't need to
include them.

At least, that's how I see it...

-- 
jason
print "Just a mediocre Perl hacker\n";


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

Date: 30 Oct 1998 21:56:39 GMT
From: pj@sgi.com (Paul Jackson)
Subject: Re: Not to start a language war but..
Message-Id: <71dcmn$23h6d@fido.engr.sgi.com>

I (pj) had written:
> These 3 symbols look like they bind tightly - high precedence.
> So $a[0] looks like it binds "($a)([0])"
>
> Strange -- very strange.

Darrin Edwards <d-edwards@uchicago.edu> replied:
> Only if one feels that _all_ operators should behave like, say,
> mathematical operators (unary minus, for example).

I wasn't expecting '$' to bind so much like a unary minus, as
like the typical Unix shell '$' -- at least in this context,
of a language that takes so much from that heritage.
-- 

=======================================================================
I won't rest till it's the best ...	   Software Production Engineer
Paul Jackson (pj@sgi.com; pj@usa.net) 3x1373 http://sam.engr.sgi.com/pj


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

Date: Fri, 30 Oct 1998 16:23:28 -0800
From: Jason Orendorff <jorendorff@ixl.com>
Subject: Re: Not to start a language war but..
Message-Id: <363A5880.80E7E6D3@ixl.com>

> What, exactly, do you find objectionable about checking return codes?

Let me preface this by Once Again saying that I don't find anything
objectionable about the way Perl chooses to handle errors.  But I do
object to people claiming Perl supports exceptions.

Exceptions might (arguably) be a better way to handle errors, but for
many tasks, especially simple ones, it just doesn't matter...


> I don't particularly see the advantage of going nuclear to tell me that
> a chdir failed...but if you insist....

*laugh*  Well, I wouldn't exactly classify throwing an exception as
"going nuclear".  Changing directories is typically important to the
surrounding code, and if it fails, I usually like the script to stop.

> chdir('somedirectory') or die("Oops...\n$!");

Exactly!

  sub blah {
      chdir(shift) or die 'system call failed : $!';
      foreach $file (<*>) {
          @stats = stat $file          or die "system call failed: $!";
          open(FILE, $file)            or die "opening file failed: $!";
          seek FILE, ($stats[7]-2), 0  or die "system call failed: $!";
          read FILE, $x, 2             or die "system call failed: $!";
          if ($x eq "\001\002") {
              unlink $file             or die "system call failed: $!";
          }
          close FILE;  #Don't know if this ever reports an error..
      }
  }

Good Perl code **always** checks the return values of system calls.
(See _PP_ p.549 if you don't believe me.)

The corresponding Python for this admittedly inane little routine
would be something like:

  import os

  def blah(dir):
      os.chdir(dir)
      for file in os.listdir('.'):
          stats = os.stat(file)
          f = open(file, 'r')
          f.seek(stats[7]-2)
          x = f.read(2)
          if x == '\001\002':  os.remove(file)
          f.close()

Arguably, there's less to screw up here; you don't check return codes
at all.  But under the hood, the system does it anyway, and
automatically throws exceptions on errors.

So you'll occasionally see Python code to squelch exceptions:

  try:      os.rmdir('tmp')
  except:   pass    # permissions issue, maybe?  never mind the error.


> That wasn't very painful, now was it?

No, not really.  *smile*  I'm happy either way.  I admit that for
larger projects I prefer to have exceptions.

-- 
jason


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

Date: Fri, 30 Oct 1998 21:05:58 GMT
From: gosdpads@yahoo.com (Danny Groppo)
Subject: Ok.  Please Explain This (simple?) Regex.
Message-Id: <363a2638.1396326711@nntp.cts.com>

I having difficulty understanding the differences between these three
code regex code snips.  

1.
$string = "56";
@zips = $string =~ m/(?:\d)\d/g;
for (@zips) { print "$_\n"; }

2.
$string = "56";
@zips = $string =~ m/(?:\d)(\d)/g;
for (@zips) { print "$_\n"; }

3.
$string = "56";
@zips = $string =~ m/(?:\d)*?\d/g;
for (@zips) { print "$_\n"; }


My understanding of the lookahead is that it matches position in a
string similar to the way a word boundary does.  Also, lookaheads do
not consume any of the target string.

When executing the first code, 
56
is printed. Or basically $zips[0] == 56.  This means, that the entire
56 matched.  But shouldn't the lookhead start at the nothingness
before the five, evaluate to true because a digit follow, then,
because the lookahead doesn't consume any of the target string, set
$zips[0] to only 5?

When executing the second snip of code
6
is printed and only 6.  So why does this code get different results
than the first, when it seems I am only using parentheses for
capturing?

Finally, when exectuting the 3 code snippet, 
5
6
is printed, which are the results that I thought I would be getting
with snippet 1.  Why does the non-greedy star work in this situation?


Danny Groppo
gosdpads@yahoo.com


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

Date: 30 Oct 1998 22:42:08 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Ok.  Please Explain This (simple?) Regex.
Message-Id: <71dfc0$o6o$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Danny Groppo
<gosdpads@yahoo.com>],
who wrote in article <363a2638.1396326711@nntp.cts.com>:
> $string = "56";
> @zips = $string =~ m/(?:\d)\d/g;
> for (@zips) { print "$_\n"; }

> My understanding of the lookahead is that

(?:) is not a lookahead.

Hope this helps,
Ilya


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

Date: 30 Oct 1998 22:39:07 GMT
From: cracraft@rice-chex.ai.mit.edu (Stuart Cracraft)
Subject: Perl 5.004 install problem on Solaris 2.6
Message-Id: <71df6b$jpj$1@entertainment-tonight.ai.mit.edu>


Doing a standard Perl 5.004 compile on a Solaris 2.6 Sparc-5,
I got this when doing the make (after the Configure and
make depend):

# make
make: Warning: Both `makefile' and `Makefile' exist
`sh  cflags libperl.a miniperlmain.o`  miniperlmain.c
          CCCMD =  gcc -DPERL_CORE -c  -O   
In file included from perl.h:223,
                 from miniperlmain.c:14:
/usr/local/gnu/sun4m-SunOS-55-1/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/include/sys/param.h:187: warning: `NBBY' redefined
/usr/include/sys/select.h:45: warning: this is the location of the previous definition
In file included from /usr/include/sys/stream.h:26,
                 from /usr/include/netinet/in.h:38,
                 from perl.h:361,
                 from miniperlmain.c:14:
/usr/include/sys/model.h:32: #error "No DATAMODEL_NATIVE specified"
*** Error code 1
make: Fatal error: Command failed for target `miniperlmain.o'

Any ideas about this?

I'm Perlless.

--Stuart


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

Date: Fri, 30 Oct 1998 22:33:18 GMT
From: lux_interior@my-dejanews.com
Subject: Problems setting up script on Vservers
Message-Id: <71dere$veq$1@nnrp1.dejanews.com>

Hi,  I'm having alot of problems trying to set up a perl script on my virtual
server ( vservers.com).

 They are unable/unwilling to offer any support as it is not one of their own
scripts so I'm at a loss as to where to go for help.

Has anybody else had trouble getting a script on this server?

The script I'm trying to put up is one I found on the net and it allows a
visitor to your website to select a postcard and have it mailed to someone. I
think the problem is in the way I've changed the settings to point to my
specific area. If someone has put a similar script on Vservers that uses the
sendmail program I'd really appreciate some ideas.

Thanks very much

Lux_interior.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 30 Oct 1998 21:40:50 GMT
From: gosdpads@yahoo.com (Danny Groppo)
Subject: Question about example from Mastering Regular Expressions Book.
Message-Id: <363a2ebf.1398509780@nntp.cts.com>

I have the August 1998 printing of Mastering Regular Expressions by
Jeffrey Friedl.

On page 230, first paragraph.

"For example, (?!000)\d\d\d means 'so long as they're no 000, match
three digits,'"

So when I run the code:

$string = "000";
if($string =~ m/(?!000)\d\d\d/) {
  print "True\n";
} else {
  print "False\n";
} 

I naturally get "False."

But if I change the negative lookahead to positive lookhead:

$string = "000";
if($string =~ m/(?:000)\d\d\d/) {
  print "True\n";
} else {
  print "False\n";
} 

I still get "False."
But, using the example text from the book shouldn't 
(?:000)\d\d\d means "so long as they're 000, match three digits" and
therefore print "True?"

Again, if say the code was

$string = "5";
if($string =~ m/(?:\d)\d/) {
  print "True\n";
} else {
  print "False\n";
} 

Shouldn't it print "True" since (?:\d)\d should mean "so long as it is
a digit, match a digit?"


Danny Groppo
gosdpads@yahoo.com


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

Date: Fri, 30 Oct 1998 13:51:32 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Question about example from Mastering Regular Expressions Book.
Message-Id: <MPG.10a3d4c271bb50ea989852@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <363a2ebf.1398509780@nntp.cts.com> on Fri, 30 Oct 1998 
21:40:50 GMT, Danny Groppo <gosdpads@yahoo.com> says...
 ...
> But if I change the negative lookahead to positive lookhead:
> 
> $string = "000";
> if($string =~ m/(?:000)\d\d\d/) {

Positive lookahead is (?=...).  What you are using is "don't capture".

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 30 Oct 1998 15:05:24 -700
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: Re: Question about example from Mastering Regular Expressions Book.
Message-Id: <m3g1c5puxn.fsf@rand.dimensional.com>

gosdpads@yahoo.com (Danny Groppo) writes:

> But if I change the negative lookahead to positive lookhead:

> if($string =~ m/(?:000)\d\d\d/) {

That's not positive lookahead, that's non-capturing parens.
Positive lookahead is spelled (?=pattern).

man perlre

dgris
-- 
Daniel Grisinger              dgris@rand.dimensional.com
Supporter of grumpiness where grumpiness is due on clpm.
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: 30 Oct 1998 21:43:45 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: regexp question - re: {n}
Message-Id: <71dbuh$9qv13@mercury.adc.com>

In article <3639EFFC.6595B164@visarc.com>,
Jack de Valpine  <jedev@visarc.com> wrote:
>
>4
>    red green blue fname
>
>I would like to be able to use regexps to find these parameter sets. I
>have discovered a few ways to do this. It seems that the following
>should work, but it does not. I expect that this has something to do
>with how backreferences my be interpreted. What am I missing?
>
>/^(\d+)\s+((\S+\s+){\1})/gom
>
>ie - find a number at the beginning of the line, then find what follows
>that many times again

There's no way I know of to do this in one regex.  You'll have to do
it in a loop, something like this:

  $foo =~ /^(\d+)\s+/gm;
  foreach (1..$1) {
    $foo =~ /(\S+\s+)/gm;
    print $1;
  }

Even doing it in two statements, like this:

  $foo =~ /^(\d+)\s+/gm;
  $foo =~ /(\S+\s+){$1}/;

ends up setting $1 to "blue, and leaving $2, $3, and $4 unset.

BTW, are you sure you want those "\s+" in there?  If you do that, 
the trailing whitespace will be captured in $1.

HTH

-- 
 _____ 
|///  |   Brand Hilton  bhilton@adc.com
|  ADC|   ADC Telecommunications, ATM Transport Division
|_____|   Richardson, Texas


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

Date: Fri, 30 Oct 1998 13:33:01 -0500
From: Ian Lowe <Ian_Lowe@fanniemae.com>
Subject: scoping troubles
Message-Id: <363A065D.BA7EF7CB@fanniemae.com>

I am fairly new to perl, and am having difficulty with the issue of
scoping, for some reason.  The following code returns the error
messages:

Global symbol "crit" requires explicit package name at ./dfrev.pl line
36.
Global symbol "warn" requires explicit package name at ./dfrev.pl line
38.


I don't understand this.  I have predeclared the hashes.  Could someone
offer me some insight into the problem?

TIA.

Ian


    1  #!/export/Tivoli/efmperl/bin/perl -w
     2
     3  use strict;
     4  use Sys::Hostname;
     5
     6  my $host = hostname();
     7  my $class = "FILESYSTEM_FULL";
     8  my $date = localtime;
     9  my (%size,%capacity,%owner,%warn,%crit);
    10  my ($fs,$cmd);
    11
    12  ($cmd = $0) =~ s/^.*\///;
    13  my $efm = "/export/Tivoli/efmbin/efmlog";
    14  die "$cmd:  File not found or executable:  $efm\n" unless -x
$efm;
    15
    16
    17  open(CONFIG,"/export/Tivoli/efmbin/dfconfig") || die "can't open
file:  $!";
    18      while (<CONFIG>) {
    19          my ($fs,$owner,$warn,$crit) = (split(/\s+/));
    20          $owner{$fs} = $owner;
    21          $warn{$fs} = $warn;
    22          $crit{$fs} = $crit;
    23      }
    24
    25
    26  open(DF,"/usr/ucb/df -Fufs | grep -v Filesystem|") || die
"command failed: $!";
    27      while (<DF>) {
    28          chomp;
    29          my ($capacity,$fs) = (split(/\s+/))[4,5];
    30          $capacity =~ s/%$//;
    31          $capacity{$fs} = $capacity;
    32      }
    33
    34  for $fs (keys (%capacity)) {
    35      if ($capacity{$fs} > $crit{$fs}) {
    36         system("$efm CRITICAL $class $host $owner{$fs}
\"Filesystem $fs is over $crit% ($capacity{$fs}%)\"");
    37          }  elsif ($capacity{$fs} > $warn{$fs}) {
    38             system("$efm WARNING $class $host $host \"Filesystem
$fs is over $warn% ($capacity{$fs}%)\"");
    39      }
    40      last;
    41  }



*******************************************************
Ian A. Lowe		email:  Ian_Lowe@fanniemae.com
Systems Administrator   voice:  (202) 343-3914		     
*******************************************************


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

Date: Fri, 30 Oct 1998 15:41:31 -0600
From: "Atlee Parks" <atlee@ou.edu>
Subject: Suggest some good books/websites on Perl & databases?
Message-Id: <vuq_1.10$a37.1473709@ounews.ou.edu>

I'm writing a series of CGI scripts to set up and take online polls from our
website.  I've gotten most of it to work fine so far, but I'm using a simple
text database to store user input.  I work for a fairly large newspaper, and
we expect an enthusiastic user response; I concluded that the text database
file would become unmageable, contacted our ISP, and am now looking into
miniSQL (which I'm assuming is the same thing, more or less, as mSQL and
MySQL).  I'm getting a handle on Perl, but I know next to nothing about
databases or Perl's interaction with them.  I did try going to CPAN and
looking at the various DBD and DBI modules' readmes, which did nothing to
clarify things.  Can anyone suggest some good books/FAQs/websites on
Perl/database interaction for a relatively new Perl user?  I'd really
appreciate it....

Thanks,
Atlee Parks
The Clarion-Ledger Online
http://www.clarionledger.com




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

Date: 30 Oct 1998 22:26:14 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Syntactic flexibility (was: Re: psychology of language choice (was Re: language war ...))
Message-Id: <71dee6$nea$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Lyn A Headley 
<laheadle@boguscs.uchicago.edu>],
who wrote in article <wr33e86oah7.fsf@yeenoghu.cs.uchicago.edu>:
> maybe I'm missing something, but...
> 
>   DB<1> sub hello {
> Missing right bracket at (eval 6) line 4, at end of line
> syntax error at (eval 6) line 4, at EOF

Now: Perl cannot multipy numbers!

    perl -le 'multiply 7 by 11'

    Number found where operator expected at -e line 1, near "multiply 7"
	    (Do you need to predeclare multiply?)
    syntax error at -e line 1, near "multiply 7"
    Bareword found where operator expected at -e line 1, near "7 by"
	    (Missing operator before by?)
    Number found where operator expected at -e line 1, near "by 11"
	    (Do you need to predeclare by?)
    Execution of -e aborted due to compilation errors.
    Exit 2

No, one cannot use a language which cannot do even this...

Ilya


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

Date: Fri, 30 Oct 1998 15:18:46 -0600
From: Rob Bridal <rbridal@bcl.net>
Subject: Re: Trapping the output of a system call...
Message-Id: <363A2D36.3C6D05EA@bcl.net>

Earl Westerlund wrote:
> 
> Rob Bridal wrote:
> >
> > Hello,
> >
> > i know I should already know this, but I can't find it anywhere.  I
> > checked the PerlDocs and searched the newsgroup.  I need a way to trap
> > the output of a system call, such as a whois.  I know system() and
> > exec() won't work for trapping it.
> >
> > Thank you in advance,
> > Rob Bridal
> 
> Check out backticks.

sorry, saw the backwards quotes (`) right after I posted.  Guess I
shoulda looked a bit closer =)

Thanks,
Rob Bridal


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

Date: 31 Oct 1998 02:03:39 +0800
From: "Liew Fook Sin" <lfs97@tm.net.my>
Subject: Using system( ) command to copy files
Message-Id: <01be45ee$89823f20$LocalHost@tm.net.my>

Hai,
The task I wish to perform is to get Perl to copy files from one
location/directories to another.
I have tried using the command system( ) . The command I issued was

#! /usr/bin/perl
$path = "/home/lfs/public_html"
$filename = "somefilename";
system( cp $path/$filename  /home/httpd/doc/$distinationfilename);
exit;

Somehow it just didn't work. It seems to have a multiple of errors reproted

Can someone please suggest to me how can this be done.

Thank you very much.

>From : Liew


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

Date: Fri, 30 Oct 1998 22:51:55 GMT
From: drgreer@qtiworld.com (Darren Greer)
Subject: Re: Using system( ) command to copy files
Message-Id: <363a4294.267331231@news.qgraph.com>

Well I rewrote your code and this seems to work:

#!/usr/bin/perl
$path = '/home/lfs/public_html';
$filename = 'somefilename';
system("cp $path/$filename  /home/httpd/doc/$distinationfilename");
exit;

Darren


On 31 Oct 1998 02:03:39 +0800, "Liew Fook Sin" <lfs97@tm.net.my>
wrote:

>Hai,
>The task I wish to perform is to get Perl to copy files from one
>location/directories to another.
>I have tried using the command system( ) . The command I issued was
>
>#! /usr/bin/perl
>$path = "/home/lfs/public_html"
>$filename = "somefilename";
>system( cp $path/$filename  /home/httpd/doc/$distinationfilename);
>exit;
>
>Somehow it just didn't work. It seems to have a multiple of errors reproted
>
>Can someone please suggest to me how can this be done.
>
>Thank you very much.
>
>From : Liew



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

Date: Fri, 30 Oct 1998 16:32:30 -0500
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Why is perl better than shell scripting language?
Message-Id: <1dhopkr.lso6jv15248vzN@slip166-72-108-190.ny.us.ibm.net>

John Porter <jdporter@min.net> wrote:

> > IMHO, any language that requires special attention
> > to spaces in source code is bad.
> 
> Heh, then let me tell you about another language that starts with P.

What language?

-- 
  Kevin Reid.      |         Macintosh.
   "I'm me."       |      Think different.


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

Date: Fri, 30 Oct 1998 22:03:26 GMT
From: tnguru@termnetinc.com (Ben Coleman)
Subject: Re: Why is perl better than shell scripting language?
Message-Id: <363a379b.162706299@news.mindspring.com>

On Fri, 30 Oct 1998 16:32:30 -0500, kpreid@ibm.net (Kevin Reid) wrote:

>John Porter <jdporter@min.net> wrote:
>
>> Heh, then let me tell you about another language that starts with P.
>
>What language?

Promal?

Ben
-- 
Ben Coleman
Senior Systems Analyst
TermNet Merchant Services, Inc.
Atlanta, GA


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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 4114
**************************************

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