[29364] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 608 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 2 00:09:57 2007

Date: Sun, 1 Jul 2007 21:09:05 -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           Sun, 1 Jul 2007     Volume: 11 Number: 608

Today's topics:
        Asynchronous forking(?) processes on Windows <tbrazil@perforce.com>
    Re: Asynchronous forking(?) processes on Windows xhoster@gmail.com
        fork and pipe - problem prone <dontwannabe@spammed.com>
    Re: fork and pipe - problem prone xhoster@gmail.com
    Re: fork and pipe - problem prone <uri@stemsystems.com>
    Re: install of perl 5.8.8  rogv24@yahoo.com
    Re: install of perl 5.8.8 <mark.clementsREMOVETHIS@wanadoo.fr>
    Re: install of perl 5.8.8  rogv24@yahoo.com
    Re: Many threads working constantly xhoster@gmail.com
    Re: Portable general timestamp format, not 2038-limited <wlfraed@ix.netcom.com>
    Re: Portable general timestamp format, not 2038-limited <martin@see.sig.for.address>
    Re: Portable general timestamp format, not 2038-limited <http://phr.cx@NOSPAM.invalid>
    Re: Portable general timestamp format, not 2038-limited <bignose+hates-spam@benfinney.id.au>
    Re: The $a have any special meanning ? <stoupa@practisoft.cz>
        Unlocking and reenabling a local account on multiple ma <shmh@bigpond.net.au>
    Re: unlurking <invalid@invalid.nyet>
    Re: unlurking <tadmc@seesig.invalid>
    Re: unlurking <invalid@invalid.nyet>
    Re: unlurking <tadmc@seesig.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 01 Jul 2007 19:04:03 -0700
From:  Tim <tbrazil@perforce.com>
Subject: Asynchronous forking(?) processes on Windows
Message-Id: <1183341843.332677.114410@a26g2000pre.googlegroups.com>

O.K., I'm starting to lose it. I've read a lot of threads on this list
regarding forking processes on Windows. I'm still having problems even
with the info I have found. I'm asking for some direction.

I am trying to spawn several children processes and execute a the same
command on each child. I want to reap (read) the results of each of
these children and wait for each to end in their own order. The
command I am executing can potentially sent out a lot of output. I
execute the command using backticks (`) in order to get the output.

The following perl code will work to a certain extent on *NIX platorms
but will lockup / hang on Windows (XP to be specific). It appears to
have the problem with the pipe but I'm not entirely sure what's going
on. I am using the latest Acitvestate perl.

Bottom line... does anyone have a chunk of perl that demonstrates what
I'm trying to do but may be more robust in the Windows environment. If
you can help me figure this out I will sing your praises while dancing
in my cube. Thanks - Tim

### snippet that need rewriting / robustifying  ###

$cmd = "p4 -p  mymachine.com:50720  -c client3  info";

my $nchildren = 7;
my ($active, $ichild, $pid, @rfhs, $rfh);

$active = 0;
for( $ichild = $nchildren; $ichild > 0; $ichild-- )
{
        pipe RFH, WFH;

        if( $pid = fork ) {
            print "Forked pid $pid.\n";
            open $rfhs{ $pid }, "<&RFH";
            close WFH;
            $active++;
        } elsif( defined $pid ) {
            close RFH;
            print WFH `$cmd 2>&1`;
            close WFH;
            exit;
        } else {
            print "fork failed!\n";
            exit 1;
        }
}

while( $active > 0 ) {
        $pid = wait;
        $rfh = $rfhs{ $pid };
        print "\n$pid completed. It's output is:\n", <$rfh>;
        close $rfh;
        $active--;
}



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

Date: 02 Jul 2007 02:52:21 GMT
From: xhoster@gmail.com
Subject: Re: Asynchronous forking(?) processes on Windows
Message-Id: <20070701225225.013$RW@newsreader.com>

Tim <tbrazil@perforce.com> wrote:
> O.K., I'm starting to lose it. I've read a lot of threads on this list
> regarding forking processes on Windows. I'm still having problems even
> with the info I have found. I'm asking for some direction.
>
> I am trying to spawn several children processes and execute a the same
> command on each child. I want to reap (read) the results of each of
> these children and wait for each to end in their own order. The
> command I am executing can potentially sent out a lot of output. I
> execute the command using backticks (`) in order to get the output.
>
> The following perl code will work to a certain extent on *NIX platorms

