[26566] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8704 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 24 21:05:30 2005

Date: Thu, 24 Nov 2005 18:05:04 -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           Thu, 24 Nov 2005     Volume: 10 Number: 8704

Today's topics:
    Re: CGI::Session install tests fail, can I ignore? <sisyphus1@nomail.afraid.org>
    Re: CGI::Session install tests fail, can I ignore? <sisyphus1@nomail.afraid.org>
        Matching spaces at start of line <pj123781@hotmail.com>
    Re: Matching spaces at start of line <rvtol+news@isolution.nl>
    Re: Matching spaces at start of line <tadmc@augustmail.com>
        Random data function <david@nospam.com>
    Re: Random data function <RedGrittyBrick@SpamWeary.foo>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 25 Nov 2005 08:35:28 +1100
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: CGI::Session install tests fail, can I ignore?
Message-Id: <4386326f$0$26913$afc38c87@news.optusnet.com.au>


<usenet@isbd.co.uk> wrote in message
 .
 .
> Running make test
> PERL_DL_NONLAZY=1 /usr/bin/perl5.8.4 "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
> t/api3_db_file..................NOK 10#     Failed test (t/api3_db_file.t
at line 46)

Looks to me that lines 45 and 46 are:

my $s2 = new CGI::Session("driver:DB_File", $sid, {Directory=>'t'});
ok($s2);

If it were me, I would want to find out why $s2 is undef. Perhaps one of
those 3 arguments is invalid. Stick in a few 'print' statements that will
print out helpful information (eg 'print $sid;'). Is "driver:DB_File" a sane
argument in your environment ?
To run t/api3_db_file.t (without going through the whole rigmarole again)
just run 'perl -Mblib t\api3_db_file.t' from the build directory.

> Can't call method "id" on an undefined value at t/api3_db_file.t line 48.

That's just in response to line 48:

ok($s2->id() eq $sid);

I haven't checked the other errors, but I suspect it's the same issue(s)
that are causing the failures.

I wouldn't install the module until I either :
a) fixed the problem
or
b) verfified that the issue was irrelevant (in my particular case).

Or ... you could just install ... see what happens .... and investigate
further only if something breaks :-)

Cheers,
Rob




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

Date: Fri, 25 Nov 2005 08:54:12 +1100
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: CGI::Session install tests fail, can I ignore?
Message-Id: <438636d0$0$31338$afc38c87@news.optusnet.com.au>


"Sisyphus" <sisyphus1@nomail.afraid.org> wrote in message
news:4386326f$0$26913$afc38c87@news.optusnet.com.au...
>
> <usenet@isbd.co.uk> wrote in message
> .
> .
> > Running make test
> > PERL_DL_NONLAZY=1 /usr/bin/perl5.8.4 "-MExtUtils::Command::MM" "-e"
> "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
> > t/api3_db_file..................NOK 10#     Failed test
(t/api3_db_file.t
> at line 46)
>
> Looks to me that lines 45 and 46 are:
>
> my $s2 = new CGI::Session("driver:DB_File", $sid, {Directory=>'t'});
> ok($s2);
>
> If it were me, I would want to find out why $s2 is undef. Perhaps one of
> those 3 arguments is invalid. Stick in a few 'print' statements that will
> print out helpful information (eg 'print $sid;'). Is "driver:DB_File" a
sane
> argument in your environment ?

Just noticed that there was no problem with:

my $s = new CGI::Session("driver:DB_File", undef, {Directory=>"t"} );

which was executed at the begining. This would suggest that the problem lies
with $sid - unless, for some strange reason, the t really does need to be
surrounded by double quotes, as opposed to single quotes.

Cheers,
Rob




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

Date: 24 Nov 2005 21:30:52 -0000
From: Paul Jones <pj123781@hotmail.com>
Subject: Matching spaces at start of line
Message-Id: <P4XINZHV38681.2297685185@reece.net.au>

Perhaps someone can help me with a little perl problem.

I want to take an message and write it out to a file, but I only 
want specific header information. I have included what I have 
got below (ripped from a mail2news script on the web), however 
the comments header is often split over multiple lines (usually 
4) and I want to include them all. The 2-4th lines of the header 
all begin with spaces (usually 6 - perhaps its a tab).

