[29363] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 607 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 1 16:09:46 2007

Date: Sun, 1 Jul 2007 13:09:08 -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: 607

Today's topics:
        auto submission of google page creator <samuelzhng@gmail.com>
        Badly placed ()'s. <mailursubbu@gmail.com>
    Re: Badly placed ()'s. anno4000@radom.zrz.tu-berlin.de
    Re: Badly placed ()'s. <tadmc@seesig.invalid>
    Re: install of perl 5.8.8 <mark.clementsREMOVETHIS@wanadoo.fr>
    Re: localtime and mktime <hjp-usenet2@hjp.at>
        Many threads working constantly <pziem@go2.pl>
    Re: Portable general timestamp format, not 2038-limited <hjp-usenet2@hjp.at>
    Re: Portable general timestamp format, not 2038-limited <see_website@mindprod.com.invalid>
    Re: Portable general timestamp format, not 2038-limited <http://phr.cx@NOSPAM.invalid>
    Re: Portable general timestamp format, not 2038-limited <see_website@mindprod.com.invalid>
    Re: Portable general timestamp format, not 2038-limited <see_website@mindprod.com.invalid>
    Re: Portable general timestamp format, not 2038-limited <martin@see.sig.for.address>
    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 <see_website@mindprod.com.invalid>
    Re: Portable general timestamp format, not 2038-limited <cbfalconer@yahoo.com>
        precompiled pp for windows. <gsn.coldfire@gmail.com>
        Reduce colors with Image::Magick  yong321@yahoo.com
    Re: The $a have any special meanning ? <stoupa@practisoft.cz>
    Re: The $a have any special meanning ? <tadmc@seesig.invalid>
    Re: unlurking <rvtol+news@isolution.nl>
    Re: unlurking <invalid@invalid.nyet>
    Re: unlurking <notvalid@cox.net.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 01 Jul 2007 08:01:58 -0700
From:  samuel <samuelzhng@gmail.com>
Subject: auto submission of google page creator
Message-Id: <1183302118.687709.251010@z28g2000prd.googlegroups.com>

Hi,

Google page creator is so stupid , espacially when you want to embed
some java script into the gui editor.
So I want if there is any way to write a perl script  to do the
editing and submission ? Or just using the script to generate the html
file and upload to GPC automatically ?

Thanks ,



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

Date: Sun, 01 Jul 2007 01:12:14 -0700
From:  Subra <mailursubbu@gmail.com>
Subject: Badly placed ()'s.
Message-Id: <1183277534.944667.288620@e9g2000prf.googlegroups.com>

Hi,

  Please help me to debug this problem!

> source change_RWSTD_VALUE_ALLOC.pl
Badly placed ()'s.

