[9688] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3282 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 29 03:07:14 1998

Date: Wed, 29 Jul 98 00:00:40 -0700
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, 29 Jul 1998     Volume: 8 Number: 3282

Today's topics:
    Re: Can't figure out how to remove newlines (Tad McClellan)
    Re: Children from a fork call do not exit. (Martien Verbruggen)
    Re: CHOMP not working on some servers <sneaker@sneex.fccj.org>
    Re: Client/Server examples anyone? zingbuster@my-dejanews.com
    Re: getting  the binary represenation of a number <ljz@asfast.com>
        Link Updating spankboy18@my-dejanews.com
    Re: Net::Telnet -like module without telnet (Antti-Jussi Korjonen)
    Re: Net::Telnet -like module without telnet <"postmaster"@[127.0.0.1]>
    Re: Perl and NT (Martin Vorlaender)
        perl's object model (Zhang Zhengyu)
    Re: Perl5.005: any good Thread::kill workaround ideas? <andreas.greulich@mbox.bfi.admin.ch>
    Re: Same code, diff machines, diff results (Martien Verbruggen)
        Sorry for the formatting: pattern matching schnibitz@my-dejanews.com
        Sorry: pattern matching schnibitz@my-dejanews.com
        striphtml.pl and Win32 Perl 5.004 twl@pobox.com
    Re: Submit only Once (Martien Verbruggen)
    Re: This is an easy question! (Ronald J Kimball)
    Re: This is an easy question! (Bob Trieger)
    Re: Using the hash (Martien Verbruggen)
        why is clpm generally used rather than clp? <davidc@selectst.com>
    Re: why is clpm generally used rather than clp? <rra@stanford.edu>
    Re: Y2K problem in PERL with localtime() (Ronald J Kimball)
    Re: Zombies from Forking are Bad, says Sun (Mike Stok)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Tue, 28 Jul 1998 22:54:42 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Can't figure out how to remove newlines
Message-Id: <2e6mp6.jqi.ln@localhost>

Terrence E. S. Thompson (thompson@m-net.arbornet.org) wrote:

: How exactly
: do I remove a newline from the end of a string?


   perldoc -f chomp


: I tried this:

: $string =~ s/(.+)\n$/$1/;


      $string =~ s/\n$//;


: but it doesn't seem to work.


   That works fine for me...

   Maybe you don't have a non-newline char to match that dot?


   Post a complete and short program that demonstrates the 
   "not working" and someone here will likely explain it
   for you.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 29 Jul 1998 06:07:07 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Children from a fork call do not exit.
Message-Id: <6pme6b$mef$3@nswpull.telstra.net>

In article <35BCB0FD.79D5@cbrmain.cbr.nrc.ca>,
	Philip Denno <philip@cbrmain.cbr.nrc.ca> writes:
> This script is running on a Solaris running SunOS v5.6. 
> Any help would be appreciated.

I do that sort of stuff all the time on Solaris 2.6. Without you
actually showing us your code, we won't be able to help you though. I
posted some example code for a fork of several children a week ago or
so. Maybe you should find it on dejanews and see if it looks anything
like you are trying. If you can't find where your stuff is going
wrong, show us the code, and we might be able to point out a thing or
two.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Wed, 29 Jul 1998 00:15:10 -0400
From: Bill 'Sneex' Jones <sneaker@sneex.fccj.org>
Subject: Re: CHOMP not working on some servers
Message-Id: <35BEA1CE.F7AC2052@sneex.fccj.org>

Ronald J Kimball wrote:
> 
> If you want chomp to remove crap from the end of the string, you need to
> do this first:
> 
> $/ = 'crap';
> 
> Note if you have a load of crap to remove from the end of the string, as
> in 'poop excrement crapcrapcrap', this method will only remove the last
> bit of crap, rather than all the crap.  You would need to do something
> like s/(?:crap)+$// instead.

:D

You're killing me!  This is better than stand-up.