The program does exactly what I want of it, except for missing 
the lines beginning with a space.




open (INEWS, "| $program $options") ||
    die "$program: can't run $news_poster_program\n";

# header loop
while (<STDIN>) {
   last if /^$/;

   s/(?i)^Date/Date/;
   s/(?i)^From/From/;
   s/(?i)^Subject/Subject/;
   s/(?i)^Newsgroups/Newsgroups/;
   s/(?i)^Comments/Comments/;

   print INEWS

   if /^(Date|From|Subject|Newsgroups|Comments):/i;
   $saw_newsgroup |= ( $+ eq 'Newsgroups' );

}

die "$program: didn't get newsgroup from headers\n"
    unless $saw_newsgroup;

print INEWS "\n";

print INEWS while <STDIN>;   # gobble rest of message




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

Date: Thu, 24 Nov 2005 23:45:09 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Matching spaces at start of line
Message-Id: <dm5jec.v4.1@news.isolution.nl>

Paul Jones schreef:

> Perhaps someone can help me with a little perl problem.
>
> I want to take an message and write it out to a file, but I only
> want specific header information. I have included what I have
> got below (ripped from a mail2news script on the web), however
> the comments header is often split over multiple lines (usually
> 4) and I want to include them all. The 2-4th lines of the header
> all begin with spaces (usually 6 - perhaps its a tab).
>
> The program does exactly what I want of it, except for missing
> the lines beginning with a space.


use strict;
use warnings;

> open (INEWS, "| $program $options") ||
>     die "$program: can't run $news_poster_program\n";
>
> # header loop
> while (<STDIN>) {
>    last if /^$/;

You process line-by-line, but some header fields are folded. Reading the
whole header at once will make things simpler, you won't even need the
while-loop. See perldoc perlvar, specifically $/, the input record
separator.

   local $/ = '';

When the header is in $_, you can use 's/\n\s+/ /g' to unfold the folded
header fields.
(err, that \s needs to be [[:blank:]])

After that you can remove the header fields that you don't want:

  s/\n(?!(Date|From|Subject|Newsgroups|Comments):).*//gi


>    s/(?i)^Date/Date/;
>    s/(?i)^From/From/;
>    s/(?i)^Subject/Subject/;
>    s/(?i)^Newsgroups/Newsgroups/;
>    s/(?i)^Comments/Comments/;

It is better to include the ':' too:

    s/^date:/Date:/mi;


Basically:

#!/usr/bin/perl

use strict;
use warnings;

{ local ($/, $\) = ('', "\n\n");

  # read the header
  $_ = <STDIN>;

  # unfold header fields
  s/\n[[:blank:]]+/ /g;

  # remove unwanted header fields
  s/\n(?!(Date|From|Subject|etc.):).*//gi;

  # standardize header field names
  s/^date:/Date:/mi;
  # etc.

  print;

  # read and print the body
  undef $/;
  undef $\;
  $_ = <STDIN>;
  print;
}

-- 
Affijn, Ruud

"Gewoon is een tijger."



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

Date: Thu, 24 Nov 2005 17:24:14 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Matching spaces at start of line
Message-Id: <slrndocisu.9ek.tadmc@magna.augustmail.com>

Paul Jones <pj123781@hotmail.com> wrote:

> the comments header is often split over multiple lines (usually 
> 4) and I want to include them all. The 2-4th lines of the header 
> all begin with spaces (usually 6 - perhaps its a tab).


>    print INEWS
> 
>    if /^(Date|From|Subject|Newsgroups|Comments):/i;


   if /^(Date|From|Subject|Newsgroups|Comments):/i or /^\s/;


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


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

Date: Thu, 24 Nov 2005 17:52:36 -0500
From: "Dave" <david@nospam.com>
Subject: Random data function
Message-Id: <dm5g7k$fsc$2@zcars129.ca.nortel.com>

Anyone knows if there is any random number generator function in PERL?




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

Date: Thu, 24 Nov 2005 23:55:48 +0000 (UTC)
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: Random data function
Message-Id: <dm5ju4$j1p$1@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com>

Dave wrote:
> Anyone knows if there is any random number generator function in PERL?
> 
> 
perldoc -f rand


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

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


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