galaga:72 > cat change_RWSTD_VALUE_ALLOC.pl
#!/vobs/tools_vob/tools/hpux/perl_5_8_0/perl/bin/perl
open(input,"tmp") || die("input not preset");
open(output,">outFile") || die("Output not preset");
while($line=<input>)
{
    print $line;
    if($line=~/_RWSTD_VALUE_ALLOC[ ]*\(.*\,/)
    {
        $tmpLine=$line;
        $tmpLine=~s/(_RWSTD_VALUE_ALLOC[ ]*\(.*\,)/$1
PIN_ALLOC_PARAM/;
        print output $tmpLine;
    }
    else
    {
        print output $line;
    }
}



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

Date: 1 Jul 2007 11:34:02 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Badly placed ()'s.
Message-Id: <5ephpaF39oi86U1@mid.dfncis.de>

Subra  <mailursubbu@gmail.com> wrote in comp.lang.perl.misc:
> Hi,
> 
>   Please help me to debug this problem!
> 
> > source change_RWSTD_VALUE_ALLOC.pl
> Badly placed ()'s.
>
> galaga:72 > cat change_RWSTD_VALUE_ALLOC.pl
> #!/vobs/tools_vob/tools/hpux/perl_5_8_0/perl/bin/perl

[...]

The "source" command you're using is an internal csh command that
interprets csh source code, not Perl.

Run your script as "perl change_RWSTD_VALUE_ALLOC.pl" or make it
executable and "./change_RWSTD_VALUE_ALLOC.pl".

Anno


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

Date: Sun, 1 Jul 2007 06:34:39 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Badly placed ()'s.
Message-Id: <slrnf8f4af.ofe.tadmc@tadmc30.sbcglobal.net>

Subra <mailursubbu@gmail.com> wrote:
> Hi,
>
>   Please help me to debug this problem!
>
>> source change_RWSTD_VALUE_ALLOC.pl
   ^^^^^^
   ^^^^^^

Ask yourself what this command does...


> Badly placed ()'s.


You can help yourself debug this problem by looking up the
message in:

   perldoc perldiag

        =item Badly placed ()'s 

        (A) You've accidentally run your script through B<csh> instead
        of Perl.  Check the #! line, or manually feed your script into
        Perl yourself.

so you want:

   perl change_RWSTD_VALUE_ALLOC.pl

or, if your shebang line is correct, simply:

   change_RWSTD_VALUE_ALLOC.pl



> open(input,"tmp") || die("input not preset");


You should use UPPER CASE for filehandles, else your program will
stop working when you upgrade to a new version of perl that happens
to have introduce a new function named input().

   open(INPUT, 'tmp') || die("input not preset");

You should include the name of the file in your diag message.

You should include the reason for the failure ($!) in your diag message.

Superfluous punctuation makes your code harder to read.



Much much better would be to use the 3-argument form of open():

   open my $input, '<', 'tmp' or die "could not open 'tmp' $!";


> open(output,">outFile") || die("Output not preset");

   open my $output, '>', 'outFile' or die "could not open 'outFile' $!";
   
> while($line=<input>)

   while ( my $line = <$input> )


You should always enable 

   use strict;

in your Perl programs.


>     if($line=~/_RWSTD_VALUE_ALLOC[ ]*\(.*\,/)

Commas are not special in regexes, so you don't need to backslash them.

Whitespace is not a scarce resource, feel free to use as much of it
as you like to make your code easier to read and understand:

   if ( $line =~ /_RWSTD_VALUE_ALLOC[ ]*\(.*,/ )


>         print output $tmpLine;

   print $output $tmpLine;
or
   print {$output} $tmpLine;


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


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

Date: Sun, 01 Jul 2007 17:29:31 +0200
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: install of perl 5.8.8
Message-Id: <4687c858$0$27372$ba4acef3@news.orange.fr>

rogv24@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


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

Date: Sun, 1 Jul 2007 16:54:30 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: localtime and mktime
Message-Id: <slrnf8fg16.psa.hjp-usenet2@zeno.hjp.at>

On 2007-06-28 21:57, chanio <Alberto.Schiano@gmail.com> wrote:
>
> mhearne808[insert-at-sign-here]gmail[insert-dot-here]com ha escrito:
>> I think have a fundamental misunderstanding of one of either
>> localtime() or mktime().  Here's a snippet of code that illustrates
>> what I find confusing:
>>
>> $unixtime4 = time();
>> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
>> localtime($unixtime4);
>> $unixtime5 = mktime($sec,$min,$hour,$mday,$mon,$year);
[...]
>> I would expect that $unixtime4 and $unixtime5 would be identical -
>> however, they are different by exactly 1 hour (on Mac OS X and Linux
>> RHEL).
>>
>> Can anyone explain to me why this is?
>>
>> --Mike
> Right!
> But please, check your system time configuration.
> Your script works well.
[...]
> here, everything Ok (and I live in Argentina, TZ -03)

So you currently don't have DST - try it again in six months.
I assume that Mike lives on the northern hemisphere so he currently has
DST.

The problem is that mktime takes 9 arguments, not 6:

mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)

The last 3 are optional, but the default value of 0 for isdst is not
particularly useful. Either you know whether you want DST or not, then
you should explicitely specify it. Or you want mktime to guess, then you
have to specify isdst as -1:

unixtime5 = mktime($sec, $min, $hour, $mday, $mon, $year, 0, 0, -1);

	hp


-- 
   _  | Peter J. Holzer    | I know I'd be respectful of a pirate 
|_|_) | Sysadmin WSR       | with an emu on his shoulder.
| |   | hjp@hjp.at         |
__/   | http://www.hjp.at/ |	-- Sam in "Freefall"


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

Date: Sun, 01 Jul 2007 10:22:59 -0700
From:  ziemo <pziem@go2.pl>
Subject: Many threads working constantly
Message-Id: <1183310579.197028.93440@m36g2000hse.googlegroups.com>

Hello,

I need to create 10 threads. When one of them finished work, the next
thread will be start.
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?
Sory for my english and thanks for help :)

ziemo


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

use threads;
use threads::shared;
use Thread::Queue;

my $koniec : shared = 1;
my $ilosc_watkow=10;
my $count : shared;
my $end : shared;
my $kon = new Thread::Queue;

while($koniec){
        $count = 0;
                if($count < 1000){
                        $end=0;
                        threads->create(\&watek2) for
1..$ilosc_watkow;
                        while(!$end){
                                while($kon->pending){
                                        threads->object($kon->dequeue)-
>join;
                                        threads->create(\&watek2) if !
$end;
                                }
                                sleep 1;
                        }
                        foreach my $thr (threads->list){
                                if ($thr->tid && !threads::equal($thr,
threads->self)) {
                                        $thr->join;
                                }
                        }
                }

        sleep 5;

}

sub watek2 {
        if(!$end){
                if($count<1000){
                        print $count."\n";
                        lock $count;
                        $count++
                } else {
                        lock($end);
                        $end = 1;
                }
        }
        $kon->enqueue(threads->self->tid);

}



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

Date: Sun, 1 Jul 2007 16:11:32 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <slrnf8fdgk.psa.hjp-usenet2@zeno.hjp.at>

On 2007-06-22 20:33, James Harris <james.harris.1@googlemail.com> wrote:
> I have a requirement to store timestamps in a database. Simple enough
> you might think but finding a suitably general format is not easy. The
> specifics are
>
> 1) subsecond resolution - milliseconds or, preferably, more detailed
> 2) not bounded by Unix timestamp 2038 limit
> 3) readable in Java
> 4) writable portably in Perl which seems to mean that 64-bit values
> are out
> 5) readable and writable in Python
> 6) storable in a free database - Postgresql/MySQL

