[23293] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5513 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 16 21:05:38 2003

Date: Tue, 16 Sep 2003 18:05:07 -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           Tue, 16 Sep 2003     Volume: 10 Number: 5513

Today's topics:
        [OT] Re: browsing perl docs <ak+usenet@freeshell.org>
    Re: boston perl classes with damian conway (Daniel Berger)
    Re: boston perl classes with damian conway <uri@stemsystems.com>
    Re: boston perl classes with damian conway (Lori Fleetwood)
        browsing perl docs <samj@austarmetro.com.au>
    Re: browsing perl docs <stefan@unfunked.org>
    Re: browsing perl docs <ian@WINDOZEdigiserv.net>
        c.l.p.announce MIA (was:  boston perl classes with dami <jkeen@concentric.net>
    Re: c.l.p.announce MIA (was:  boston perl classes with  <graham.drabble@lineone.net>
    Re: CGI: Help with "loading" message while processing. (corky)
    Re: Forking Server <rlf@swestsystems.com>
    Re: Hash dereferencing and object-oriented Perl <spam@thecouch.homeip.net>
    Re: HoH and MLDBM problems <bwalton@rochester.rr.com>
    Re: how should i fix this?? (Earle Martin)
    Re: how should i fix this?? (Earle Martin)
        How to use different proxies for LWP::Parallel requests (Zeke Koos)
    Re: kill command in a perl script <jgibson@mail.arc.nasa.gov>
    Re: kill command in a perl script <krahnj@acm.org>
    Re: kill command in a perl script <tzz@lifelogs.com>
        locatime() <samj@austarmetro.com.au>
    Re: locatime() <jkeen@concentric.net>
    Re: Pattern Matching in file with invisible char (Tad McClellan)
    Re: Perl way to do PHP includes? <emschwar@pobox.com>
        Socket troubles <hvardhan@ee.duke.edu>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 16 Sep 2003 21:49:16 +0000 (UTC)
From: Andreas Kahari <ak+usenet@freeshell.org>
Subject: [OT] Re: browsing perl docs
Message-Id: <slrnbmf1ap.bah.ak+usenet@vinland.freeshell.org>

In article <3f67802b@news.comindico.com.au>, Sam wrote:
> Hello
> I have perl 5.6 in a debian box, mozilla installed. how can I browse and
> read package documentations that are on my system?

If you have the dwww and perl-doc packages installed and if
you're running your own local web server, then try going to
http://localhost/dwww/ (or if that was http://localhost/doc/)
and locate your perl documentation there.

It was some time ago I ran a Debian system though... things
might have changed.

-- 
Andreas Kähäri


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

Date: 16 Sep 2003 11:06:43 -0700
From: djberg96@hotmail.com (Daniel Berger)
Subject: Re: boston perl classes with damian conway
Message-Id: <6e613a32.0309161006.5ac2797d@posting.google.com>

Uri Guttman <uri@stemsystems.com> wrote in message news:<x73cew3icj.fsf@mail.sysarch.com>...
> so she is
> overreacting in her expected style. i can live with the plonking. :)
> 
> uri

Abigail is a man.

Regards,

Dan


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

Date: Tue, 16 Sep 2003 21:56:48 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: boston perl classes with damian conway
Message-Id: <x7ekyg1jof.fsf@mail.sysarch.com>

>>>>> "DB" == Daniel Berger <djberg96@hotmail.com> writes:

  DB> Uri Guttman <uri@stemsystems.com> wrote in message
  DB> news:<x73cew3icj.fsf@mail.sysarch.com>...
  >> so she is overreacting in her expected style. i can live with the
  >> plonking. :)
  >> 
  >> uri

  DB> Abigail is a man.

i am well aware of that having met her many times. it is still easier to
refer to 'her'.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Class in Boston - Sept 2003 -- http://www.stemsystems.com/class


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

Date: 16 Sep 2003 15:58:59 -0700
From: deficitschmeficit@yahoo.com (Lori Fleetwood)
Subject: Re: boston perl classes with damian conway
Message-Id: <94156c98.0309161458.179d8ed2@posting.google.com>