I suspect this is simply because your code hasn't reached the point of
deadlock on those platforms.  On my linux system, that point is reached
when the output of any one process exceeds 4096 bytes.  So I'll assume
the problem is the same on windows, only the size limit is different...


> for( $ichild = $nchildren; $ichild > 0; $ichild-- )
> {
>         pipe RFH, WFH;
>
>         if( $pid = fork ) {
>             print "Forked pid $pid.\n";
>             open $rfhs{ $pid }, "<&RFH";

I think it would be better just to use lexicals, then use a simple
assignment rather than a dup.

>             close WFH;
>             $active++;
>         } elsif( defined $pid ) {
>             close RFH;
>             print WFH `$cmd 2>&1`;
>             close WFH;
>             exit;

So here, the child refuses to exit until the print and close has been
completed.  Unless the thing to be printed fits into a single OS buffer,
the print will not finish, and it will not exit, until the other side of
the pipe has started reading.


> while( $active > 0 ) {
>         $pid = wait;

And here, the parent refuses to start reading until after the child has
exited. Bam! Deadlock.

If I replace those two lines with:

foreach my $pid(keys %rfhs) {

then things work as they should.  (It is not guaranteed to read from
the processes in the order in which they "finish", but that doesn't seem to
matter for the current case.)

>         $rfh = $rfhs{ $pid };
>         print "\n$pid completed. It's output is:\n", <$rfh>;
>         close $rfh;
>         $active--;
> }

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Mon, 02 Jul 2007 01:21:08 +0200
From: theater <dontwannabe@spammed.com>
Subject: fork and pipe - problem prone
Message-Id: <468836d1$0$25906$426a34cc@news.free.fr>

Hello,

When you fork() you'd like your child to be able to communicate with the 
father, and vice versa. This has usually been handled with the help of 
pipe() and this is also usually prone to troubles...
Such as this one:

I only want to kid to talk to daddy, not the other way round.
I create the pipe.
Then I have a loop , each iteration will create a new child.
Here's a snippet: (lots of error checking omitted here for the sake of 
simplicity)

pipe(READHANDLE, WRITEHANDLE);
foreach $myKid (  @childrenList ) {
	$pid = fork();
	if($pid == 0) {
		# I am the kid
		# I close the reading end of the pipe
		close(READHANDLE);
		# and then I do y stuff and exit
		exit;
	}
	else {
		# I am the father, yes i know i should check for error, 			# but this 
is just an example
		# i do my stuff here
	}
}

--> the problem is:
1/ if i leave it like above, some of the kids will be stuck... They just 
don't exit().  It's not a resource problem because in reality i control 
the number of simultaneous children.
And I have a print() statement just before exit()ing and I can see it 
when debugging.
First of all I'm clueless about why this happens, but...

2/ if I close() the WRITEHANDLE end of the pipe in the father's section, 
then I have absolutely no deadlock problem anymore BUT I won't be able 
to get the other children to write anymore as they inherit from the 
father, and after the 1st child this handle will be closed...


This seems to be quite common but in the case of a loop I have not seen 
any solutions / fix.

Thanks for sharing your thoughts on this matter.



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

Date: 02 Jul 2007 00:33:21 GMT
From: xhoster@gmail.com
Subject: Re: fork and pipe - problem prone
Message-Id: <20070701203324.186$hn@newsreader.com>

theater <dontwannabe@spammed.com> wrote:
> Hello,
>
> When you fork() you'd like your child to be able to communicate with the
> father, and vice versa. This has usually been handled with the help of
> pipe() and this is also usually prone to troubles...
> Such as this one:
>
> I only want to kid to talk to daddy, not the other way round.
> I create the pipe.
> Then I have a loop , each iteration will create a new child.
> Here's a snippet: (lots of error checking omitted here for the sake of
> simplicity)

As Einstein may have said, "Make everything as simple as possible, *but not
simpler*."

>
> pipe(READHANDLE, WRITEHANDLE);

You should probably use lexical file filehandles.

> foreach $myKid (  @childrenList ) {
>         $pid = fork();
>         if($pid == 0) {
>                 # I am the kid
>                 # I close the reading end of the pipe
>                 close(READHANDLE);
>                 # and then I do y stuff and exit
>                 exit;
>         }
>         else {
>                 # I am the father, yes i know i should check for error,
> # but this is just an example
>                 # i do my stuff here
>         }
> }
>
> --> the problem is:
> 1/ if i leave it like above, some of the kids will be stuck... They just
> don't exit().

Your example code does not exhibit this problem.  That makes it nearly
useless as an example.


> It's not a resource problem because in reality i control
> the number of simultaneous children.
> And I have a print() statement just before exit()ing and I can see it
> when debugging.

Do you know that the child that you see invoking the print is the same
child that "hangs"?

> First of all I'm clueless about why this happens, but...
>
> 2/ if I close() the WRITEHANDLE end of the pipe in the father's section,

Inside the loop or after the loop?

> then I have absolutely no deadlock problem anymore BUT I won't be able
> to get the other children to write anymore as they inherit from the
> father, and after the 1st child this handle will be closed...
>
> This seems to be quite common but in the case of a loop I have not seen
> any solutions / fix.

Without seeing any examples of how you actually use the filehandles, it is
hard to say.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Mon, 02 Jul 2007 03:31:25 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: fork and pipe - problem prone
Message-Id: <x76453zdkh.fsf@mail.sysarch.com>

>>>>> "t" == theater  <dontwannabe@spammed.com> writes:

  t> I only want to kid to talk to daddy, not the other way round.  I
  t> create the pipe.  Then I have a loop , each iteration will create a
  t> new child.  Here's a snippet: (lots of error checking omitted here
  t> for the sake of simplicity)

  t> pipe(READHANDLE, WRITEHANDLE);