Stick to unix timestamps but store them as a double precision floating
point number. The 53 bit mantissa gives you currently a resolution of
about 200 ns, slowly deteriorating (you will hit ms resolution in about
280,000 years, if I haven't miscalculated). Any language and database
should be able to handle double-precision FP numbers, so that's as
portable as it gets and conversion from/to system time should be
trivial.

If you need to represent milliseconds exactly, you can just multiply the
timestamp with 1000 (and get java timestamps).

	hp



-- 
   _  | Peter J. Holzer    | I know I'd be respectful of a pirate 
|_|_) | Sysadmin WSR       | with an emu on his shoulder.
| |   | hjp@hjp.at         |
__/   | http://www.hjp.at/ |	-- Sam in "Freefall"


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

Date: Sun, 01 Jul 2007 15:14:20 GMT
From: Roedy Green <see_website@mindprod.com.invalid>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <l2hf83hdevbvrob81009v98cjjuoqvcnvj@4ax.com>

On 25 Jun 2007 18:46:25 -0700, Paul Rubin
<http://phr.cx@NOSPAM.invalid> wrote, quoted or indirectly quoted
someone who said :

>You cannot accurately compute
>the number of seconds between Nixon's resignation and 1800 UTC today,
>unless you take into account the leap seconds have been occurred
>between then and now.

There are two valid answers to those questions.  In a court of law,
say did some document arrive before  deadline, you must use civil
time.  Arguing leap seconds would not fly.

On the other hand, if you used civil seconds to computer satellite
orbits, tiny errors mount up quickly in the calculation.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


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

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

Roedy Green <see_website@mindprod.com.invalid> writes:
> >You cannot accurately compute
> >the number of seconds between Nixon's resignation and 1800 UTC today,
> >unless you take into account the leap seconds have been occurred
> >between then and now.
> 
> There are two valid answers to those questions.  In a court of law,
> say did some document arrive before  deadline, you must use civil
> time.  Arguing leap seconds would not fly.

I'd say if the deadline is "the document must arrive before noon
on August 9, 2009", that is civil time, including any leap seconds.
We don't know the exact number of seconds until then because
there might be some leap seconds that haven't yet been announced.