ROTFLOL!
-Sneex- 
__________________________________________________________________
Bill Jones | FCCJ Webmaster | Life is a 'Do it yourself' thing...
             http://webmaster.fccj.org/cgi/mail?webmaster


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

Date: Wed, 29 Jul 1998 05:48:59 GMT
From: zingbuster@my-dejanews.com
Subject: Re: Client/Server examples anyone?
Message-Id: <6pmd4b$c92$1@nnrp1.dejanews.com>

In article <6og963$92p$1@ultranews.duc.auburn.edu>,
  carltjm@mail.auburn.edu (Joseph M Carlton) wrote:
> Well, since I haven't gotten any response from my post yesterday, I would
> like to say that I have read a lot of stuff about clients, servers, and
> sockets in the last couple of days and I am blown away.  I don't know
> where to start.  I need to get an id number from a user via web page form
> and search a table with this id number on a different computer on the
> network.  I assume that I need to set up a client and a server to do
> this.  Does anyone know where I can find an example client and  server
> similar to what I am trying to do?  Your help is much appreciated.  I
> don't know where to go from this point.  Thanks in advance.
>
> --
>
> Joey Carlton

This is the important part of a client I'm using to do something
similar to what you describe.  The server is in Visual Basic, but if
you're interested, I think I can dig up some perl code for a simple
server that could talk to a client like this one.

sub contact_home {
  use Socket;
  $VBport = 2346;  # the port your server is listening on
  $remote = '209.180.184.228'; # the IP number of the server
  $iaddr = inet_aton($remote) or die "no host: $remote";
  $VBserver = sockaddr_in($VBport, $iaddr);
  $VBproto = getprotobyname('tcp');
  socket(VBS, PF_INET, SOCK_STREAM, $VBproto) or die "socket: $!";
  connect (VBS, $VBserver) or die "connect: $!";
  select (STDOUT);
  if ($incoming = fork) {
    # this is the parent and it prints data to the socket
    select(VBS);
    print VBS "$filename,";
    foreach $field (@Field_Order) {
      print VBS "$field: $Form{$field}," unless $Form{$field} =~ /Submit/;
    }
    print VBS "\n";
  }
  else {
    # this is the child and it writes to the socket
    $cnt = 0;
    while (<VBS>) {
      $cnt++;
      if ($cnt == 2) {
        $headerLine = $_;
        $headerLine =~ s/  +/ /g;
        $headerLine =~ s/(ADULT).+/$1/;
      }
      if ($_ =~ /End of data/) {
        close (VBS);
        &return_html;
      }
    }
  }
}
> Senior, Computer Engineering
> Auburn University
> carltjm@mail.auburn.edu
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 29 Jul 1998 01:07:55 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: getting  the binary represenation of a number
Message-Id: <lthg011bys.fsf@asfast.com>

abigail@fnx.com (Abigail) writes:

> Amy Rogers (aro@dnai.com) wrote on MDCCXCI September MCMXCIII in
> 
> [ ... interesting discussion snipped to save bandwidth ... ]
> 
> ++ On the same subject here's a short program that uses the << operator to
> ++ print out the first 16 powers of 2. The answer is given below, but I'm
> ++ having trouble understanding the "$value = $value << 1;" line. I
> 
> That's just another way of writing $value = $value * 2; 
> 
> ++ understand that I should convert the $value to a bit notation so I could
> ++ shift the first bit out to the right by one to get the new value. 
> 
> You don't have to do anything. Perl will take of that.
> 
> [ ... ]
>
> ++ On the other hand, even if I had understood the whole bit notation
> ++ conversion, I wonder what relevancy, if at all, it has for the beginner
> ++ like myself?  The "Learning Perl, 2nd edition" doesn't appear touch on
> ++ this subject at all. 
> 
> 
> Sometimes, people use integers as bitfields. In those cases, bitwise
> arithmetic can be useful. 

Yes.  And also, in the old days, many CPU's tended to perform bit
shifts much faster than multiplications or divisions (and most still
do, to the best of my knowledge).  Therefore, to save time on the much
slower CPU's of yesteryear, people would sometimes use these bit
shifts as a speedier method of multiplying or dividing by powers of
two ... especially when programming in certain languages which tended
to operate "close to the hardware".