that pair of handles is the same in the parent and all the children. you
need a fresh pipe with fresh handles for each child. allocate handles
with IO::Handle or Symbol::gensym. or use a module (many to choose from)
that does this for you.

  t> foreach $myKid (  @childrenList ) {
  t> 	$pid = fork();
  t> 	if($pid == 0) {
  t> 		# I am the kid
  t> 		# I close the reading end of the pipe
  t> 		close(READHANDLE);
  t> 		# and then I do y stuff and exit

and if the handle is closed by another child, it will never do
anything. hang.

and i suspect many other problems as well since managing forked children
and pipes isn't as simple as you think it is. again, use a module
designed to do this for you.

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


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

Date: Sun, 01 Jul 2007 13:58:48 -0700
From:  rogv24@yahoo.com
Subject: Re: install of perl 5.8.8
Message-Id: <1183323528.249885.318760@k29g2000hsd.googlegroups.com>

On Jul 1, 11:29 am, Mark Clements <mark.clementsREMOVET...@wanadoo.fr>
wrote:
> rog...@yahoo.com wrote:
>
> >      I have never installed Perl.  I downloaded 5.8.8 into solaris 10
> > server.
> >      Is there an eaaasy instruction for installation.  There is
> > already v.5.8.4 installed.
>
> >      thanks
>
> You can avoid the compilation stage by downloading a Solaris package from
>
> http://www.sunfreeware.com/
>
> eg
>
> http://www.sunfreeware.com/programlistsparc10.html#perl
>
> Mark

hello Mark,

So when I downloaded from sunfreeware and install the software, I
would have just to point to perl?



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

Date: Sun, 01 Jul 2007 23:21:47 +0200
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: install of perl 5.8.8
Message-Id: <46881ae7$0$5081$ba4acef3@news.orange.fr>

rogv24@yahoo.com wrote:
> On Jul 1, 11:29 am, Mark Clements <mark.clementsREMOVET...@wanadoo.fr>
> wrote:
>> rog...@yahoo.com wrote:
>>
>>>      I have never installed Perl.  I downloaded 5.8.8 into solaris 10
>>> server.
>>>      Is there an eaaasy instruction for installation.  There is
>>> already v.5.8.4 installed.
>>>      thanks
>> You can avoid the compilation stage by downloading a Solaris package from
>>
>> http://www.sunfreeware.com/
>>
>> eg
>>
>> http://www.sunfreeware.com/programlistsparc10.html#perl
>>
>> Mark
> 
> hello Mark,
> 
> So when I downloaded from sunfreeware and install the software, I
> would have just to point to perl?
> 
Pretty much. The relevant page says

**
The Perl Language System - installs in /usr/local.  Important Note - 
Solaris comes with a its own version of perl in /usr/bin. You may wish 
to use this version rather than the version on sunfreeware.com. If you 
do install this perl and want to use it rather than the Sun one, you 
will need to have /usr/local/bin in your PATH before /usr/bin.
**

Your scripts containing a #! line will need to refer to the perl 
installed in /usr/local/bin/perl rather than the perl in /usr/bin, the 
version of which will vary with Solaris version and possibly maintenance 
release (is a while since I've had a Solaris box to play with).

Mark


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

Date: Sun, 01 Jul 2007 15:05:58 -0700
From:  rogv24@yahoo.com
Subject: Re: install of perl 5.8.8
Message-Id: <1183327558.699913.253920@o61g2000hsh.googlegroups.com>

On Jul 1, 5:21 pm, Mark Clements <mark.clementsREMOVET...@wanadoo.fr>
wrote:
> rog...@yahoo.com wrote:
> > On Jul 1, 11:29 am, Mark Clements <mark.clementsREMOVET...@wanadoo.fr>
> > wrote:
> >> rog...@yahoo.com wrote:
>
> >>>      I have never installed Perl.  I downloaded 5.8.8 into solaris 10
> >>> server.
> >>>      Is there an eaaasy instruction for installation.  There is
> >>> already v.5.8.4 installed.
> >>>      thanks
> >> You can avoid the compilation stage by downloading a Solaris package from
>
> >>http://www.sunfreeware.com/
>
> >> eg
>
> >>http://www.sunfreeware.com/programlistsparc10.html#perl
>
> >> Mark
>
> > hello Mark,
>
> > So when I downloaded from sunfreeware and install the software, I
> > would have just to point to perl?
>
> Pretty much. The relevant page says
>
> **
> The Perl Language System - installs in /usr/local.  Important Note -
> Solaris comes with a its own version of perl in /usr/bin. You may wish
> to use this version rather than the version on sunfreeware.com. If you
> do install this perl and want to use it rather than the Sun one, you
> will need to have /usr/local/bin in your PATH before /usr/bin.
> **
>
> Your scripts containing a #! line will need to refer to the perl
> installed in /usr/local/bin/perl rather than the perl in /usr/bin, the
> version of which will vary with Solaris version and possibly maintenance
> release (is a while since I've had a Solaris box to play with).
>
> Mark- Hide quoted text -
>
> - Show quoted text -

Thank you for your help



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

Date: 02 Jul 2007 01:18:33 GMT
From: xhoster@gmail.com
Subject: Re: Many threads working constantly
Message-Id: <20070701211837.207$7z@newsreader.com>

ziemo <pziem@go2.pl> wrote:
> Hello,
>
> I need to create 10 threads. When one of them finished work, the next
> thread will be start.

It is generally better to start your threads up front, and then have them
loop through jobs (like in a Thread::Queue), rather than constantly ending
threads and staring new ones.  (Well, I'd argue it generally better, in
Perl, just not to use threads in the first place, but...)

> I have a problem with memory leak. After couple minute my RAM is full.
> Could someone suggest where is the problem or how I can solve my
> problem with another method?

What version are you using?  Perl 5.8.0 had a lot of problems with
memory leaks and threads. In 5.8.3, I don't see any leaks in the code you
provided.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Sun, 01 Jul 2007 22:20:10 GMT
From: Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <uMVhi.2678$rR.2655@newsread2.news.pas.earthlink.net>

On 01 Jul 2007 11:57:30 -0700, Paul Rubin <http://phr.cx@NOSPAM.invalid>
declaimed the following in comp.lang.python:

> Martin Gregorie <martin@see.sig.for.address> writes:
> > GPS time is UTC time 
> 
> According to Wikipedia, 
> 
>     While most clocks are synchronized to Coordinated Universal Time
>     (UTC), the Atomic clocks on the satellites are set to GPS time. The
>     difference is that GPS time is not corrected to match the rotation of
>     the Earth, so it does not contain leap seconds or other corrections
>     which are periodically added to UTC. GPS time was set to match
>     Coordinated Universal Time (UTC) in 1980, but has since diverged. The
>     lack of corrections means that GPS time remains at a constant offset
>     (19 seconds) with International Atomic Time (TAI).
>

	What is not mentioned is that, as part of the data stream picked up
by GPS receivers, is a term specifying the "correction factor" between
GPS and UTC; so receivers can display UTC time.
-- 
	Wulfraed	Dennis Lee Bieber		KD6MOG
	wlfraed@ix.netcom.com		wulfraed@bestiaria.com
		HTTP://wlfraed.home.netcom.com/
	(Bestiaria Support Staff:		web-asst@bestiaria.com)
		HTTP://www.bestiaria.com/


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

Date: Sun, 01 Jul 2007 23:36:00 +0100
From: Martin Gregorie <martin@see.sig.for.address>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <nrmll4-45b.ln1@zoogz.gregorie.org>

Roedy Green wrote:
> On Sun, 01 Jul 2007 17:47:36 +0100, Martin Gregorie
> <martin@see.sig.for.address> wrote, quoted or indirectly quoted
> someone who said :
> 
>> GPS time is UTC time and I'd assume the same is true for Loran.
> 
> not according to this site that has clocks running on all three.
> They are out slightly.
>  
> http://www.leapsecond.com/java/gpsclock.htm
 >
A useful reference: thanks. Interesting that GPS and Loran are slightly 
out from Zulu. I'll ask round and see if this is something that ATP 
pilots are aware of: as a glider pilot and GPS user I'd never heard of 
it. So far the deviations from UTC are probably not enough to affect 
navigation significantly, but I wonder if banks using networks that 
timestamp transactions with GPS time know about it. Of course the 
deviation can't affect disputes where the timestamps are being used to 
decide event sequences within a single network. However, there could be 
legal implications if absolute time is important or if the timestamps 
are being compared across different networks, e.g SWIFT vs CHAPS or Fedwire.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |


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

Date: 01 Jul 2007 16:48:42 -0700
From: Paul Rubin <http://phr.cx@NOSPAM.invalid>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <7xd4zbd6sl.fsf@ruckus.brouhaha.com>

Dennis Lee Bieber <wlfraed@ix.netcom.com> writes:
> 	What is not mentioned is that, as part of the data stream picked up
> by GPS receivers, is a term specifying the "correction factor" between
> GPS and UTC; so receivers can display UTC time.

Oh yes, good point, the article ought to mention that.


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

Date: Mon, 02 Jul 2007 10:30:43 +1000
From: Ben Finney <bignose+hates-spam@benfinney.id.au>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <87ir93pryk.fsf@benfinney.id.au>

Martin Gregorie <martin@see.sig.for.address> writes:

> I've never seen Julian time used outside the world of IBM
> mainframes. I'd be interested to know who else uses it.

Systems which need to perform date+time computations into the
past. One advantage of Julian time is that it ignores the "1 BC was
immediately followed by 1 AD, there is no 0 AD" hiccup, so Julian time
allows dates to use simple arithmetic to determine the interval.

I know that PostgreSQL at least stores date values in Julian time, for
exactly this benefit.

-- 
 \      "My roommate got a pet elephant. Then it got lost. It's in the |
  `\                           apartment somewhere."  -- Steven Wright |
_o__)                                                                  |
Ben Finney


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

Date: Mon, 2 Jul 2007 04:31:56 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: The $a have any special meanning ?
Message-Id: <f69o3t$1p2a$1@ns.felk.cvut.cz>

Tad McClellan wrote:
> Petr Vileta <stoupa@practisoft.cz> wrote:
>> I use 5.6.1
>
heh, I expected this ;-)

> A lot has happened in the last 6 years.
>
Yes, I know but Perl 5.8.0 looked as any version of Windows - it is stable 
and usable 2-3 years after releasing :-) Windows98 was be usable in year 
2000, WinXP was be usable in year 2005, Windows Vista will be usable in year 
2009? And Perl 5.8.x ? Yes, version 5.8.8 is usable with small problems and 
version 5.8.10 will be stable as 5.6.1 is now :-)

-- 

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail 
from another non-spammer site please.)




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

Date: Mon, 02 Jul 2007 03:48:55 GMT
From: "Simon" <shmh@bigpond.net.au>
Subject: Unlocking and reenabling a local account on multiple machines
Message-Id: <HA_hi.1999$4A1.1692@news-server.bigpond.net.au>

Hi guys!
Hope you can help.

I have a file containing a list of computer names.

Each computer has a local account called "admin01".
Through perl, Id like to check to see if the account is disabled, and locked 
out, and if so, to unlock the account and reenable it.

I know how to write the script for connecting to machines and 
authenticating, but getting stuck on the reenabling and unlocking the 
accounts.

Thanks for any help.

S





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

Date: Sun, 1 Jul 2007 16:52:42 -0400
From: "Wade Ward" <invalid@invalid.nyet>
Subject: Re: unlurking
Message-Id: <4bCdncNJf7XLiRXbnZ2dnUVZ_sSmnZ2d@comcast.com>


"John Mason Jr" <notvalid@cox.net.invalid> wrote in message 
news:138g2bj4v0dm579@news.supernews.com...
> Wade Ward wrote:
>> "Scott Bryce" <sbryce@scottbryce.com> wrote in message
>> news:sKudnR-Nm_42uhrbnZ2dnUVZ_v-tnZ2d@comcast.com...
>>> <code snipped>
>>>
>>> Wade Ward wrote:
>>>
>>>> A cursory view would lead me to believe that that's darn close.  Now I
>>>> have to embarrass myself by bringing up my failures in understanding,
>>>> categorically.  Best to sleep on it.
>>> Even better to read the docs for Net::NNTP. In the morning, perhaps?
>>>
>>> http://search.cpan.org/~gbarr/libnet-1.21/Net/NNTP.pm
>> I added it to my perl favorites and will try to hit it this evening.  I
>> named the following script perl1.pl and placed it in the bin with 
>> perl.exe :
>>
>>
>> #!/usr/bin/env perl
>> use strict;
>> use warnings;
>> use Net::NNTP;
>>
>> my $nntp = Net::NNTP->new('news.example.com', { Debug
>>
>> => 1} );
>>
>> $nntp->group('comp.lang.perl.misc')
>>    or die "failed to set group c.l.p.m.\n";
>> my $msg_ids_ref = $nntp->newnews(time() - 24*60*60);
>> die "Failed to retrieve message ids\n" unless
>>
>> @{$msg_ids_ref};
>>
>> open my $ofh, '>', 'articles.txt'
>>    or die "Cannot open articles.txt: $!";
>> for my $msg_id (@{$msg_ids_ref}) {
>>    $nntp->article($msg_id, $ofh)
>>       or die "Failed to retrieve article $msg_id\n";
>> }
>> close $ofh;
>> __END__
>> # end script
>> When I get the dos prompt to the appropriate place I type:
>>  perl perl1.pl
>> , and get:
>> Can't call method "group" on an undefined value at perl1.pl line 10 .
>> Making matters worse, I can't seem to redirect the output stream using 
>> the
>> usual >text3.txt .  Ideas?
>> --
>> Wade Ward
>>
>>
>
> If you want both STDOUT & STDERR in the same file try >filename 2>&1
>
> Did you change
> my $nntp = Net::NNTP->new('news.example.com', { Debug=> => 1} );
>
> to have the name or ip address of your nntp server?
Nope.  I thought I was being Superman to get the script to perl.exe.  I was 
also unsure whether __END__ was part of the script or a way of saying "stop 
snipping here" on a usenet message.  I am still correct that the hash 
character is how to comment in perl, somehow with the complete exception of 
the first line?
--
WW 




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

Date: Sun, 1 Jul 2007 19:07:29 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: unlurking
Message-Id: <slrnf8gge1.4s6.tadmc@tadmc30.sbcglobal.net>


[ Please trim the amount of quoted text to just enough to establish
  context for what your followup is going to say.
]


Wade Ward <invalid@invalid.nyet> wrote:
> "John Mason Jr" <notvalid@cox.net.invalid> wrote in message 
> news:138g2bj4v0dm579@news.supernews.com...

[ snip 55 lines not necessary for context ]

>> Did you change
>> my $nntp = Net::NNTP->new('news.example.com', { Debug=> => 1} );
>>
>> to have the name or ip address of your nntp server?
> Nope.  


Then there's your problem. You must have access to an NNTP server
to use the NNTP module.


> I was 
> also unsure whether __END__ was part of the script or a way of saying "stop 
> snipping here" on a usenet message.  


It can be both.

It tells the perl interpreter to ignore anything below it.

    perldoc perldata


> I am still correct that the hash 
> character is how to comment in perl, 


Yes. But please don't use the newsgroup as a read-the-docs-to-me
service in the future.

The documentation for Perl's syntax is in:

   perldoc perlsyn


> somehow with the complete exception of 
> the first line?


No, the first line is also a comment to perl.

The shebang line is used by *nix to indicate what program to feed
the rest of the file to, rather than using the filename extension
as on a more common "operating system".


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Sun, 1 Jul 2007 21:39:19 -0400
From: "Wade Ward" <invalid@invalid.nyet>
Subject: Re: unlurking
Message-Id: <RYudneUZ0eEeyhXbnZ2dnUVZ_oOknZ2d@comcast.com>


"Tad McClellan" <tadmc@seesig.invalid> wrote in message 
news:slrnf8gge1.4s6.tadmc@tadmc30.sbcglobal.net...
>
> [ Please trim the amount of quoted text to just enough to establish
>  context for what your followup is going to say.
> ]
>
>
> Wade Ward <invalid@invalid.nyet> wrote:
>> "John Mason Jr" <notvalid@cox.net.invalid> wrote in message
>> news:138g2bj4v0dm579@news.supernews.com...
>
> [ snip 55 lines not necessary for context ]
I didn't imagine to have editorial privileges in a forum where I count as 
outsider.

>>> Did you change
>>> my $nntp = Net::NNTP->new('news.example.com', { Debug=> => 1} );
>>>
>>> to have the name or ip address of your nntp server?
>> Nope.
>
>
> Then there's your problem. You must have access to an NNTP server
> to use the NNTP module.
>
>
>> I was
>> also unsure whether __END__ was part of the script or a way of saying 
>> "stop
>> snipping here" on a usenet message.
>
>
> It can be both.
>
> It tells the perl interpreter to ignore anything below it.
>
>    perldoc perldata
>
>
>> I am still correct that the hash
>> character is how to comment in perl,
>
>
> Yes. But please don't use the newsgroup as a read-the-docs-to-me
> service in the future.
>
> The documentation for Perl's syntax is in:
>
>   perldoc perlsyn
>
>
>> somehow with the complete exception of
>> the first line?
>
>
> No, the first line is also a comment to perl.
>
> The shebang line is used by *nix to indicate what program to feed
> the rest of the file to, rather than using the filename extension
> as on a more common "operating system".
Clearly, the next thing on my plate is to actually read the NNTP stuff I 
said I would this morning.  Thanks for your help.
--
WW 




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

Date: Sun, 1 Jul 2007 21:40:24 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: unlurking
Message-Id: <slrnf8gpco.6et.tadmc@tadmc30.sbcglobal.net>

Wade Ward <invalid@invalid.nyet> wrote:
>
> "Tad McClellan" <tadmc@seesig.invalid> wrote in message 
> news:slrnf8gge1.4s6.tadmc@tadmc30.sbcglobal.net...
>> Wade Ward <invalid@invalid.nyet> wrote:
>>> "John Mason Jr" <notvalid@cox.net.invalid> wrote in message
>>> news:138g2bj4v0dm579@news.supernews.com...
>>
>> [ snip 55 lines not necessary for context ]
> I didn't imagine to have editorial privileges in a forum where I count as 
> outsider.


If you post, then you are no longer an outsider.  :-)

Have you seen the Posting Guidelines that are posted here frequently?


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 608
**************************************


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