Uri Guttman <uri@stemsystems.com> wrote in message news:<x73cew3icj.fsf@mail.sysarch.com>...
> 
> c.l.p.announce is moderated so i can't post it there. and abigail isn't
> going to take these classes anyway. as for all those sites and lists, i
> can't imagine how many abigail is on since it was only announced on
> use.perl.org and perlmonks.org and local perl monger lists. so she is
> overreacting in her expected style. i can live with the plonking. :)

Celebrity Death Match: Uri vs. Abigail.  I love it.


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

Date: Tue, 16 Sep 2003 21:27:08 GMT
From: "Sam" <samj@austarmetro.com.au>
Subject: browsing perl docs
Message-Id: <3f67802b@news.comindico.com.au>

Hello
I have perl 5.6 in a debian box, mozilla installed. how can I browse and
read package documentations that are on my system?

thanks




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

Date: Tue, 16 Sep 2003 22:43:34 +0100
From: Stefan <stefan@unfunked.org>
Subject: Re: browsing perl docs
Message-Id: <bk8068$5as$1@newsg2.svr.pol.co.uk>

You could try podtohtml on CPAN.

Stefan


Sam wrote:

> Hello
> I have perl 5.6 in a debian box, mozilla installed. how can I browse and
> read package documentations that are on my system?
> 
> thanks
> 
> 



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

Date: Tue, 16 Sep 2003 21:45:26 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: browsing perl docs
Message-Id: <20030916224606.58e5fa75.ian@WINDOZEdigiserv.net>

On Tue, 16 Sep 2003 21:27:08 GMT in
<message-id:3f67802b@news.comindico.com.au>
"Sam" <samj@austarmetro.com.au> wrote:

> Hello
> I have perl 5.6 in a debian box, mozilla installed. how can I browse
> and read package documentations that are on my system?
> 
> thanks


   $ perldoc Some::Module
   $ perldoc -f chomp
   $ perldoc -q "How do I send mail?"


HTH =)



Regards,

  Ian

-- 
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.


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

Date: 16 Sep 2003 22:04:04 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: c.l.p.announce MIA (was:  boston perl classes with damian conway)
Message-Id: <bk81ck$op6@dispatch.concentric.net>


"Uri Guttman" <uri@stemsystems.com> wrote in message
news:x73cew3icj.fsf@mail.sysarch.com...
> >>>>> "A" == Abigail  <abigail@abigail.nl> writes:
>
>   A> newsgroup. So, beside spam, it was off-topic as well.
>
> c.l.p.announce is moderated so i can't post it there.

Moderated, but apparently non-functional since June.  Except for two OT
postings that looked like somebody cracked the list, I haven't received
anything directly or seen anything on Google in months.   Off list the
maintainer told me he was looking for a new host, but apparently with no
luck so far.  Anybody have suggestions?

Jim Keenan




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

Date: Tue, 16 Sep 2003 23:45:46 +0100
From: Graham Drabble <graham.drabble@lineone.net>
Subject: Re: c.l.p.announce MIA (was:  boston perl classes with damian conway)
Message-Id: <Xns93F8F1BA8E9DAgrahamdrabblelineone@ID-77355.user.dfncis.de>

On 16 Sep 2003 "James E Keenan" <jkeen@concentric.net> wrote in
news:bk81ck$op6@dispatch.concentric.net: 

> 
> "Uri Guttman" <uri@stemsystems.com> wrote in message
> news:x73cew3icj.fsf@mail.sysarch.com...
>> >>>>> "A" == Abigail  <abigail@abigail.nl> writes:
>>
>>   A> newsgroup. So, beside spam, it was off-topic as well.
>>
>> c.l.p.announce is moderated so i can't post it there.
> 
> Moderated, but apparently non-functional since June.  Except for
> two OT postings that looked like somebody cracked the list, I
> haven't received anything directly or seen anything on Google in
> months.   Off list the maintainer told me he was looking for a new
> host, but apparently with no luck so far.  Anybody have
> suggestions? 

I might be able to take it on if someone will vounteer to be co-
moderator. If it happens as I think it will then all you need to be 
able to do to become a moderator is send and receive e-mail, it isn't 
hard. If someone can send me the moderators address it will save me 
looking it up!