Some people who learned this computer-time-saving technique in the
past tend to also use it (probably out of habit) when programming in
Perl, and this is sometimes the reason why you still see bit shifts
being used for multiplications and divisions in Perl programs.
However, Perl is a language which is not nearly so "close to the
hardware" as some of these other languages, so there isn't always a
significant time savings in Perl in chosing bit shifts over multiplies
and divides. (I will run some benchmarks in a few days when I have
more time).

Also, as CPU's get faster and faster, it is sometimes cost effective
to sacrifice a few machine cycles in the interest of program clarity
and future maintainability.  In many cases, using a simple multiply or
divide can make a tricky algorithm much easier to understand, debug,
and maintain.

Someone (who?  I keep forgetting) once said something like this: "As
time goes forward, computer time gets cheaper, and person-hours get
more expensive," the point being that saving a few machine cycles by
using a harder-to-understand-and-maintain algorithm may not always the
most efficient thing to do in the long run.

> [ ... ]

-- 
 Lloyd Zusman   ljz@asfast.com
 perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
 $t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
 $x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'


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

Date: Wed, 29 Jul 1998 06:34:33 GMT
From: spankboy18@my-dejanews.com
Subject: Link Updating
Message-Id: <6pmfpp$fmm$1@nnrp1.dejanews.com>

Does anyone know of a perl script that allows you to automatically update
your website links using server side includes? If so, please email the name
and link to me @ ucsbdawg@aol.com.

Thank You,
Bryce jones

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 29 Jul 1998 06:04:07 GMT
From: aajii@aajii.ton.tut.fi (Antti-Jussi Korjonen)
Subject: Re: Net::Telnet -like module without telnet
Message-Id: <6pme0n$c12$1@baker.cc.tut.fi>

Eric Harley (eharley@pacbell.net) wrote:
: > I'm using Net::Telnet module now to execute commands on another computer.
: > I don't need to log onto another computer any more, I can use the same 
: > computer where the script is located. 
: > I'd like to use similar method in executing programs, that is used in
: > Net::Telnet module. 
: > Can anybody help me with this?
: > Expect?
: > 

: #!/usr/local/bin/perl
: use Shell;

: ls('-lr');  #Generate directory listing.

That doesn't help me much.
What I need is a module that acts the same as the Net::Telnet module without 
having to telnet to another computer.
The resource, I need to access with my script is located at the same computer
and I need to enter username and password to access it.
So, first I need to issue command "xxx username" and then password.
This very much telnet-a-like. After I have logged in to the resource, I can
issue commands, like "system", "trunk" etc. And I catch that output etc...
When I'm done, I log out of the resource.


--
  
         __/                __/ __/  __/     Antti-Jussi Korjonen
      __/ __/    __/       __/ __/__/       Vaajakatu 5 D 85
    __/    __/      __/   __/ __/__/       33720 TAMPERE, FINLAND
  __/       __/    __/__/__/ __/  __/     tel. +358-(0)40-577 83 23
                                         Antti-Jussi.Korjonen@sonera.fi
   --------->>  http://www.students.tut.fi/~k150556  <<---------
     


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

Date: Wed, 29 Jul 1998 01:34:48 -0500
From: Bobn <"postmaster"@[127.0.0.1]>
Subject: Re: Net::Telnet -like module without telnet
Message-Id: <6pmftc$sf4$1@supernews.com>

This may just me being lazy, but how about using the smae code,
specifying a host nme of 'localhost'?