On the other hand if the deadline is "the document must arrive
no more than 1 billion seconds after noon on January 20, 2001"
that is an exact number of seconds.  We don't yet know the exact
civil time because we don't know about the leap seconds to come.


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

Date: Sun, 01 Jul 2007 15:37:44 GMT
From: Roedy Green <see_website@mindprod.com.invalid>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <uhif83t63gapg2pl1f1gngo7v3m91ml365@4ax.com>

On Tue, 26 Jun 2007 13:04:50 +0100, Martin Gregorie
<martin@see.sig.for.address> wrote, quoted or indirectly quoted
someone who said :

>TAI? Care to provide a reference?

see http://mindprod.com/jgloss/tai.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


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

Date: Sun, 01 Jul 2007 15:54:14 GMT
From: Roedy Green <see_website@mindprod.com.invalid>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <qejf83daetqn20qm9q4cj4hd4qpl870vem@4ax.com>

On 25 Jun 2007 18:46:25 -0700, Paul Rubin
<http://phr.cx@NOSPAM.invalid> wrote, quoted or indirectly quoted
someone who said :

>TAI really does seem like the most absolute--if you are a user in
>orbit or on Mars, then UTC timestamps will seem pretty meaningless and
>artificial.

According to Einstein all time is local time, so perhaps our wish for
a clean UT is a pipedream.

To add to the confusion you have GPS, Loran and Julian day also used
as scientific times.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


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

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

Roedy Green wrote:
> 
> To add to the confusion you have GPS, Loran and Julian day also used
> as scientific times.
 >
GPS time is UTC time and I'd assume the same is true for Loran. Both are 
primarily for navigation and so are on Zulu time, which is another name 
for UTC. Zulu is the international radio word for the letter Z.

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


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


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

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

Roedy Green wrote:
> On Tue, 26 Jun 2007 13:04:50 +0100, Martin Gregorie
> <martin@see.sig.for.address> wrote, quoted or indirectly quoted
> someone who said :
> 
>> TAI? Care to provide a reference?
> 
> see http://mindprod.com/jgloss/tai.html
 >
Thanks.

Your list of NTP servers on http://mindprod.com/jgloss/timesources.html 
may be a bit out of date: I notice that it doesn't include the European 
or Oceania time server pools (0.europe.pool.ntp.org, 
0.oceania.pool.ntp.org). It may be best to just hold a link to the NTP 
project servers page, http://support.ntp.org/bin/view/Servers/WebHome


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


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

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

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).

http://en.wikipedia.org/wiki/GPS#Ephemeris_and_clock_errors


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

Date: Sun, 01 Jul 2007 19:10:34 GMT
From: Roedy Green <see_website@mindprod.com.invalid>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <3vuf835e6m0dccrhipolnebpuugpni75fp@4ax.com>

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
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


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

Date: Sun, 01 Jul 2007 14:34:24 -0400
From: CBFalconer <cbfalconer@yahoo.com>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <4687F3B0.1A9E2B54@yahoo.com>

Roedy Green wrote:
> On 25 Jun 2007 18:46:25 -0700, Paul Rubin
>
 ... snip ...
> 
>> TAI really does seem like the most absolute--if you are a user
>> in orbit or on Mars, then UTC timestamps will seem pretty
>> meaningless and artificial.
> 
> According to Einstein all time is local time, so perhaps our wish
> for a clean UT is a pipedream.
> 
> To add to the confusion you have GPS, Loran and Julian day also
> used as scientific times.

In summary, time is now defined as a non-continuous function, and
is thus proof against manipulation by most standard algebraic
techniques.  Take that :-)  In fact, it is not even quanticized.

-- 
 <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
 <http://www.securityfocus.com/columnists/423>
 <http://www.aaxnet.com/editor/edit043.html>
                        cbfalconer at maineline dot net



-- 
Posted via a free Usenet account from http://www.teranews.com



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

Date: Sun, 01 Jul 2007 02:20:39 -0700
From:  bluishgreen <gsn.coldfire@gmail.com>
Subject: precompiled pp for windows.
Message-Id: <1183281639.072745.283730@x35g2000prf.googlegroups.com>