BTW, is there a mailing list gated to the group? I would probably 
struggle to take this on[0] but I could enquire.

[0] Getting a mailing list wouldn't be hard, keeping the old address 
/ distribution list might be.
-- 
Graham Drabble
If you're interested in what goes on in other groups or want to find 
an interesting group to read then check news.groups.reviews for what 
others have to say or contribute a review for others to read.


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

Date: 16 Sep 2003 12:13:55 -0700
From: twistdpair@hotmail.com (corky)
Subject: Re: CGI: Help with "loading" message while processing.
Message-Id: <e2d5abce.0309161113.71a93b7a@posting.google.com>

Thanks, Tom. This looks like a good solution.

-corky


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

Date: Tue, 16 Sep 2003 15:49:33 -0700
From: "Robert Fonda" <rlf@swestsystems.com>
Subject: Re: Forking Server
Message-Id: <vmf4s1sgg3c76a@corp.supernews.com>

This looks allot like a homework assignment.


"SRam" <aksivaram2k2@yahoo.com> wrote in message
news:20ffa179.0309142351.1dee07c8@posting.google.com...
> I a writing Forking Server for a Small application..
>
> This is code for multiplexing
>
> my $listen = IO::Socket::INET->new(Proto => 'tcp',LocalPort => 2323,
> Listen => 1, Reuse => 1)
>  or die $!;
>
> $listen->autoflush(1);
>
> my $readable_handles = new IO::Select();
> $readable_handles->add($listen);
> while (1)
> {
>     $listen->autoflush(1);
>     ($new_readable) = IO::Select->select($readable_handles, undef,
> undef, 0);
>
>     foreach $sock (@$new_readable)
> {
>
> if ($sock == $listen)
> {
>         my $new_sock = $sock->accept();
> $readable_handles->add($new_sock);
> $count++;
> $flag = 0;
> print $new_sock->fileno . ": connected\n";
> }
> else
> {
> $sock->recv($line,300);
> print "Received Message\n";
> print "Message = $line\n";
>                         ......operations....
>                  }
>          }
> }
>
> I also got code for Forking Server from advanced perl programming
>
> # Forking server
> use IO::Socket;
> $SIG{CHLD} = sub {wait ()};
> $main_sock = new IO::Socket::INET (LocalHost => 'goldengate',
>                                    LocalPort => 1200,
>                                    Listen    => 5,
>                                    Proto     => 'tcp',
>                                    Reuse     => 1,
>                                   );
> die "Socket could not be created. Reason: $!\n" unless ($sock);
> while ($new_sock = $main_sock->accept()) {
>     $pid = fork();
>     die "Cannot fork: $!" unless defined($pid);
>     if ($pid == 0) {
>         # Child process
>         while (defined ($buf = <$new_sock>)) {
>            # do something with $buf ....
>            print $new_sock "You said: $buf\n";
>         }
>         exit(0);   # Child process exits when it is done.
>     } # else 'tis the parent process, which goes back to accept()
> }
> close ($main_sock);
>
> I need to convert the multipexing one of first to forking..I don't
> know exactly where to modify...Can Anyone help me get me the exact
> code...




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

Date: Tue, 16 Sep 2003 16:49:14 -0400
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: Hash dereferencing and object-oriented Perl
Message-Id: <hHK9b.75976$yG.1377861@weber.videotron.net>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Stefan wrote:
> Hi...
> 
> For I while now I have been coding OO Perl using the $self->{member} 
> syntax to grab elements out of my blessed hash reference. This works 
> just fine, however it recently occurred to me that since $self is always 
> a simple scalar variable (containing a reference), I could just use the 
> $$self{member} syntax instead. Personally, I find this easier to deal 
> with - it's one character less to type and occasionally I find it useful 
> to use @$self{member1, member2}, something which I still haven't figured 
> out how to do with ->.
> 
> So my question... is there anything wrong with using this syntax? The 
> only reason I ask is that I have never seen an OO Perl module which uses 
> it... everyone seems to use the $self->{member} version. Sorry if I'm 
> being and idiot and missing something blatantly obvious!

Your question applies to hash references in general, not just bless()ed Perl objects.

There really is no difference except for human readability.  The majority of Perl coders seem to 
find this:
$href->{key}