Antti-Jussi Korjonen wrote:
> 
> Hi!
> 
> I'm using Net::Telnet module now to execute commands on another computer.
> I don't need to log onto another computer any more, I can use the same
> computer where the script is located.
> I'd like to use similar method in executing programs, that is used in
> Net::Telnet module.
> Can anybody help me with this?
> Expect?
> 
> --
> 
>          __/                __/ __/  __/     Antti-Jussi Korjonen
>       __/ __/    __/       __/ __/__/       Vaajakatu 5 D 85
>     __/    __/      __/   __/ __/__/       33720 TAMPERE, FINLAND
>   __/       __/    __/__/__/ __/  __/     tel. +358-(0)40-577 83 23
>                                          Antti-Jussi.Korjonen@sonera.fi
>    --------->>  http://www.students.tut.fi/~k150556  <<---------
>


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

Date: Wed, 29 Jul 1998 07:00:26 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Perl and NT
Message-Id: <35beac6a.524144494f47414741@radiogaga.harz.de>

askey@my-dejanews.com wrote:
: Problem: Running IIS 3.0 on NT 4.0. I've read dozens of posts looking for my
: answer but have yet to find it. I've installed Perl successfully (from NT
: Resource Kit), modified my registry to address .pl files, and created and
: tested a script from a Web page. Now I've got a script I downloaded from a
: web site that is a form handler designed for UNIX.

Any perl script to be used with IIS3 involving I/O redirection (like the
typical formmailer script) needs the following registry settings:

In the Hive 
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\

- ScriptMap\.PL , value REG_SZ "x:\path\to\PERL.EXE -w %s %s"
- CreateProcessWithNewConsole , value REG_DWORD 1
- eventuell CreateProcessAsUser mit Wert REG_DWORD 1

and a restart of IIS.

Hope it helps,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Cetero censeo            | work: mv@pdv-systeme.de
 Redmondem esse delendam. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: 29 Jul 1998 06:23:32 GMT
From: zhengyu@ic.Berkeley.EDU (Zhang Zhengyu)
Subject: perl's object model
Message-Id: <6pmf54$8nn$1@agate.berkeley.edu>

hi, 

  after a careful reading on Perl's object model, I was thinking if 
C++ was derived from C in a similar manner. 

  Reason:

    Hash table data structure exists in C, so we could alias class to
  a pointer to a hash. Afterwards, implement function "ref" and "bless".
  Then what we get is a perlish object oriented C language.

  Note: I guess there are more than one way of turning C OOps.

  Your instruction is very much appreciated.

  
Zhengyu
-- 

********************************
Zhang Zhengyu                  *
zhengyu@ic.eecs.berkeley.edu   *
********************************


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

Date: Wed, 29 Jul 1998 07:33:50 +0200
From: "Andreas Greulich" <andreas.greulich@mbox.bfi.admin.ch>
Subject: Re: Perl5.005: any good Thread::kill workaround ideas?
Message-Id: <35beb445.0@fwsrva.bfi.admin.ch>

Hi!

I didn't extensively try the new Perl out, but remember having had a similar
problem when I programmed something like that in C++. The problem might
be that not all system calls are "cancellation points". Threads are usually
not killed, but cancelled, and cancellation is somehing that is stacked and
reacted upon at a later time. The problem is that system calls that are
blocking do not all automatically react upon cancellation. Posix threads
for example guarantee that read and write system calls actually are
cancellation points, but the related recv and send system calls are
not necessarely cancellation points (it is left open to the implementation),
On Solaris 2.5.1 for example, recv/send are no cancellation points, so
that one must use read/write instead of send/recv if the thread should
be cancellable. This might be the reason no such call was implemented
in Perl? Anyway, it might still be possible to call pthread_cancel directly
as a system call using the Thread-ID. See the pthread_cancel manpage.

                           Andy

Jozsef Hollosi wrote in message <35BCFCB6.8A4359AA@sbcm.com>...
>I just built the new Perl5.005 on Digital Unix and I am trying out the
>cool threads.
>
>My first test is a simple network server that starts two threads (reader
>and writer) for
>each accepted connection. The problem is, that when the writer decides
>it is time to
>finish, there is no trivial way to tell the reader to also finish,
>because that is waiting
>on a file descriptor (until there is some activity on that file
>descriptor).
>
>It would be nice to have something like Thread:kill, but there is none.
>
>Any ideas?
>
>Thanks,
>Jozsef
>hollosi@sbcm.com
>
>




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

