[23675] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5882 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 2 11:05:46 2003

Date: Tue, 2 Dec 2003 08:05:09 -0800 (PST)
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, 2 Dec 2003     Volume: 10 Number: 5882

Today's topics:
    Re: [Newbie]Problem reading text file (Tad McClellan)
    Re: [Newbie]Problem reading text file (Tad McClellan)
    Re: count of 1s in a binary number (Anno Siegel)
    Re: count of items in a hash <krahnj@acm.org>
    Re: Easy Field Grabbing Question (Anno Siegel)
    Re: Easy Field Grabbing Question <Geezer@Freezer.com>
    Re: Easy Field Grabbing Question <noreply@gunnar.cc>
    Re: Easy Field Grabbing Question (Anno Siegel)
    Re: Easy Field Grabbing Question <Geezer@Freezer.com>
    Re: Easy Field Grabbing Question (Anno Siegel)
    Re: Easy Field Grabbing Question <nobody@dev.null>
        Freelance programmers wanted.                           (Diane Parker)
    Re: hash key evaluation creates an entry ! <usenet@dwall.fastmail.fm>
        Intermittent errors when loading modules in ActivePerl  (Louie)
    Re: Intermittent errors when loading modules in ActiveP <ben.liddicott@comodogroup.com>
        Need programmers? At Colance they compete for your busi (Phillip Torres)
    Re: Newsgroup Searching Program <mikeflan@earthlink.net>
        Perl script to HTTP post to a web server. (Jon Allen)
    Re: Perl script to HTTP post to a web server. <richard@zync.co.uk>
        Perl v5.6.0 is not compatible with v5.8.0?? <jroznfgre@jngpugbjreQBGbet.cy>
        perl.org bugs <menscher+perl@uiuc.edu>
    Re: perl.org bugs (Rafael Garcia-Suarez)
    Re: perl.org bugs <tassilo.parseval@rwth-aachen.de>
    Re: redirect using location header does not work from a <flavell@ph.gla.ac.uk>
    Re: Unexpected tell() result <dwilga-MUNGE@mtholyoke.edu>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 2 Dec 2003 07:38:17 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: [Newbie]Problem reading text file
Message-Id: <slrnbsp5e9.a63.tadmc@magna.augustmail.com>

Senthil Raja <senthil.raja@adcc.alcatel.be> wrote:

> I have problem reading a test file, line by line. 

> Is there anything wrong in the algorithm I use? 


No.


> Am I missing a basic
> concept?


Yes.

You should post a short and complete program *that we can run*
that illustrates the problem you are having.

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


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

while (<DATA>)
{
   next unless /^(\d+)/;  # must start with digit characters
   my $record = $1;;
   print;
   for (my $i=1; $i<=$record; $i++)  # foreach my $i ( 1 .. $record)
    {
      my $line = <DATA>;
      print "   $line";
    }
}


__DATA__
no numbers here
none here either
2 more lines
line 1
line 2
3 lines follow
Line 1
Line 2
Line 3
no nums
1 after this line
LINE 1
no more
-------------------------------------------


Works for me...


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


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

Date: Tue, 2 Dec 2003 07:41:40 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: [Newbie]Problem reading text file
Message-Id: <slrnbsp5kk.a63.tadmc@magna.augustmail.com>

Senthil Raja <senthil.raja@adcc.alcatel.be> wrote:

> if (!open (PARSE, "$parse")) { die ("Error - Unable to open \"$parse\"
                    ^      ^
                    ^      ^ a useless use of double quotes

   perldoc -q quot

      What's wrong with always quoting "$vars"?


> for reading. Check permissions\n"); }


The open() can fail for reasons other than permissions 
(eg: file not found).

The $! special variable will contain the reason for the failure,
so you should include it in your diagnostic message:

   open PARSE, $parse or die "could not open '$parse'  $!";



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


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

Date: 2 Dec 2003 11:17:13 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: count of 1s in a binary number
Message-Id: <bqhsbp$nph$1@mamenchi.zrz.TU-Berlin.DE>

David Combs <dkcombs@panix.com> wrote in comp.lang.perl.misc:
> In article <boj8vt$iui$1@mamenchi.zrz.TU-Berlin.DE>,
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> >Michele Dondi  <bik.mido@tiscalinet.it> wrote in comp.lang.perl.misc:
> >> On Fri, 07 Nov 2003 18:36:24 +1100, Fred <fJogham@yahoo.com> wrote:
> >> 
> >> >the main issue is how to get the sub to deal with both data types and 
> >> >give the expected results which is the count of "1" in the string or 
> >> >array with out writeing 2 subs
> >
> >[snip]
> >
> >> If you choose to use numbers instead of bitstrings a less
> >> Perl-specific way to count '1's is could be:
> >> 
> >>   sub size1 {
> >>       # Recursive approach, terse and elegant IMHO.
> >>       # An iterative one is OK as well.
> >>       my $n=shift;
> >>       return 0 unless $n;
> >>       return ($n&1) + size1($n>>1);
> >>   }
> >
> >That counts the bits of an n-bit number in n steps.  There is an old trick
> >in the dying art of bit-fiddling that allows to count them in as many steps
> >as there are one-bits.  That is a significant advantage if the numbers
> >involved are small (or sparse, bit-wise).
> >
> >The trick is to isolate the least significant one-bit in a number
> >in one step.  This is essentially done by subtracting 1 from the number.
> >Beginning from the least significant bit, this builds a bridge of
> <SNIP>
> 
> Where'd you find that, HAKMEM maybe?

No, I came across it in an obscure 6502 users-group monthly (xeroxed
format, title long forgotten).

Anno


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

Date: Tue, 02 Dec 2003 12:34:34 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: count of items in a hash
Message-Id: <3FCC86C1.2DF208FC@acm.org>

"Eric J. Roode" wrote:
> 
> If you want to know how many keys there are in %set, do this:
> 
>     $count = keys %set;
> 
> or:
> 
>     print "There are ", scalar %set, " keys in %set.\n";

That should be:

     print "There are ", scalar keys %set, " keys in %set.\n";

'scalar %set' will print something completely different.  :-)


John
-- 
use Perl;
program
fulfillment


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

Date: 2 Dec 2003 11:23:55 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Easy Field Grabbing Question
Message-Id: <bqhsob$nph$2@mamenchi.zrz.TU-Berlin.DE>

Geezer From Freezer  <Geezer@Freezer.com> wrote in comp.lang.perl.misc:

You advertise your question as an "easy" one.  How do you know it is
easy when you don't know the solution?

> I've had a look in some books but can't find what I'm looking for.
> 
> I have a line of text in a variable  or several in an array
> and I want to extract the 5th field of each line - how?

That can't be answered before you specify how fields are separated
in the text.

Anno


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

Date: Tue, 02 Dec 2003 11:33:29 +0000
From: Geezer From Freezer <Geezer@Freezer.com>
Subject: Re: Easy Field Grabbing Question
Message-Id: <3FCC7889.CE2E12D6@Freezer.com>



Anno Siegel wrote:
> 
> Geezer From Freezer  <Geezer@Freezer.com> wrote in comp.lang.perl.misc:
> 
> You advertise your question as an "easy" one.  How do you know it is
> easy when you don't know the solution?

I don't - but it's easy in awk, which I don't want to use for this
situation


> > I've had a look in some books but can't find what I'm looking for.
> >
> > I have a line of text in a variable  or several in an array
> > and I want to extract the 5th field of each line - how?
> 
> That can't be answered before you specify how fields are separated
> in the text.

fields are space seperated. Not necessarily 1 space, but could be 1 or more
spaces.


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

Date: Tue, 02 Dec 2003 12:52:59 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Easy Field Grabbing Question
Message-Id: <bqhubn$22gk8u$1@ID-184292.news.uni-berlin.de>

Geezer From Freezer wrote:
> Anno Siegel wrote:
>> Geezer From Freezer wrote:
>>> I've had a look in some books but can't find what I'm looking
>>> for.

Which books did you study?

>>> I have a line of text in a variable  or several in an array and
>>> I want to extract the 5th field of each line - how?
>> 
>> That can't be answered before you specify how fields are
>> separated in the text.
> 
> fields are space seperated. Not necessarily 1 space, but could be 1
> or more spaces.

     my $field = (split /\s+/)[4];

     http://www.perldoc.com/perl5.8.0/pod/func/split.html

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: 2 Dec 2003 13:03:27 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Easy Field Grabbing Question
Message-Id: <bqi2iv$6a$1@mamenchi.zrz.TU-Berlin.DE>

Geezer From Freezer  <Geezer@Freezer.com> wrote in comp.lang.perl.misc:
> 
> 
> Anno Siegel wrote:
> > 
> > Geezer From Freezer  <Geezer@Freezer.com> wrote in comp.lang.perl.misc:
> > 
> > You advertise your question as an "easy" one.  How do you know it is
> > easy when you don't know the solution?
> 
> I don't - but it's easy in awk, which I don't want to use for this
> situation
> 
> 
> > > I've had a look in some books but can't find what I'm looking for.
> > >
> > > I have a line of text in a variable  or several in an array
> > > and I want to extract the 5th field of each line - how?
> > 
> > That can't be answered before you specify how fields are separated
> > in the text.
> 
> fields are space seperated. Not necessarily 1 space, but could be 1 or more
> spaces.

    my $fifth = (split)[4];

Anno


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

Date: Tue, 02 Dec 2003 14:03:09 +0000
From: Geezer From Freezer <Geezer@Freezer.com>
Subject: Re: Easy Field Grabbing Question
Message-Id: <3FCC9B9D.29ABCD16@Freezer.com>



Anno Siegel wrote:
> 
>     my $fifth = (split)[4];
> 
> Anno

ok another stupid question time!

how does the above work for an array?? $fifth is being created but
does not reference the array?

I've tried the following:

 foreach $user (@list){

 print "$user"; #output prints fine!
 my $fifth = (split $user[4]);
 print "$fifth"; # gets 0 every time!
 }


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

Date: 2 Dec 2003 14:23:54 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Easy Field Grabbing Question
Message-Id: <bqi79q$1gi$1@mamenchi.zrz.TU-Berlin.DE>

Geezer From Freezer  <Geezer@Freezer.com> wrote in comp.lang.perl.misc:
> 
> 
> Anno Siegel wrote:
> > 
> >     my $fifth = (split)[4];
> > 
> > Anno
> 
> ok another stupid question time!
> 
> how does the above work for an array?? $fifth is being created but
> does not reference the array?

You really need to make your questions clearer.

The plain answer is, the above doesn't work for an array, and isn't meant
to.

Explain *how* an array comes into play.

> I've tried the following:
> 
>  foreach $user (@list){
> 
>  print "$user"; #output prints fine!
>  my $fifth = (split $user[4]);
                      ^^^^^^^^
This presupposes an array @user, which is nowhere defined.  You should
run all your code under "use strict", it would have picked up your error.
Also, it assigns the result of split to a scalar, which is not what you
want.  Have you read "perldoc -f split" at all?  You should do that
*before* presenting questions to the group.

>  print "$fifth"; # gets 0 every time!
>  }

Apparently you expect an array of strings that all must be subjected
to the split/extract-fifth-element procedure.  For that, you don't
need to change the code at all, just wrap a loop around it. Untested:

    for ( @list ) {
        my $fifth = (split)[4];
        # do something with $fifth
    }

Anno


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

Date: Tue, 02 Dec 2003 14:40:15 GMT
From: Andras Malatinszky <nobody@dev.null>
Subject: Re: Easy Field Grabbing Question
Message-Id: <3fcca44c$1@bandit2.georgetown.edu>



Geezer From Freezer wrote:
> 
> Anno Siegel wrote:
> 
>>    my $fifth = (split)[4];
>>
>>Anno
> 
> 
> ok another stupid question time!
> 
> how does the above work for an array?? $fifth is being created but
> does not reference the array?
> 
> I've tried the following:
> 
>  foreach $user (@list){
> 
>  print "$user"; #output prints fine!
>  my $fifth = (split $user[4]);
>  print "$fifth"; # gets 0 every time!
>  }

Well what did you expect? When you say $user[4] you are creating the 
@user array from out of thin air (using strict would have warned you 
about that), so $user[4] will be 0 (along with every other element of 
@user) and if you split it, you still get 0.

Instead of randomly combining functions in the hope that you will get 
your desired result by chance, take Gunnar Hjalmarsson's advice and read 
up on the split function.



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

Date: Tue, 02 Dec 2003 11:07:49 GMT
From: DParker@excite.com (Diane Parker)
Subject: Freelance programmers wanted.                                                         PO
Message-Id: <9o_yb.943$Kf2.539@twister.socal.rr.com>


Webmasters: Colance specialise in connecting your ideas with Freelance Professionals to produce your project.
Programmers: Providing your Service is made easy through Colance. It is free to sign up with no monthly costs.













ucj9sX9SgfAPBxBbbm




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

Date: Tue, 02 Dec 2003 15:22:52 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: hash key evaluation creates an entry !
Message-Id: <Xns9445699AA8B76dkwwashere@216.168.3.30>

Tad McClellan <tadmc@augustmail.com> wrote:

> Malcolm Dew-Jones <yf110@vtn1.victoria.tc.ca> wrote:
> 
>> To find the size of the array, using $# or @
> 
> The $# syntax does NOT find the size of the array.

Ok, so $#foo gives the *index* of the last element of the array, not 
the size of the array minus one.  Other than setting the indices of an 
array to start with something other than zero (but don't do that), is 
there any situation where 

    scalar @foo == $#foo + 1

is NOT true?  Or is the $# syntax available just in case someone DOES 
start array indexing with something other than zero?

(It's not really important to me, I'm just curious.)

-- 
David Wall


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

Date: 2 Dec 2003 04:49:14 -0800
From: elesel@myrealbox.com (Louie)
Subject: Intermittent errors when loading modules in ActivePerl 5.8.0
Message-Id: <33e4b810.0312020449.24cafcb6@posting.google.com>

I'm getting intermittent strange error messages when I try to load any
module in even a very simple Perl script, such as:

------------------------
#!/usr/local/bin/perl -w

use strict;
use Digest::MD5;
------------------------

The above script will run fine (yes, I know it doesn't do anything)
sometimes and other times generate the following error:

------------------------
Perl v7.1000.0 required (did you mean v7.010?)--this is only v5.8.0,
stopped at /usr/local/lib/perl5/5.8.0/AutoLoader.pm line 3.
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/5.8.0/AutoLoader.pm line 3.
Compilation failed in require at
/usr/local/lib/perl5/5.8.0/sun4-solaris-thread-multi/DynaLoader.pm
line 22.
Compilation failed in require at
/usr/local/lib/perl5/5.8.0/sun4-solaris-thread-multi/Digest/MD5.pm
line 12.
Compilation failed in require at ./test.pl line 4.
BEGIN failed--compilation aborted at ./test.pl line 4.
------------------------

There's nothing but <I>use 5.006_001;</I> (no quotes) on line 3 of
AutoLoader.pm, and the other modules just call each other
(MD5->DynaLoader->AutoLoader), so I'm not sure what I'm chasing but I
believe I am getting a useless error message at this point.  This same
Perl installation (sparc-platform, Solaris 8, Sun V880) is running
fine on other servers.  Any help would be greatly appreciated, as I'm
no UNIX master by any stretch of the imagination.

For what it's worth, here's the output of <I>perl -V</I>:

------------------------
Summary of my perl5 (revision 5.0 version 8 subversion 0)
configuration:
  Platform:
    osname=solaris, osvers=2.8, archname=sun4-solaris-thread-multi
    uname='sunos aus0010tldev14.ausc.irs.gov 5.8 generic_108528-13
sun4u sparc sunw,ultra-5_10 '
    config_args='-Dcc=gcc -B/usr/ccs/bin'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=y, bincompat5005=undef
  Compiler:
    cc='gcc -B/usr/ccs/bin', ccflags ='-D_REENTRANT
-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
    optimize='-O',
    cppflags='-D_REENTRANT -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='2.95.3 20010315 (release)',
gccosandvers='solaris2.8'
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc -B/usr/ccs/bin', ldflags =' -L/usr/local/lib '
    libpth=/usr/local/lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lrt -lpthread -lc
    perllibs=-lsocket -lnsl -ldl -lm -lrt -lpthread -lc
    libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='  -R
/usr/local/lib/perl5/5.8.0/sun4-solaris-thread-multi/CORE'
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT
  Built under solaris
  Compiled at Mar 11 2003 11:14:31
  @INC:
    /usr/local/lib/perl5/5.8.0/sun4-solaris-thread-multi
    /usr/local/lib/perl5/5.8.0
    /usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris-thread-multi
    /usr/local/lib/perl5/site_perl/5.8.0
    /usr/local/lib/perl5/site_perl
    .
------------------------

- Louie


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

Date: Tue, 2 Dec 2003 15:30:25 -0000
From: "Ben Liddicott" <ben.liddicott@comodogroup.com>
Subject: Re: Intermittent errors when loading modules in ActivePerl 5.8.0
Message-Id: <bqibeq$v1i$1@kylie.comodogroup.com>

Hi Louie,

"Louie" <elesel@myrealbox.com> wrote in message =
news:33e4b810.0312020449.24cafcb6@posting.google.com...
> I'm getting intermittent strange error messages when I try to load any
> module in even a very simple Perl script, such as:
>=20
> ------------------------
> #!/usr/local/bin/perl -w
>=20
> use strict;
> use Digest::MD5;
> ------------------------
>=20
> The above script will run fine (yes, I know it doesn't do anything)
> sometimes and other times generate the following error:


When you say "sometimes" and "other times", are there any other =
differences other than the time?

In other words, might it be to do with who you are logged in as, working =
directory, library paths, environment variables and so forth? Might it =
also be to do with what is currently mounted via NFS?

I suggest you dump the environment to a file when it works, and again on =
some occasion when it doesn't, and diff the files.

Cheers,
Ben Liddicott


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

Date: Tue, 02 Dec 2003 11:07:51 GMT
From: PTorres@mail.com (Phillip Torres)
Subject: Need programmers? At Colance they compete for your business.                                                         g0P
Message-Id: <bo_yb.945$Kf2.787@twister.socal.rr.com>


Webmasters: Colance specialise in connecting your ideas with Freelance Professionals to produce your project.
Programmers: Providing your Service is made easy through Colance. It is free to sign up with no monthly costs.













HLSx2vwkp




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

Date: Tue, 02 Dec 2003 15:36:03 GMT
From: Mike Flannigan <mikeflan@earthlink.net>
Subject: Re: Newsgroup Searching Program
Message-Id: <3FCCB220.6F5985CD@earthlink.net>


Gerard Lanois wrote:

> So far, so good.
>
> Does your news server require an account and password?  If so, you'll
> want to add lines that look like this:
>
> my $account = 'myaccount';
> my $password = 'secret';
>
> $nntp->authinfo($account, $password)
> or die "ERROR: Net::NNTP->authinfo() failed.\n";

I know this is more of a newsgroup question that a Perl question,
but I couldn't find a newsgroup newsgroup to post it to.

I couldn't find a snippet of code to post, so I'm posting
the whole thing below.  But my question has to do
primarily with:

    # while we can go to the next message ....
    while(my $msgid=$nntp->last){

I'm pretty sure I don't fully understand that statement,
but I think it goes backwards from the highest message
number (i.e. 494122) to more recent message numbers
(i.e. 494120).  And apparently, a higher message
number does not directly correlate to a later date.
So 494120 could be Dec. 1 08:05 hrs and 494122
could be Dec. 1 07:45 hrs.

My question is:  Is this true?  If I want my output to be
date sorted, so I need to read the date and sort it
manually, or can it be done with message number or
message ID, or something else I'm not seeing?

Any comments on any of the code, or the logic of
doing this at all, is appreciated.


Mike


use strict;
use warnings;
use Net::NNTP;

my($SERVER, $nntp, $articles, $first, $last, $ng_name, $msg_no, $no, @ng);
my($groupname);
my $newsgroup = 'ngperl.txt';
my $msgfile = 'ngmsgno.txt';

# open output file
open NGOUT, ">", $newsgroup or die "$0: open $newsgroup: $!";

# get last message number previously downloaded
open MSG, "<", $msgfile or die "$0: open $msgfile: $!";
#$msg_no = <MSG>;
my @msgno = map [ split /\t/, $_, 2 ], <MSG>;
close MSG;

open MSG, ">", $msgfile or die "$0: open $msgfile: $!";

# define NNTP server
$SERVER = '***any server you like***';

# declare new Net::NNTP object - or die
$nntp = Net::NNTP->new($SERVER, Debug=>0) or die "Can't connect to server
$SERVER: $!\n";
my $account = '***username***';
my $password = '***something goes here***';
$nntp->authinfo($account, $password) or die "ERROR: Net::NNTP->authinfo()
failed.\n";

foreach my $line ( @msgno ) {
    $groupname = $line->[0];
    chomp $line->[1];
    $msg_no = $line->[1];

    # define what newsgroup to use -
    # get the newsgroup name, amount of article, the first article number
    # and last article number
    ($articles,$first,$last,$ng_name) = $nntp->group($groupname);
    #$nntp->group('linus.redhat.misc');
    #$nntp->group('rec.gambling.poker');

    #print the information out
    print NGOUT "newsgroup name = $ng_name\n\n";
    printf("%s: %5d articles (%-5d to
%-5d)\n\n\n",$ng_name,$articles,$first,$last);

    # declare a messages counter
    my $x = 1;
    # set the nntpstat marker to the last message in the newsgroup
    $nntp->nntpstat($last);

    # while we can go to the next message ....
    while(my $msgid=$nntp->last){

        # print msgid to message no file if this is the last message
        print MSG "$ng_name $msgid\n" if $x == 1;

        # quit if we've reached the previously downloaded last message
        last if $msg_no eq $msgid;

        # print what number message we're on
        print NGOUT "num: $x $ng_name  --  $msgid  --  $last\n\n";

        # get the next article
        $nntp->article($msgid,*NGOUT);
        print NGOUT "\n\n\n";

        # limit how many messages you want
        if ($x == 150) {
            $x++;
            last;
        }
        #increment messages counter
        $x++;
    }

    $no = $x-1;
    print "\n$groupname\nDownloaded $no messages\n\n";
    print NGOUT "\nDownloaded $no messages\n";
    print NGOUT
"\n\n\n\n\n***************************************************\n\n\n\n\n";
}

close NGOUT;
close MSG;

#close the connection to the NNTP server
$nntp->quit;

open NGEDIT, "<", $newsgroup or die "$0: open $newsgroup: $!";
@ng = <NGEDIT>;
close NGEDIT;


# Clean up the header and write out to Perl Newsgroup.txt
# on the desktop

chdir 'C:/Documents and Settings/Main/Desktop';

open NGFILE, ">>Perl Newsgroup.txt" or die "$0: open Perl Newsgroup.txt: $!";

for my $line ( @ng ) {
$line =~ s/^Path:.*\n$//i;
$line =~ s/^Organization:.*\n$//i;
$line =~ s/^Lines:.*\n$//i;
$line =~ s/^Message-ID:.*\n$//i;
$line =~ s/^References:.*\n$//i;
$line =~ s/^User-.*:.*\n$//i;
$line =~ s/^X-.*:.*\n$//i;
$line =~ s/^Xref.*:.*\n$//i;
$line =~ s/^Mime-.*:.*\n$//i;
$line =~ s/^Content-.*:.*\n$//i;
$line =~ s/^NNTP-.*:.*\n$//i;
$line =~ s/^In-Reply.*:.*\n$//i;
$line =~ s/^Disposition-.*:.*\n$//i;
$line =~ s/^Cache-.*:.*\n$//i;
print NGFILE $line;
}

close NGFILE;

__END__




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

Date: 2 Dec 2003 03:17:50 -0800
From: jallen@haynes.co.uk (Jon Allen)
Subject: Perl script to HTTP post to a web server.
Message-Id: <c0ff3246.0312020317.749ada8@posting.google.com>

I need to regularly HTTP post an xml document to our web server. I am
running DG/UX Release R4.11MU04 and need a Perl script to post the
document. Does anyone have an idiots example script I could use to
base mine on please?.


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

Date: Tue, 02 Dec 2003 12:17:06 +0000
From: "Richard Gration" <richard@zync.co.uk>
Subject: Re: Perl script to HTTP post to a web server.
Message-Id: <vsp0m232p9kb88@corp.supernews.com>

In article <c0ff3246.0312020317.749ada8@posting.google.com>, "Jon Allen"
<jallen@haynes.co.uk> wrote:


> I need to regularly HTTP post an xml document to our web server. I am
> running DG/UX Release R4.11MU04 and need a Perl script to post the
> document. Does anyone have an idiots example script I could use to base
> mine on please?.

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use strict;

my ($ua,$req,$res);
my $random_form_var = 'Bill Roolz';

$ua = new LWP::UserAgent;
$ua->agent('MyUserAgent/0.01');

$req = POST "http://www.somesite.tld",
	Content         =>  [
		random_form_var       =>  $random_form_var,
		file_content_from_ram =>  [undef,'stuff.txt',Content=>'Arbitrary file'],
		ordinary_file         =>  ['/etc/passwd','supersecretfile.teehee'],
	],
	Content_Type    =>  'form-data',
;
$res = $ua->request($req);
if ($res->is_success) {
	print "Whoop-ti-do\n";
} else {
	print "Oh dear\n";
}
print "Response content follows:\n";
print $res->as_string;

You should read, at least, perldoc LWP,HTTP::Request::Common,
HTTP::Request,HTTP::Response,HTTP::Message.


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

Date: Tue, 02 Dec 2003 14:22:34 +0100
From: JZ <jroznfgre@jngpugbjreQBGbet.cy>
Subject: Perl v5.6.0 is not compatible with v5.8.0??
Message-Id: <8g4psvspqvhklgv22of611sjalq9jpmvpq@4ax.com>

I have a strange problem with Perl. When I execute indexer.pl script
(from ksearch http://www.kscripts.com/scripts.shtml)  with  Perl 5.6.0
/ RedHat 7 it works fine. But if I execute the same script on another
computer working with Perl 5.8.0 / RedHat 9, I receive lots errors
like that:

Malformed UTF-8 character (overflow at 0x2ca77a73), byte 0x79, after
start byte 0xbf) in substitution (s///) at ./indexer.pl line 353

Line 353 from indexer.pl is:

$contents =~
s/(<\s*script[^>]*>.*?<\s*\/script\s*>)|(<\s*style[^>]*>.*?<\s*\/style\s*>)/
/gsi;

The same errors are for the latest version of ksearch 1.4 I have just
installed. So I suppose the problem is with Perl 5.8.0. (I have no
UTF-8 encoded files. All HTML files are ISO-8859-2 encoded)

--
JZ


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

Date: Mon, 1 Dec 2003 23:46:00 +0000 (UTC)
From: Damian Menscher <menscher+perl@uiuc.edu>
Subject: perl.org bugs
Message-Id: <bqgjro$beh$1@news.ks.uiuc.edu>

Ok, I'll try really hard to not flame too much here.....

A while back I found a potentially critical flaw in perl.  Being a
good person, I went to the perl.org website to report it.  They want
the report done through perlbug, so I go through that process.  It
was an important bug, so I marked it as critical.

Well, it was obviously asking too much to have the latest version of
perlbug be compatible with the website.  The website didnt' know
what "critical" means -- apparently it's called "fatal" now.  So it
didn't assign it a severity.  Oh well, just means it'll take an
extra few days for someone to notice the bug report.

I've been checking back every few days to see if anyone has noticed
it, and this time when I checked back, I can't get in to the
website.  It prompts for a password.  Even guest logins want a
password.

Ok, so I create an account, and log in using that.  What?  Another
password prompt?  Hrmm... I don't have a password for that one.  Oh
well.  Guess I can't check on my bug.

I'm sending this here with the hope that someone with a clue and
the power to do something will actually take note and get this
fixed.  While you're at it, could you make the website a bit faster?
Having to wait a minute for each page to load is rather annoying.

Damian Menscher
-- 
-=#| Physics Grad Student & SysAdmin @ U Illinois Urbana-Champaign |#=-
-=#| 488 LLP, 1110 W. Green St, Urbana, IL 61801 Ofc:(217)333-0038 |#=-
-=#| 4602 Beckman, VMIL/MS, Imaging Technology Group:(217)244-3074 |#=-
-=#| <menscher@uiuc.edu> www.uiuc.edu/~menscher/ Fax:(217)333-9819 |#=-


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

Date: 02 Dec 2003 12:49:27 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: perl.org bugs
Message-Id: <slrnbsp2cr.h7r.rgarciasuarez@rafael.serd.lyon.hexaflux.loc>

Damian Menscher wrote:
>
>A while back I found a potentially critical flaw in perl.  Being a
>good person, I went to the perl.org website to report it.  They want
>the report done through perlbug, so I go through that process.  It
>was an important bug, so I marked it as critical.
>
>Well, it was obviously asking too much to have the latest version of
>perlbug be compatible with the website.  The website didnt' know
>what "critical" means -- apparently it's called "fatal" now.  So it
>didn't assign it a severity.  Oh well, just means it'll take an
>extra few days for someone to notice the bug report.

The perlbug web interface is being currently upgraded to RT 3, so
it's expected it has still rough edges.

>I've been checking back every few days to see if anyone has noticed
>it, and this time when I checked back, I can't get in to the
>website.  It prompts for a password.  Even guest logins want a
>password.
>
>Ok, so I create an account, and log in using that.  What?  Another
>password prompt?  Hrmm... I don't have a password for that one.  Oh
>well.  Guess I can't check on my bug.

The same password should work. This is expected to be improved in the
near future as well.

>I'm sending this here with the hope that someone with a clue and
>the power to do something will actually take note and get this
>fixed.

Several people have tried to reproduce your bug with different versions
of perl, and failed. I think you've not given enough info, or wrong
info. Sorry, I should have replied to your bug report earlier ; but
vague bug reports tend to be treated with less priority than the clear
and concise ones, and our free time is limited.

-- 
Unknowable is not *NIX


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

Date: Tue, 02 Dec 2003 13:09:57 +0000 (GMT)
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: perl.org bugs
Message-Id: <bqi2v5$cen$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Damian Menscher:

> Ok, I'll try really hard to not flame too much here.....
> 
> A while back I found a potentially critical flaw in perl.  Being a
> good person, I went to the perl.org website to report it.  They want
> the report done through perlbug, so I go through that process.  It
> was an important bug, so I marked it as critical.
> 
> Well, it was obviously asking too much to have the latest version of
> perlbug be compatible with the website.  The website didnt' know
> what "critical" means -- apparently it's called "fatal" now.  So it
> didn't assign it a severity.  Oh well, just means it'll take an
> extra few days for someone to notice the bug report.
> 
> I've been checking back every few days to see if anyone has noticed
> it, and this time when I checked back, I can't get in to the
> website.  It prompts for a password.  Even guest logins want a
> password.

The normal way of submitting reports is using 'perlbug' from the
command-line. These requests will end on the perl5-porters mailinglist
where someone is certainly going to pick them up. Btw, the severity you
assign to bugs is not that important. Even if you flag it as 'low' it'll
get noticed.

You will usually be able to see the correspondance following your report
even when you are not subscribed to perl5-porters@perl.org since mails
are normally CC'ed.

> Ok, so I create an account, and log in using that.  What?  Another
> password prompt?  Hrmm... I don't have a password for that one.  Oh
> well.  Guess I can't check on my bug.
> 
> I'm sending this here with the hope that someone with a clue and
> the power to do something will actually take note and get this
> fixed.  While you're at it, could you make the website a bit faster?
> Having to wait a minute for each page to load is rather annoying.

A few days ago Robert Spier made some changes to bugs.perl.org. It's
still being fine-tuned. No reports will be lost.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Tue, 2 Dec 2003 11:01:13 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: redirect using location header does not work from an already redirected doc.
Message-Id: <Pine.LNX.4.53.0312021054470.19981@ppepc56.ph.gla.ac.uk>

On Tue, 1 Dec 2003, Will wrote:

> > Check the CGI specification.  That form of CGI response is mandated to
> > return its results with status 200 (sometimes known as an internal
> > redirection).
>
> yes, but if the script is pointed to by ErrorDocument 404 the header
> is 404.

I'd overlooked that detail of the original problem, yes.  Sorry.

An external redirection will still need status 30x, though.

> I tried adding an addition header 30x or 200 along with location
> header but it just does not work.

That looks like a classic case of what the posting guidelines warn
against.  You haven't said precisely what you did, and you haven't
said precisely what you hoped would happen, and you haven't said what
you found did happen.  "it just does not work" sets off all the alarm
bells here.

[detail omitted]

> > Perlfaq9 points you at appropriate resources (and the appropriate
> > newsgroup for discussing the topic).  Use the FAQs, Luke.
>
> Read them all before, can not find a solution yet.
>
> Where would I post this.

On the group suggested by perlfaq9 (if you can get past the group's
automoderation bot).

Or maybe on the relevant comp.infosystems.www.servers.* group, if this
is in fact an issue with the ErrorDocument configuration rather than
being a specifically CGI issue.

> this is a perl group.

Yes.


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

Date: Tue, 02 Dec 2003 09:45:59 -0500
From: Dan Wilga <dwilga-MUNGE@mtholyoke.edu>
Subject: Re: Unexpected tell() result
Message-Id: <dwilga-MUNGE-104085.09455902122003@nap.mtholyoke.edu>

In article <u9u14rc5ka.fsf@wcl-l.bham.ac.uk>,
 Brian McCauley <nobull@mail.com> wrote:

> > It seems that under glibc 2.3 a file opened in append mode will read
> > from the current file position, but writes always go to the end and do
> > not move that position. Even straight after a write, the file pointer
> > is still at the beginning: pointing at the next byte to be read.
> 
> Yeah, now you describe it that does sound like "the right thing".  But
> not so much so that all other behaviour could be considered "the wrong
> thing".

Then this begs the question: Should Perl account for the fact that this 
code behaves differently on different versions of glibc? Shouldn't Perl 
work the same, independent of glibc version?

-- 
Dan Wilga          dwilga-MUNGE@mtholyoke.edu
** Remove the -MUNGE in my address to reply **


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

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


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