A lot more self-explanatory and visually clearer than:
$$href{key}

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/Z3dNeS99pGMif6wRAtYnAJ9W2plWXvxBbeHRg9WM+kwuZ6IT4QCg6Wf3
WobH/UXAriRMldlvE0QpB1I=
=udW4
-----END PGP SIGNATURE-----



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

Date: Wed, 17 Sep 2003 00:15:20 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: HoH and MLDBM problems
Message-Id: <3F67A791.5090609@rochester.rr.com>

Tom wrote:

> I have been trying to get the following to work for weeks and it just does
> not.
> No data gets stored like this as long as it is tied via tie or dbmopen.
> 
> 
>>You can't store those data like that. When working with a tied hash, you
>>can only store something in the top-level and not somewhere nested
>>below. The above would have to read:
>>
>>    my %subhash;
>>    $subhash{ $_ } = 1 for qw/apple orange banana/;
>>    $db{ fruit } = \%subhash;
>>
>>
> 
> 
> Any clues?


Yes.  Look at the MLDBM module.  If the docs are mystifying, read the 
relevant recipies in Perl Cookbook, which has an excellent discussion. 
Recognize that the fundamental problem is that while a "regular" hash 
(not tied to a DBM-type file) can store any scalar value including a 
reference, a hash which is tied to a DBM-type file can only store one 
kind of thing:  a string.  MLDBM functions by automagically stringifying 
the item to be stored and unstringifying it when it is fetched.  It 
works fine, but you must bear in mind the fact that if you want to 
change something in the stored structure, you must retrieve the entire 
stored structure, make your modification to that, and then store the 
entire structure back again.

HTH.


 ...
> Tom

-- 
Bob Walton



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

Date: 16 Sep 2003 14:12:53 -0700
From: usenet@downlode.org (Earle Martin)
Subject: Re: how should i fix this??
Message-Id: <c0219326.0309161312.21e0d7f7@posting.google.com>

dejen321@yahoo.com (jend) wrote in message news:<cc028093.0309091727.7f2ddd71@posting.google.com>...
> I want it to come out like this:
> 
> >> 'Tom\'s','John\'s','Jim\'s','mike','blah','bloh'

You need two functions: join and s//. 