Date: 29 Jul 1998 06:01:42 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Same code, diff machines, diff results
Message-Id: <6pmds6$mef$1@nswpull.telstra.net>

In article <35BC98DD.42E9@min.net>,
	John Porter <jdporter@min.net> writes:

> (Despite what some folks say),
> The difference isn't the perl, it's the machine.
> Solaris is remarkably incomplete as to the world's timezones that it
> knows about.
> Solaris simply has no clue what timezone 'Asia/Calcutta' is.

$ uname -a
SunOS timber 5.6 Generic_105181-06 sun4u sparc SUNW,Ultra-2
$ pwd
/usr/share/lib/zoneinfo
$ grep Asia/Calcutta asia
Zone    Asia/Calcutta   5:53:28 -       LMT     1880
# The following are like Asia/Calcutta:
$

Hmmm.. Looks like it does know. And so does Solaris 2.5.1.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Wed, 29 Jul 1998 06:39:48 GMT
From: schnibitz@my-dejanews.com
Subject: Sorry for the formatting: pattern matching
Message-Id: <6pmg3k$fp1$1@nnrp1.dejanews.com>

Sorry for the formatting junk.	I didn't realize it till it was too late.  I
am posting with dejanews (any suggestions for a better way?) and this time I
previewed it first.  Looks okay so far, so I will send it.  Hopefully the
formatting will not break down on me (crossing fingers tightly). ANYHOW,
Below is a little script I wrote that will read in a file and look for
certain patterns.  What I want it to do is read in a page of html called
"rogue.html." I specifically infected this page with harmful javascript.  I
want the script to  recognize keywords within the context of a javascript,
embedded in the html of "rogue.html."  Hope that made sense.  Anyhow, I want
it to delete the entire javascript, if a certain pattern like "file:" is
found.	It works great if there is only one script on the page, but if there
are several scripts, it sometimes deletes the wrong script.  Is there any way
to make sure it deletes only the script(s) with the patterns/keywords and
leaves the others untouched?  Any advice would be greatly appreciated.

~Prime

#!/usr/local/bin/perl -w
use strict;

my $file = 'rogue.html';
open(INFO, $file) or die "Couldn't open $file. $!";
while (<INFO>) {
if (/date/i) {
{ local $/; $_ = <INFO>; }
if (/file:/i) {
s!<script\s.*?</script>!!is;
        if (/embed SRC="file.{150,}/) {
        s!embed!!is;
}
}
print $_;
} else {
print $_;
}
}
__END__

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 29 Jul 1998 06:37:50 GMT
From: schnibitz@my-dejanews.com
Subject: Sorry: pattern matching
Message-Id: <6pmfvu$fop$1@nnrp1.dejanews.com>

Sorry for the formatting junk.  I didn't realize it till it was too late.  We
will try to get it straight this time.
ANYHOW,
Below is a little script I wrote that will read in a file and look
for certain patterns.  What I want it to do is read in a page of html called
"rogue.html." I specifically infected this page with harmful javascript.  I
want the script to  recognize keywords within the context of a javascript,
embedded in the html of "rogue.html."  Hope that made sense.  Anyhow, I want
it to delete the entire javascript, if a certain pattern like "file:" is
found.  It works great if there is only one script on the page, but if there
are several scripts, it sometimes deletes the wrong script.  Is there any way
to make sure it deletes only the script(s) with the patterns/keywords and
leaves the others untouched?  Any advice would be greatly appreciated.

~Prime

#!/usr/local/bin/perl -w
use strict;

my $file = 'rogue.html';
open(INFO, $file) or die "Couldn't open $file. $!";
while (<INFO>) {
if (/date/i) {
{ local $/; $_ = <INFO>; }
if (/file:/i) {
s!<script\s.*?</script>!!is;
        if (/embed SRC="file.{150,}/) {
        s!embed!!is;
}
}
print $_;
} else {
print $_;
}
}
__END__


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 29 Jul 1998 06:43:14 GMT
From: twl@pobox.com
Subject: striphtml.pl and Win32 Perl 5.004
Message-Id: <6pmga2$fr2$1@nnrp1.dejanews.com>

