[13333] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 743 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 8 17:07:33 1999

Date: Wed, 8 Sep 1999 14:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 8 Sep 1999     Volume: 9 Number: 743

Today's topics:
        <== Getting the Database Column Names with DBD::ODBC == <khowe@performance-net.com>
    Re: advise please with input buffering and flock proble <peter@tienderen.demon.nl>
    Re: Array of array. <doveNOdbSPAM@stanfordalumni.org>
        Can't load 7.3 db with 8.1 sqlldr (Jamie Schrumpf)
    Re: CGI scripts that dont return headers <flavell@mail.cern.ch>
    Re: Help - Porting code from UNIX to NT <gellyfish@gellyfish.com>
        How to install modules? <curtisbeard@my-deja.com>
    Re: How to install modules? <doveNOyrSPAM@stanfordalumni.org>
    Re: How to install modules? <mike@crusaders.no>
    Re: LWP failure, Recursive inheritance in Socket.pm, Pe <gellyfish@gellyfish.com>
    Re: LWP: How do I retrieve a page that requires login + <gellyfish@gellyfish.com>
        Need help with some pattern matching... <Care227@ibm.net>
    Re: Newbie ?: @ARGV not getting command line arguments <sariq@texas.net>
    Re: Newbie ?: @ARGV not getting command line arguments <Bryan.Ley@McHugh.com>
    Re: Old Script Doesn't Like My New Perl? Help! (Bart Lateur)
        Omnimark vs. Perl <burton@REMOVETHIS.lucent.com>
    Re: Password Protection? <bigsleep@dircon.co.uk>
        perl.exe hanging on NT balesn@my-deja.com
    Re: Please help a newbe jp_48504@my-deja.com
    Re: race condition in forking server (keywords: waitpid (Alan Curry)
    Re: running perl script on local apache server (Abigail)
        shopping cart <customk9@home.com>
    Re: STL difference - VC vs BCB <jrfclan@hotmail.com>
    Re: Tries to download script when running missymanning@my-deja.com
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Wed, 8 Sep 1999 15:12:41 -0300
From: "Kevin Howe" <khowe@performance-net.com>
Subject: <== Getting the Database Column Names with DBD::ODBC ==>
Message-Id: <rxyB3.127443$5r2.189064@tor-nn1.netcom.ca>

I am trying to get the column names of a datasheet in my database using
DBD::ODBC. In the docs, it says:

   SQLColumns
        Support for this function has been added in version 0.17,
        however, it couldn't be tested properly using the ODBC
        drivers I have. Neither (Oracle or Access) supported this. I
        can tell you that it fails properly, though <G>

In other words, the function doesnt work. Does anyone know an alternate
method which will list the column names? I tried the following:

while ($row = $cursor->fetchrow_hashref) {
@keys = keys %$row;
}

but this only works if there is data in each column of the database record.

Much appreciated,
Kevin







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

Date: Wed, 8 Sep 1999 22:14:28 +0200
From: "Peter van Tienderen" <peter@tienderen.demon.nl>
Subject: Re: advise please with input buffering and flock problem
Message-Id: <936821375.7703.0.pluto.d4ee06f0@news.demon.nl>

You are right. Ok here is the chunk of code. Goal is to prevent multiple
posts of the same message. It does not seem to work all of the time though.
I checked the obvious things (other messages in between the identical posts,
and small alterations in the message). Thanks for the help.
Peter

 $dubfile = $pbbs."dub";
 open(DUB, "+<$dubfile") || die "Content-type: text/plain\n\n Could not open
$dubfile\n";
 flock(DUB,2)  ||  die "Content-type: text/plain\n\n Could not lock
$dubfile\n";
 $oldmessage = <DUB>;
 $newmessage = $FORM{'afzender'}.$FORM{'inhoud'};
 if ($oldmessage eq $newmessage) {
  close DUB;
 &notpublished;  # and exit
 };
 seek(DUB, 0, 0);
 truncate(DUB, 0);
 print DUB $newmessage;
 close DUB;
# and continue with adding the message..

> Then why not repost with a complete example that demonstrates the
> problem, so that others can examine it.
>
> You think that 'open' for reading primes a buffer.  I don't think it
> does.  So I can't (yet) explain your problem.



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




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

Date: Wed, 08 Sep 1999 13:10:30 -0700
From: dove <doveNOdbSPAM@stanfordalumni.org>
Subject: Re: Array of array.
Message-Id: <1c88e830.7cc3640c@usw-ex0107-049.remarq.com>

Hi Jay,

You can print the value of the referenced array by 
dereferencing it as follows:

<PRE>
for (my $i = 0; $i <= 2; $i++){
   print "Loop Counter: $i\n";
   print "Address: $d[$i]\n";
   print "Value of 0th element : ${$d[$i]}[0]\n"; 
} 
</PRE>

So here's a little more complex example:

<PRE>
my @d=();
my @test =("element0", "element1", "element2");

my $i =0;

#Populate the Array of Arrays

for (my $i = 0; $i <=2; $i++) {
  foreach $element (@test) {
  
    push @{$d[$i]}, $element;
  }
  $i++;
}

# Print Each Array

for (my $i = 0; $i <= 2; $i++) {
   print "ARRAY: $i\n";
   foreach $element (@{$d[$i]}) {
      print "$element\n";
   }
}
</PRE>
 
This will create three identical anonymous arrays that are 
copies of @test, and store their addresses in the @d array.  
Then it traverses the @d array and prints out each element 
in the anonymous arrays.

Hope this helps.

-=dav


In article <37D6A64A.EFAC740@austin.ibm.com>, Jay Chaudhury 
<jc@austin.ibm.com> wrote:
>so how do you access the values in the array? you are 
printing the array
>address.
>
>thanks.
>


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: 8 Sep 1999 20:50:42 GMT
From: hatterasNOSPAM@hotbot.com (Jamie Schrumpf)
Subject: Can't load 7.3 db with 8.1 sqlldr
Message-Id: <7r6i72$mtm$1@holly.prod.itd.earthlink.net>

Whenever I try to load my 7.3 db with the 8.1 sqlldr, I get an "unable to 
locate  handle for character set (0)" error (or words to that effect).  If I 
use the very same, unaltered script with the 8.1 db and 8.1 sqlldr, it works 
fine; ditto if I use the 7.3 sqlldr with the 7.3 db.

Both dbs use the same nls_language, nls_territory, and nls_characterset values.  
One anomaly I have noticed is that sqlldr thinks that "sid" is a keyword.  I 
have several tables that use "sid" as an acronym for "system identification."  
I also cannot find any documentation in the 8.1 reference CD that says "sid" 
_is_ a keyword -- it's not in the official list of keywords!

Could these issues be related?
-- 
-------------------------------------------------------------------------------
Jamie Schrumpf                             http://home.earthlink.net/~moncominc




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

Date: Wed, 8 Sep 1999 21:03:23 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: CGI scripts that dont return headers
Message-Id: <Pine.HPP.3.95a.990908204433.13373A-100000@hpplus01.cern.ch>

On Wed, 8 Sep 1999, Pabs (Pablo Liska) wrote:

> I have a script that takes votes from a website and records them on a
> flatfile.  I don't want to send anything back to the browser because i
> dont want the page the user is on to reload. 

As you've already been told, this is what status 204 is for.
But be aware that users tend to disbelieve that the submission has
been successful, if they don't receive some positive indication, so
it's quite likely they would hit the submit button several times in
quick succession before deciding that it isn't working and giving up.

> I wouldnt mind sending back
> the totals on votes, but i dont want to have to reload the entire
> page.

On the WWW you don't really have this option.  Either you send them new
content or you don't.  The HTTP protocol doesn't really have provision
for sending them some "out of band" content, intended to be displayed
somehow separately from the present window contents.

If you _do_ send them new content, then in a limited range of browsing
situations you might be able to persuade the new content to appear in a
different window (be aware that many users dislike this, especially if
they aren't expecting it). You would do that by returning the
non-standard "Window-target:"  HTTP header, with a window name chosen
according to the usual rules.  But this then restricts the range of
browsing situations that can use it.

You really should be on the c.i.w.authoring.cgi group for this kind of
question, it isn't a Perl language issue.




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

Date: 8 Sep 1999 21:19:01 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help - Porting code from UNIX to NT
Message-Id: <7r6js5$5om$1@gellyfish.btinternet.com>

In comp.lang.perl.misc Allan Hagan <allan.hagan@bt.com> wrote:
> Oops! sorry my news server is giving me warnings - please ignore my first
> message - brain not quite in gear after lunch.
> 

Its probably giving you warnings about posting to a non-existent group.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Wed, 08 Sep 1999 19:58:26 GMT
From: Jack Slade <curtisbeard@my-deja.com>
Subject: How to install modules?
Message-Id: <7r6f4p$22$1@nnrp1.deja.com>

How do you install a module?
I have the Time:HiRes module and want to know how to install it?

I ran the makefile.pl and nothing much seemed to happen.
I am new to perl, so any advice is helpfull.


Thanks


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 08 Sep 1999 13:28:12 -0700
From: dove <doveNOyrSPAM@stanfordalumni.org>
Subject: Re: How to install modules?
Message-Id: <06949404.81614bb9@usw-ex0107-049.remarq.com>

Hi Jack,

Installing a module is pretty simple.  Here's the quick and 
dirty solution from "The Perl Cookbook" by Tom Christiansen 
and Nathan Torkington.

<PRE>
% gunzip Some-Module-4.54.tar.gz
% tar xf Some-Module-4.54.tar
% cd Some-Module-4.54
% perl Makefile.PL
% make
% make test
% make install
</PRE>

My guess is that you just ran perl Makefile.PL and didn't 
run the make and make install.

Hope this helps,
-=dav



In article <7r6f4p$22$1@nnrp1.deja.com>, Jack Slade 
<curtisbeard@my-deja.com> wrote:
>How do you install a module?
>I have the Time:HiRes module and want to know how to 
install it?
>
>I ran the makefile.pl and nothing much seemed to happen.
>I am new to perl, so any advice is helpfull.
>
>
>Thanks
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
>


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: Wed, 8 Sep 1999 23:05:03 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: How to install modules?
Message-Id: <C9AB3.1371$6O2.12346@news1.online.no>


Jack Slade <curtisbeard@my-deja.com> wrote in message
news:7r6f4p$22$1@nnrp1.deja.com...
> How do you install a module?
> I have the Time:HiRes module and want to know how to install it?

Hmm, it doesn't seem like the Time::HiRes module includes very detailed
installation instructions, but you shouldn't have to download and install
the modules manually. Use the CPAN module (which should be included with
your Perl-installation)

perl -MCPAN -e 'install Time::HiRes'

You must run this as root of course.

Normally you should run the CPAN in shell mode like this:

First run: perl -MCPAN -e 'shell'
then follow the instructions to configure the CPAN-module.
After this you should have the command 'cpan' available.

All this must be done as root of course.

> I ran the makefile.pl and nothing much seemed to happen.

try
make test
make install

when you are logged in as root to finish the installation.

> I am new to perl, so any advice is helpfull.

hope this helps.

--
Trond Michelsen





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

Date: 8 Sep 1999 21:07:40 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: LWP failure, Recursive inheritance in Socket.pm, Perl 5.00404
Message-Id: <7r6j6s$5o5$1@gellyfish.btinternet.com>

On Tue, 07 Sep 1999 22:01:03 +0100 Keith Lambell wrote:
> -------
> The simplest test case involves a main Perl script and two modules:
> 
> package RITEST_FIRST;
> use strict;
> 
> require IO::Socket;
> 
> require Exporter;
> @Exporter::ISA = qw(Exporter);
> @Exporter::EXPORT=('&FirstRoutine');
> 
<snip>
> 
> require Exporter;
> @Exporter::ISA = qw(Exporter);
> @Exporter::EXPORT=('&SecondRoutine');
> 

You dont want use @Exporter::ISA & @Exporter::EXPORT you want to use the
one in the current package:

use strict;

use vars qw(@ISA @EXPORT);

require Exporter;

@ISA = qw(Exporter);
@EXPORT = qw(whatever);

is what you want ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 8 Sep 1999 21:16:56 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: LWP: How do I retrieve a page that requires login + passwd
Message-Id: <7r6jo8$5oj$1@gellyfish.btinternet.com>

On 07 Sep 1999 23:06:43 -0400 Dirk Eddelbuettel wrote:
> 
> I'd like to write a simple script to retrieve day-end fund prices from a
> service provided by the local newspaper. Upon registration, you can setup a
> portfolio. Upon login, the current values are presented with returns etc. All
> is well, but to manual with Netscape. Hence Perl for an automatic retrieval.
> 

Look in the lwpcook document that comes with libwww-perl there is a section
entitled:

     ACCESS TO PROTECTED DOCUMENTS

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Wed, 08 Sep 1999 15:07:52 -0400
From: Drew Simonis - US Internet Support <Care227@ibm.net>
Subject: Need help with some pattern matching...
Message-Id: <37D6B408.A7203098@ibm.net>

All,
I have a problem with which I need some sage advice.  (I am fairly new 
to Perl, I know this can be easily done, and I even have an idea as 
to how...  that's a start, right??  =)

I have a very large file that looks like:

AR,54,03-514-682-692,514682692,ADS,Argentina,Cordoba
(INTERNET/SECURE/PPP/SLIP/V.34)

where the fields are:

$1 = AR,
$2 = 54,
$3 = 03-514-682-692,
$4 = 514682692,
$5 = ADS,
$6 = Argentina,
$7 = Cordoba (INTERNET/SECURE/PPP/SLIP/V.34)

Its a very large file (several hundred lines) and I need to do two 
things with it.  I need to open it, of course, and then take the last 
field and remove everything after the city name, specifically the 
"(INTERNET/SECURE/PPP/SLIP/V.34)" information.  

<Drum roll>  My question for all of you:

Would it be better to use Unpack or a regular expression to get the 
lines into variables?  And, once I get the variables defined,
how would I apply another regex to the last field to strip off 
the unnessary information??

I am at that frustrating point of learning where I know it can be done
but am not sure how to do it.  I hate that.  Can anyone shed some light
or push me in the right direction???


Thanks in advance
-Drew


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

Date: Wed, 08 Sep 1999 14:45:02 -0500
From: Tom Briles <sariq@texas.net>
To: bryan.ley@mchugh.com
Subject: Re: Newbie ?: @ARGV not getting command line arguments
Message-Id: <37D6BCBE.FD13FBFA@texas.net>

[courtesy copy mailed to bryan.ley@mchugh.com]

Bryan Ley wrote:
> 
> I'm running ActivePerl build 507 in a WindowsNT environment and when I
> call GetOpts.pl, my command line arguments are not passed.  Instead it's
> 
> passing "%*"
> 
> Any ideas?

Post enough of the code to illustrate the problem.  And cut-and-paste
working code - don't try to retype it. 

> Please mail me directly at mailto:bryan.ley@mchugh.com.

Since you haven't munged your address, OK.

- Tom


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

Date: Wed, 08 Sep 1999 15:49:01 -0500
From: Bryan Ley <Bryan.Ley@McHugh.com>
Subject: Re: Newbie ?: @ARGV not getting command line arguments
Message-Id: <37D6CBBD.4E3B78B3@McHugh.com>

At the command line, I type test2.pl -a <argument> -bc <argument>
******************************************************************
#! /opt/local/bin/perl
#
#require "getopts.pl";
#
&Getopts("a:bc");
#
printf ("a ($opt_a)\n");
printf ("b ($opt_b)\n");
printf ("c ($opt_c)\n");
#
#
;# getopts.pl - a better getopt.pl

;# Usage:
;#      do Getopts('a:bc');  # -a takes arg. -b & -c not. Sets opt_* as
a
;#                           #  side effect.

sub Getopts {
    local($argumentative) = @_;
    local(@args,$_,$first,$rest);
    local($errs) = 0;

    @args = split( / */, $argumentative );
printf("@args\n");
printf("@ARGV\n");
printf("Next line in code is while loop\n");

#    while(@ARGV && ($_ = $ARGV[0]) =~ /^(.)(.*)/) {
    while(@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
printf("If this prints, the while loop works\n");
 printf("@ARGV\n");
 printf("$1,$2,$3,$4,$5,$6,$7,$8,$9\n");
        ($first,$rest) = ($1,$2);
 printf("argumentative = $argumentative\n");
 printf("first = $first\n");
 printf("rest = $rest\n");

        $pos = index($argumentative,$first);

 printf("pos = $pos\n");

        if($pos >= 0) {
     printf("args = $#args\n");
     printf("args(0) = $args[$pos+1]\n");
            if($pos < $#args && $args[$pos+1] eq ':') {
                shift(@ARGV);
                if($rest eq '') {
                    ++$errs unless @ARGV;
                    $rest = shift(@ARGV);
                }
                ${"opt_$first"} = $rest;
  printf("optfirst = opt_$first\n");
  printf ("rest = $rest\n");
            }
            else {
                ${"opt_$first"} = 1;
                if($rest eq '') {
                    shift(@ARGV);
                }
                else {
                    $ARGV[0] = "-$rest";
                }
            }
        }
        else {
            print STDERR "Unknown option: $first\n";
            ++$errs;
            if($rest ne '') {
                $ARGV[0] = "-$rest";
            }
            else {
                shift(@ARGV);
            }
        }
    }
    $errs == 0;
}

1;
**********************************************************************




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

Date: Wed, 08 Sep 1999 19:21:41 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Old Script Doesn't Like My New Perl? Help!
Message-Id: <37d7b689.1425248@news.skynet.be>

Dan Poynor wrote:

>[root@server hq]# perl -w /home/httpd/cgi-bin/rotate.pl
>Use of uninitialized value at /home/httpd/cgi-bin/rotate.pl line 7.
>
>---------here's the script rotate.pl-------------
>#! /usr/bin/perl
>
>$oldlink = readlink("/home/httpd/foobar.com/current");
>@dirs = sort grep {!-l $_ && -d _} </home/httpd/foobar.com.com/slideshows/*>;
>push(@dirs, $dirs[0]);

As Abigail said: if @dirs is empty, $dirs[0] will be undefined.

>for (1..@dirs) { $newlink = $dirs[$_] and last if $dirs[$_-1] eq $oldlink }

But also, since you loop with $_ from 1 to the count of items in @dirs,
$dirs[$_] may well be beyond the end of the array, thus, again:
undefined.

Are you sure you don't want

  for (1..$#dirs) { ... }

?
>symlink($newlink, "tmp.$$");

What if there isn't a match in the loop, for any of the array elements?
Then, too, $newlink will be undefined.

>rename("tmp.$$", "/home/httpd/foobar.com.com/current");

-- 
	Bart.


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

Date: Wed, 08 Sep 1999 14:50:07 -0400
From: Burton Kent <burton@REMOVETHIS.lucent.com>
Subject: Omnimark vs. Perl
Message-Id: <37D6AFDF.AEFDA39C@REMOVETHIS.lucent.com>

I've been charged with learning a language called Omnimark,
which basically has pattern matching and is geared for SGML.

Has someone out there used it?  Is it worth learning or
will Perl do the trick and still KISS?

Danke,

Burton


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

Date: Wed, 8 Sep 1999 20:20:50 +0100
From: "Andrew Whitaker" <bigsleep@dircon.co.uk>
Subject: Re: Password Protection?
Message-Id: <37d6b73a_1@newsread3.dircon.co.uk>


Abigail wrote in message ...
>A Perl program that prevents people from bookmarking a document?
>There isn't. Try using a larger hammer.
>HTTP has authentication. If you want to use authentication, use
>it at the appropriate level.
>Abigail


I've recently looked into this, and it seems there are two ways of
protecting a mixed/dynamic page site.
1. Use mod_perl and an access handler to look at entries in a user
registration file.
2. Add passwords to .htpasswd on the fly and let users cope with the
horrible case-sensitive grey boxes.
Both probably require a fair degree of access to the web-server
configuration.

A workable way of doing 2 just for cursory protection is to have one
password and change it monthly and maintain a mailing list of your users -
only re-mail valid users each month with the new password.

Andy Whitaker
Cimexmedia Ltd.




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

Date: Wed, 08 Sep 1999 19:13:59 GMT
From: balesn@my-deja.com
Subject: perl.exe hanging on NT
Message-Id: <7r6cha$u0p$1@nnrp1.deja.com>

We are running Netscape Enterprise Server 3.6.1 on NT 4.0 and
ActivePerl from ActiveState, build 519.  We continually have perl.exes
hanging around.  They do not appear to be taking up CPU, but if we let
100 or so accumulate the server comes to a halt.  We have
also had the same problem with an earlier version of Perl.

Right now I monitor Task Manager and then open a DOS session and
manually kill the perl.exe processes.  Any ideas about what might be
causing this?

I have no choice to run this on UNIX, I have to run this on NT!


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 08 Sep 1999 19:12:19 GMT
From: jp_48504@my-deja.com
Subject: Re: Please help a newbe
Message-Id: <7r6ce7$u00$1@nnrp1.deja.com>

In article <MPG.123effe625329afa989f1f@nntp.hpl.hp.com>,
  lr@hpl.hp.com (Larry Rosler) wrote:
> In article <7r3jg2$52a@dfw-ixnews3.ix.netcom.com> on 7 Sep 1999
17:54:10
> GMT, Eric Bohlman <ebohlman@netcom.com> says...
> + Alex Rhomberg (rhomberg@ife.ee.ethz.ch) wrote:
> + : Two: read the file into an array and discard all but the last
> + : entries:
> + :
> + : open FILE, "$0" or die "aaargh";
> + : @WholeFile = <FILE>;
> + :
> + : for (@WholeFile[-10..-1]) {
> + :   print;
> + : }
> + :
> + : Note that this first reads the whole file, which might be not so
> + : good for huge files. But unlike the others, it does not rely on
> + : external programs, so it should work on braindead platforms.
> +
> + It's not necessary to store the entire file in the array, only the
> + number of lines that need to be kept:
> +
> + my $MAX_LINES=10;
> + my @lines;
> + open(FILE,"<$0") or die "couldn't open $0: $!";
> + while (<FILE>) {
> +   shift @lines if @lines>$MAX_LINES;
> +   push @lines,$_;
> + }
> +
> + When the loop finishes, @lines contains the last 10 (or the number
of
> + lines in the file if less than 10) lines.
>
> Another Way To Do It is to seek to the end of the file and read it
> backwards (block by block) until 10 lines have been read.
>
> Maybe we can persuade Uri Guttman to finish and publish his Backwards
> module, which makes this very simple (and very efficient!).
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
>

Thanks,
A module would be nice, being that I am still learning Perl.  Although
it can be painful at times, I do enjoy writing programs that can do
some unique things.  I'll try your suggestions and let you know. Thanks
to all of you for your input.

JP


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 08 Sep 1999 19:55:25 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: race condition in forking server (keywords: waitpid, reaper)
Message-Id: <NazB3.10622$r5.779148@typ11.nn.bcandid.com>

In article <7r5on2$e0r$1@nnrp1.deja.com>,  <dud@sydney.net> wrote:
>It seems that when multiple child processes terminate at the same time,
>REAPER is only being called once. As this sub is responsible for
>tracking the number of live children, the result is two child processes
>dying but only one tracked, therefore only one re-created.

Call waitpid in a loop with WNOHANG until it stops returning child processes.
-- 
Alan Curry    |Declaration of   | _../\. ./\.._     ____.    ____.
pacman@cqc.com|bigotries (should| [    | |    ]    /    _>  /    _>
--------------+save some time): |  \__/   \__/     \___:    \___:
 Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman


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

Date: 8 Sep 1999 15:53:12 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: running perl script on local apache server
Message-Id: <slrn7tdjav.nrl.abigail@alexandra.delanet.com>

Maureen Dunlap (maureen@islandwebdesign.com) wrote on MMCXCIX September
MCMXCIII in <URL:news:37D65FFC.737E72F1@islandwebdesign.com>:
'' 
'' I'm not a programmer,

Then why do you come with programming problems here?

'' Now I'm setting up a script on my local C: drive on my apache server and
'' am getting an Internal Server Error with the following showing up in the
'' error log:
'' 
'' "Premature end of script headers"
'' 
'' Is this something really obvious and simple?

No. It's your web server saying "you have a bug".

If you have configured your web server right, and wrote Perl in the right
way, you should be able to find the error in the appropriate log file.

But if you run Perl such that is keeps silent, or you haven't configured
your web server appropriately, then it just sucks to be you.

Without information, you cannot be helped.



Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Wed, 08 Sep 1999 20:33:59 GMT
From: "Don Stefani" <customk9@home.com>
Subject: shopping cart
Message-Id: <XKzB3.7326$Vi5.81202@news1.frmt1.sfba.home.com>

I am looking for a shopping cart written in PERL. I have seen many of them
on CGI-Resource but I have not liked the look of them. I am using Miva
Merchant for an account right now and I woudl really like to use one written
in perl, not htmlscript.

Any suggestions?

Thanks in advance,
Don Stefani




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

Date: Wed, 8 Sep 1999 13:28:52 -0700
From: "James Francsico" <jrfclan@hotmail.com>
Subject: Re: STL difference - VC vs BCB
Message-Id: <7r6grc$2sr@news.dns.microsoft.com>

I can't comment on the functionality of the program but it compiles ok in
VC++ 6.0.

good luck.

jrf

Pusiæ Goran <pusic.goran@ev.co.yu> wrote in message
news:7r51oa$tqh$1@Mercury.ev.co.yu...
> Can enyone explain to me why thi program compiles and works in BCB 3 and
> doesn't compile in VC 5?
>
> #include <Vector>
> #include <Memory>
>
> using namespace std;
>
> main()
> {
>  vector<auto_ptr<int> > v;
>   return 0;
> }
>
> VC 5 spits a bunch of messages in xutility don't understand (C2784, C2676)
>
> What I'm trying is to create a container of which "owns" objects it's
> pointers point to (something like "indirect container") and it seems to me
> that auto_ptr is OK for this. Correct me if I'm wrong, please.
>
>
>




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

Date: Wed, 08 Sep 1999 20:26:58 GMT
From: missymanning@my-deja.com
Subject: Re: Tries to download script when running
Message-Id: <7r6gq1$1f1$1@nnrp1.deja.com>

I figured out that prob but have another.

I am converting a script from unix to nt and having some
problems...please help me.

My script is trying to run and gives me this:

[Wed Sep 8 14:13:36 1999] Record.pm: Can't locate Record.pm in @INC
(@INC contains: C:/Perl/lib
C:/Perl/site/lib .) at F:\Inetpub\wwwroot\staging\cgi-bin\doadmin.pl
line 61. BEGIN
failed--compilation aborted at
F:\Inetpub\wwwroot\staging\cgi-bin\doadmin.pl line 61.

I realize that it is not finding the file.  The file is located in the
cgi-bin and my code calls it here:

unshift(@INC, "/cgi-local/matrix1000");
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use Record;
use LockDir;

my $Q = new CGI;

require '/cgi-bin/config.pl';
require './downline_module.pl' if $downline_builder;
require './matrix_module.pl' if $matrix_builder;

can you see what is wrong....

Thanks, Missy :o(


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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 V9 Issue 743
*************************************


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