my @thoseLabels = qw(Tom's John's Jim's mike blah bloh);

my $thing = join(" ", @thoseLabels);

$thing =~ s/'/\\'/g;

print "$thing\n";

I would note that what you call $this_array is not an array, it is a string.


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

Date: 16 Sep 2003 14:22:42 -0700
From: usenet@downlode.org (Earle Martin)
Subject: Re: how should i fix this??
Message-Id: <c0219326.0309161322.34347f12@posting.google.com>

dejen321@yahoo.com (jend) wrote in message news:<cc028093.0309091727.7f2ddd71@posting.google.com>...
> However I want it to come out like this:
> 
> >> 'Tom\'s','John\'s','Jim\'s','mike','blah','bloh'

Of course I misread this the first time. Try again.

my @thoseLabels = qw(Tom's John's Jim's mike blah bloh);

foreach my $foo (@thoseLabels) {
        $foo =~ s/'/\\'/;
        $foo = "'$foo'";
}

my $thing = join(',', @thoseLabels);

print "$thing\n";


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

Date: 16 Sep 2003 15:51:30 -0700
From: zekekoos@softhome.net (Zeke Koos)
Subject: How to use different proxies for LWP::Parallel requests
Message-Id: <e579120b.0309161451.3987ae1a@posting.google.com>

How do I use a different proxy for each request when using
LWP::Parallel ?
I use the following subroutine to register the requests, but when I
call $ua->wait(20) all the requests go through the last proxy
registered.

Please help!

thanks
Koos


sub register_request {
my ($url,$proxy) = @_;
  $ua->max_hosts(25);
  $ua->agent('Mozilla/4.5');
  $ua->proxy('http', 'http://'.$proxy);
  my $req = HTTP::Request->new('GET', $url);  
 $ua->register ($req);
}


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

Date: Tue, 16 Sep 2003 11:48:46 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: kill command in a perl script
Message-Id: <160920031148469971%jgibson@mail.arc.nasa.gov>

In article <257137ea.0309160547.3d14a032@posting.google.com>, Hugh Kang
<skang@leaguedata.com> wrote:

> Jim Gibson <jgibson@mail.arc.nasa.gov> wrote in message
> news:<150920031752553144%jgibson@mail.arc.nasa.gov>...
> > In article <257137ea.0309150913.11f08d49@posting.google.com>, Hugh Kang
> > <skang@leaguedata.com> wrote:
> > 
> > > I just started learning Perl and I am trying to do followings;
> > > 
> > > ps -ef | grep java >pidfile
> > > In pidfile, there are 3 PIDs for weblogic processes.
> > > 
> > >     root  1769  1758   TS   0  0 17:55:26 vt02    44:38
> > > /opt/java2-1.3.1/bin/./../bin/x86at/native_threads/java -Xms512m
> > > -Xmx512m -Dweb
> > >     root 27464 27453   TS  29  0 09:15:55 vt04    91:55
> > > /opt/java2-1.3.1/bin/./../bin/x86at/native_threads/java -Xms1024m
> > > -Xmx1024m -Dw
> > >     root 27533 27522   TS  49  0 09:21:45 vt03     2:35
> > > /opt/java2-1.3.1/bin/./../bin/x86at/native_threads/java -Xms32m
> > > -Xmx200m -Dwebl
> > > 
> > > What I want is get the largest PID which is 27533 in this case, and
> > > then
> > > kill -3 the PID.
> > > 
> > > So I made a simple one for this:
> > > 
> > > #!/usr/bin/perl 
> > > #
> > > #            This is a test script to get wls managed server pid
> > > #
> > > #
> > > open(JAVAPIDS,"pidfile") or die "can't open input file:$!\n";
> > > $pidcnt=0;
> > > while($line=<JAVAPIDS>) {
> > > #  
> > >
> > > ($user,$pid1,$pid2,$it4,$it5,$it6,$it7,$it8,$it9,$it10,$it11,$it12,$it13,$
> > > it14,
> > > $it15)=split("
> > > ",$line);
> > 
> > The above line is unnecessary because of the following line.
> > 
> > >    ($user,$pid1)=split(" ",$line);
> > >    $pidfile{$pid1}=$pid1;
> > >    $pid_comp[$pidcnt]=$pidfile{$pid1};
> > > #   print "pid$pidcnt : $pid_comp[$pidcnt] \n";
> > >    if ($pidcnt gt 0) {  
> > >        if ($pid_comp[0] < $pid_comp[$pidcnt]) {
> > >              $pid_comp[0] = $pid_comp[$pidcnt];
> > >       }
> > >    }
> > >    $pidcnt++;
> > > 
> > > }
> > > print "pidcnt : $pidcnt \n";
> > > print "Largest PID for java is : $pid_comp[0] \n";   
> > > 
> > > ------------------------------------------
> > > 
> > > Q1) How do I do 'kill -3 $pid_comp[0] in this script?
> > 
> >    kill 3, $pid_comp[0]
> > 
> > See 'perldoc -f kill'
> > 
> > > Q2) Is there any way that I can do the followings:
> > > 
> > > In a Unix script,
> > > 
> > > ps -ef |grep java >pidfile
> > > 
> > > ./perl_script
> > > ...
> > > ...
> > > kill -3 $pid_comp[0]
> > 
> > Not easily, and not necessary because of answer to 1.
> > 
> > > 
> > > 
> > > Q3) Any other way to get what I want?
> > 
> > Yes. You can get the filtered output of the ps command using backtics:
> > 
> > [tested in part ("No processes were actually killed in the development
> > of this program")]
> > 
> > #!/opt/perl/bin/perl
> > 
> > use strict;
> > use warnings;
> > 
> > my @lines = `ps -ef|grep java`;  # <--notice backtics, not single quotes
> > my @pids = ();
> > foreach ( @lines) {
> >   my ($user,$pid) = split;
> >   push(@pids,$pid);
> > }
> > my $largest = ((sort(@pids)))[$#pids];
> > kill 3, $largest;
> > 
> > [end program]
> > 
> > > 
> > > 
> > > Can anyone help me out with this issue please?
> > 
> > Hope I have.
> > 
> > > 
> > > Many thanks in advance!
> > > 
> > > Hugh
> 
> 
> 
> Thanks a lot. I have three more things to ask please.
> 
> q1) When I do my @lines = `ps -ef | grep java`;, pid for "grep java" from ps
> -ef
> is included in @lines. I'd like to exclude this one. How do I do that?
> When I do, ps -ef | grep java > pidfile on Unix shell, I don't see the pid 
> for 'grep java' in pidfile.

You can filter out the grep process with
   @lines = `ps -ef | grep java | grep -v grep'
or you can skip it in the loop:
   if( /grep/ ) {
      # skip this line
   }else{
      my ($user,$pid) = split;
      ...
or make that a one-liner:
   push(@pids,(split)[2]) unless /grep/;

> 
> q2) Later I'd like to check the 11th column which can be "-Xms1024m" and issue
> kill -3 $pid if it is "-Xms1024m". How do I check it using the above script? 
> 

You can extract the 11th column with $it11 = (split)[11]; or just check
for the presence of the '-Xms1024m' anywhere in the line with if(
/-Xms1024m/) {...]; or put back all of the other column variables in
the split: ($user,$pid1,$pid2,$it4...,$it11) = split;

> q3) kill -3 $pid is not killing the process. It makes a thread dump for
> weblogic
> server. In Unix script, I check an error from log file and want to take a 
> thread dump using the perl script when the error occurs. How can I run the perl 
> script in Unix script? Or any other way to do this?

Read the log file within the Perl program and check for the error. If
you have a program to check the log file that returns an exit value,
run the program with the system function and capture the return value
(a little tricky -- see perldoc -f system).

> 
> I just ordered Perl manuals to study and practice more. 
> 
> Thanks again.
> 
> Hugh


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

Date: Tue, 16 Sep 2003 19:48:02 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: kill command in a perl script
Message-Id: <3F6768ED.AA8ACA66@acm.org>

Hugh Kang wrote:
> 
> q1) When I do my @lines = `ps -ef | grep java`;, pid for "grep java" from ps -ef
> is included in @lines. I'd like to exclude this one. How do I do that?
> When I do, ps -ef | grep java > pidfile on Unix shell, I don't see the pid
> for 'grep java' in pidfile.

my @lines = grep /java/, `ps -ef`;

Or if you just want the PIDs and have the appropriate version of ps or
pgrep:

my @pids = `ps h -C java -o pid`;

my @pids = `pgrep java`;


> q2) Later I'd like to check the 11th column which can be "-Xms1024m" and issue
> kill -3 $pid if it is "-Xms1024m". How do I check it using the above script?

My version of "ps -ef" doesn't have eleven columns

kill 'QUIT', grep { /-Xms1024m/ and $_ = (split)[0] } `ps h -C java -o
pid,command`;


> q3) kill -3 $pid is not killing the process.

You do realise that using a negative number with kill is different then
using a positive number.

perldoc -f kill
[snip]
               Unlike in the shell, if SIGNAL is negative, it
               kills process groups instead of processes.  (On
               System V, a negative PROCESS number will also kill
               process groups, but that's not portable.)  That
               means you usually want to use positive not
               negative signals.  You may also use a signal name
               in quotes.  See the Signals entry in the perlipc
               manpage for details.



John
-- 
use Perl;
program
fulfillment


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

Date: Tue, 16 Sep 2003 20:53:13 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: kill command in a perl script
Message-Id: <4nisnss0au.fsf@lockgroove.bwh.harvard.edu>

[lots of awkward ps -ef gymnastics omitted]

Good god, guys, why are you stubbornly trying to reinvent the wheel?
I mean, it's fun to do it sometimes, but Hugh (a new Perl programmer)
should absolutely not be trying to manually parse the output of 
ps -ef, creating a nonportable script with weird bugs (what happens
if "grep" is in the process name you want, for instance?  what happens
on systems where ps -ef does not do what you think it does?)

Please use Proc::ProcessTable from CPAN.  It will save you time and
lots of headaches.

Ted


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

Date: Tue, 16 Sep 2003 21:48:03 GMT
From: "Sam" <samj@austarmetro.com.au>
Subject: locatime()
Message-Id: <3f678512$1@news.comindico.com.au>

hello
I have a date array, I need to identify those dates which are Saturdays and
Sundays. I think part of my problem is that I don't know how to search the
documentations that came with perl5.6 in my Linux box. so I you could give
some direction on how to do that tasks I am grateful

thanks




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

Date: 16 Sep 2003 22:09:47 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: Re: locatime()
Message-Id: <bk81nb$op4@dispatch.concentric.net>


"Sam" <samj@austarmetro.com.au> wrote in message
news:3f678512$1@news.comindico.com.au...
> hello
> I have a date array, I need to identify those dates which are Saturdays
and
> Sundays.

Install the Date::Calc module from CPAN and use something like the
Day_of_Week() function.

I think part of my problem is that I don't know how to search the
> documentations that came with perl5.6 in my Linux box. so I you could give
> some direction on how to do that tasks I am grateful
>
perldoc -q date
# but since Date::Calc is not standard, this won't answer your specific
question.  Nonetheless, this is the general approach for querying the docs.




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

Date: Tue, 16 Sep 2003 11:00:43 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Pattern Matching in file with invisible char
Message-Id: <slrnbmectb.4jq.tadmc@magna.augustmail.com>

M Pires <MIGUEL.PIRES@PORTUGALMAIL.PT> wrote:

> I am currently working on a Perl script that will parse out values from an
> "almost" text file.  


Then it is a binary file.


> The reason I say this is because there are "invisible"
> chars in the file such as the ASCII SUB char ( 0x1A ). This chars confuse
> the <HANDLE> and cause a premature EOF.


Since we are concerned with files, it might be helpful to know what
OS is being used, as the operating system is what manages the filesystem.


> Is there a way around this?


   perldoc -f binmode


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 16 Sep 2003 10:36:03 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Perl way to do PHP includes?
Message-Id: <etor82gvggc.fsf@wormtongue.emschwar>

Garry Heaton <none@none.com> writes:
> Garry Heaton wrote:
>> Sorry, should have followed-up:
>> 
>> 2. open FILE, "< $perl_file";
>>    while (<FILE>) {
>>       print;
>>    };
>> 
>> Garry
>> 
>
> Or maybe even:
>
> 2. open FILE, "< $perl_file";
>      while (<FILE>) {
>         print;
>      }

These are still completely different from include('file.php') in PHP.
It might not hurt to read the PHP docs to understand what include()
does, and why it's not the same thing as what you just printed above.

-=Eric
-- 
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
		-- Blair Houghton.


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

Date: Tue, 16 Sep 2003 18:01:17 -0400
From: "Harshavardhan" <hvardhan@ee.duke.edu>
Subject: Socket troubles
Message-Id: <bk812p$o0h$1@gargoyle.oit.duke.edu>

Hi,

        I am trying to create two sender and listener sockets using perl.

***************
Listener.pl
***************

#! /usr/bin/perl

use IO::Socket;
$sock = new IO::Socket::INET ( LocalHost => 'localhost',
                                                 Local Port => 1200,
                                                 Proto = 'tcp',
                                                 Listen = 5,
                                                 Reuse = 1);

die "Socket could not be created. Reason: $!" unless $sock;

while ( $new_sock = $sock->accept() ) {
            while (defined ($buf = <$sock>)) {
                print $buf;
        }
}

close ($sock)

***********************
Sender.pl
***********************

#! /usr/bin/perl

use IO::Socket;
$sock = new IO::Socket::INET ( PeerAddr => 'localhost',
                                                 PeerPort => 1200,
                                                 Proto = 'tcp',
                                                 );

die "Socket could not be created. Reason: $!" unless $sock;

foreach (1 .. 10) {
                           print $sock "Msg $_: How are you? \n";
}

close ($sock)

***********************

When run the Listener, it waits for new connections, but when I run the
sender.pl, it just finishes without any output at the listener. I get no
error messages.

Any ideas on whats happening?

Thanks
harsha

when I run hostname on my computer, it returns localhost.localdomain. I am
running both the sender and the listener on my computer. I am using Perl
5.8.0






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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

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

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 V10 Issue 5513
***************************************


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