Hi,

I downloaded striphtml.pl from CPAN and tried to run it under QUB's perl
for cygwin32 and under the binary win32 perl.  Both are version 5.004.  I
get the following error:


/ <                    # opening angle bracket

  (?:  # Non-backreffing grouping paren  [^>'"] *  /: regexp *+ operand could
be empty at /perl/striphtml.pl	line 66.

Can someone tell me how to modify this file to make it work.

Thanks,

Ted Leung

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 29 Jul 1998 06:12:31 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Submit only Once
Message-Id: <6pmegf$mef$4@nswpull.telstra.net>

In article <6pi62h$knh$1@nntp1.ba.best.com>,
	malch@malch.com (Malcolm Hoar) writes:
> In article <6pi44b$sa1$1@client3.news.psi.net>, abigail@fnx.com wrote:
>>Sam Irion (persoft@concentric.net) wrote on MDCCXCI September MCMXCIII in
>><URL: news:6phuj7$qo3@examiner.concentric.net>:
>>++ Can anyone give me any advice or direction on how to prevent the user from
>>++ using the browser's back button to go back to a form and repost it?
>>
>>You can't. And that has nothing to do with Perl.
> 
> There are several things you can do. None of which has anything
> to do with Perl really :-)

Indeed, so why are you posting them here? Mail the person if you must.

> For example, have the form processing script prevent more
> than "x" submissions from the same IP address in "y" seconds.

That is not the same thing. The user has still used his back button,
and has still reposted. what you do with the crap is something else.
And once again, someone has given an answer that ignores proxies and
firewalls.

Again: This has NOTHING to do with perl. Take it elsewhere.

Followups set.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Wed, 29 Jul 1998 00:45:12 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: This is an easy question!
Message-Id: <1dcwkev.rluvo61j6qm16N@bay1-205.quincy.ziplink.net>

Patrick Boswell <patb@ufl.edu> wrote:

> Subject: This is an easy question!

This is a bad subject header.  Instead of 'This is an easy question!',
something like 'Having trouble with split' would be more appropriate.

>    #@cart_fields = split (/\|/, @cart_lines);
                                  ^^^^^^^^^^^

You'd better look up split in the documentation.  The second argument to
split should be a string, not an array.  That's why you had the problem
of it only splitting the first line.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Wed, 29 Jul 1998 04:44:49 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: This is an easy question!
Message-Id: <6pm9h1$gcf$1@strato.ultra.net>

[ posted and mailed ]

patb@ufl.edu (Patrick Boswell) wrote:
-> I am working with CGI and perl, and I am currently trying to hack up some of
->  Selena Sol's code.  I'm trying to split
-> this Shopping Cart as listed below on the | symbol, where upon each field I
->  will perform some calculations. However,
-> when I try to split this file, I am able to do this, but it only splits up
->  until the first line. It's like after it's
-> done splitting or finds the first reference, it stops. Any help?

-> #! /usr/bin/perl
-> open(CART,"/home/p/patrickb/pattest.com_html/User_carts/4966912.8222.cart");
-> while (<CART>)  {
->    @cart_lines = split (/\d\d\r\d\d/);
->    close(CART);


May have something to do with you closing the file handle after reading only 1 
line.


Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972 
  Ext: 1949 and let the jerk that answers know 
  that his toll free number was sent as spam. "


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

Date: 29 Jul 1998 06:04:21 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Using the hash
Message-Id: <6pme15$mef$2@nswpull.telstra.net>

In article <lloyd007-2707980838180001@lloyd007.vip.best.com>,
	lloyd007@best.com (lloyd) writes:

> when I run perl -v this is what I get:
> _________________________
> 
> shell7: {12} perl -v
> 
> This is perl, version 4.0

That is indeed a dead camel. perl 4 is dead, and has been dead for a
long time. You should upgrade to a recent version, or get your admin
to upgrade. Apart from it being old, there are a few security problems
with perl 4, which have been fixed in later version, but above all:
There is no work being done to make perl 4 y2k compliant :)

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Wed, 29 Jul 1998 14:53:13 +1000
From: David Coldrick <davidc@selectst.com>
Subject: why is clpm generally used rather than clp?
Message-Id: <35BEAAB9.26A914C9@selectst.com>