Hello all,

I tried to get pp compiled in my windows. nmake gives me hell. Could
some one give me the precompiled binaries for windows please.

Thanks much for the help,
Senthil



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

Date: Sun, 01 Jul 2007 05:41:56 -0700
From:  yong321@yahoo.com
Subject: Reduce colors with Image::Magick
Message-Id: <1183293716.127930.64540@z28g2000prd.googlegroups.com>

I use this code to test reducing number of image colors (image from
http://www.libpng.org/pub/png/).

use Image::Magick;
$p = new Image::Magick;
$p->Read("pnglogo-blk-sml1.png");
$p->Quantize(colors=>64);
#$p->Posterize(levels=>1, dither=>True);
$p->Write("pnglogo-blk-sml12.png");

I use IrfanView to check number of colors (should be the same as
Get(colors) of Image::Magick). Number of *unique* colors has indeed
decreased from 256 to 64. But both Original Colors and Current Colors
reported by IrfanView are still "256   (8 BitsPerPixel)". Since I only
have 64 colors, how can I reduce bits per pixel to 6?

The real goal is to reduce file size by sacrificing some colors. Size
of original image pnglogo-blk-sml1.png is 17260. New image pnglogo-blk-
sml12.png is 11049. Can this be reduced further?

Yong Huang



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

Date: Sun, 1 Jul 2007 16:23:53 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: The $a have any special meanning ?
Message-Id: <f68dk5$vit$1@ns.felk.cvut.cz>

Tad McClellan wrote:
> Petr Vileta <stoupa@practisoft.cz> wrote:
>> Thomas Wasell wrote:
>>> Yes, $a and $b are special. See
>>>
>> Are you sure? I found examples in perldoc -f sort but these are
>
> From perlvar.pod:
>
>    =item $a
>
>    =item $b
>
What version of Perl are you using? I use 5.6.1 and pervar.pod in my version 
not contain these items and above this not contain the word "sort" at all. 
Maybe this was be changed in 5.8.x ?
-- 

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





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

Date: Sun, 01 Jul 2007 18:18:11 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: The $a have any special meanning ?
Message-Id: <slrnf8frrt.ut8.tadmc@tadmc30.sbcglobal.net>

Petr Vileta <stoupa@practisoft.cz> wrote:
> Tad McClellan wrote:
>> Petr Vileta <stoupa@practisoft.cz> wrote:
>>> Thomas Wasell wrote:
>>>> Yes, $a and $b are special. See
>>>>
>>> Are you sure? I found examples in perldoc -f sort but these are
>>
>> From perlvar.pod:
>>
>>    =item $a
>>
>>    =item $b
>>
> What version of Perl are you using? 


5.8.8


> I use 5.6.1


A lot has happened in the last 6 years.


> Maybe this was be changed in 5.8.x ?


If you use ancient software, you should expect to miss out on a lot.


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


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

Date: Sun, 1 Jul 2007 20:16:37 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: unlurking
Message-Id: <f69252.1hc.1@news.isolution.nl>

Wade Ward schreef:

> Can someone give me a script or a reference [...] on how to use
> perl to herd messages in a usenet thread into a file?

Feel free to use and abuse:
  http://www.xs4all.nl/~rvtol/perl/xover_clpm.pl
I never really used it, and would completely rewrite it before using it.
It doesn't do threads, but hey, that is easy to add.

I did use something similar to collect header data from a binary
newsgroup. And then massage the data to find out which articles on a
binary newsgroup belong together, for example by simplifying the Subject
value to convert it into a hash key. That was a fun way to learn more
Perl.

-- 
Affijn, Ruud

"Gewoon is een tijger."



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

Date: Sun, 1 Jul 2007 15:56:53 -0400
From: "Wade Ward" <invalid@invalid.nyet>
Subject: Re: unlurking
Message-Id: <YdydnRJTQtrcmhXbnZ2dnUVZ_hadnZ2d@comcast.com>


"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 




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

Date: Sun, 01 Jul 2007 16:07:14 -0400
From: John Mason Jr <notvalid@cox.net.invalid>
Subject: Re: unlurking
Message-Id: <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?


John



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

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


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