Dumb question time. Is there any reason why this newsgroup is used for
perl questions/answers rather than comp.lang.perl? Presumably there's
some history to it . . .

Regards,
David


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

Date: 28 Jul 1998 22:19:00 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: why is clpm generally used rather than clp?
Message-Id: <m3emv5nsjf.fsf@windlord.Stanford.EDU>

David Coldrick <davidc@selectst.com> writes:

> Dumb question time. Is there any reason why this newsgroup is used for
> perl questions/answers rather than comp.lang.perl? Presumably there's
> some history to it . . .

Yeah, comp.lang.perl doesn't actually exist.  :)

comp.lang.perl was reorganized into this group and comp.lang.perl.announce
a long time ago, and later other groups were created.  At the time of the
reorganization, comp.lang.perl was removed at most sites according to the
fairly standard newsgroup creation procedure because it was renamed to
comp.lang.perl.misc.  Sites still carrying comp.lang.perl are, either
intentionally or unintentionally, usually unintentionally, not following
the standard newsgroup creation procedure.

You may want to bug whoever runs your news server about this and find out
from them why they're carrying groups that most sites don't.  I personally
think that sites that do this are doing their customers a disservice,
since it isn't obvious when one encounters comp.lang.perl that posts to
that group won't reach very many people.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Wed, 29 Jul 1998 00:45:14 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Y2K problem in PERL with localtime()
Message-Id: <1dcwkn3.14voao11uuryvbN@bay1-205.quincy.ziplink.net>

John Stanley <stanley@skyking.OCE.ORST.EDU> wrote:

> I see nothing related to perl in the string 02-29-100. If I am your
> pointy haired boss and you hand me a report with that date in it, I
> have no way of knowing that you programmed in perl. "Dates will be the
> output of the 'localtime' perl funtion" is not how any company I know
> of standardizes its dates. "Dates will be expressed as the last two
> digits of the year" is.

Then add 1900 to the year when you print the report.  Duh.  It's not
Perl's fault if you don't know how to program.

You really do argue about the stupidest things.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 29 Jul 1998 06:05:59 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Zombies from Forking are Bad, says Sun
Message-Id: <6pme47$m03@news-central.tiac.net>

In article <35BE445D.5002A7E9@digitalriver.com>,
Steve Livingston  <slivings@digitalriver.com> wrote:
>I've got a perl daemon that runs continuously, forking children that do
>stuf and then exit (simplified code below).
>
>I run sparc/solaris/perl5.00404.
>
>Each of the children leaves a Zombie process (seen by 'top') and I often
>get many thousands of these Zombies, which _appear_ to go away when I
>restart the daemon..

Have you considered checking the perlfaq8 document which contains a
section about running processes in the background.  It includes this
snippet:

       Zombies
           You have to be prepared to "reap" the child process
           when it finishes

               $SIG{CHLD} = sub { wait };

           See the section on Signals in the perlipc manpage for
           other examples of code to do this.  Zombies are not an
           issue with system("prog &").

The perlfunc documentation contains a section on fork including the double
fork trick.  What this does is forks a process which forks and execs the
real thing you want done and then the "middle" process exits immediately.
Thw middle process was the parent of the "real work" process, so when the
"middle" process dies the clean-up of the "real work" process is the
responsibility of init (which does it quite well.)

You can use either perldoc or man to read the manual pages I've mentioned
on a recent system.  If they're not installed then visit
http://www.perl.com and you can find some docs which are only a little out
of date. 

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: 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 3282
**************************************

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