[19836] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2031 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 29 14:05:44 2001

Date: Mon, 29 Oct 2001 11: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)
Message-Id: <1004382309-v10-i2031@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 29 Oct 2001     Volume: 10 Number: 2031

Today's topics:
    Re: (RELDATE => $href -> {RELDATE}) =~ tr|/|-| <goldbb2@earthlink.net>
    Re: (RELDATE => $href -> {RELDATE}) =~ tr|/|-| nobull@mail.com
    Re: Any good free syntax coloring editors for Perl on W <darkon@one.net>
    Re: CGI param/regex difficulties <goldbb2@earthlink.net>
    Re: CGI param/regex difficulties <flavell@mail.cern.ch>
        DBI MySQL problems (martinblack)
    Re: DBI MySQL problems <jeff@vpservices.com>
    Re: error on host by running my script, but it works of <nobody@nowhere.com>
        How does a hash know what the keys are... <lmoran@wtsg.com>
    Re: How does a hash know what the keys are... nobull@mail.com
    Re: How does a hash know what the keys are... <lmoran@wtsg.com>
        Inserting text in a file (Pavan)
    Re: Inserting text in a file <jeff@vpservices.com>
    Re: Logic Question <darkon@one.net>
        New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
        Perl 5.6.0 core dump (due to SIGCHILD handler?) (perlsam)
    Re: perl loozer <dha@panix.com>
    Re: problems installing DBD::mysql <m.grimshaw@salford.ac.uk>
    Re: Sorting SGML <user2048@yahoo.com>
    Re: Sorting SGML <goldbb2@earthlink.net>
        Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
        What taints my data? (EED)
    Re: What taints my data? <goldbb2@earthlink.net>
        XML parsing (Spike)
    Re: XML parsing (Clinton A. Pierce)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 29 Oct 2001 11:40:23 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: (RELDATE => $href -> {RELDATE}) =~ tr|/|-|
Message-Id: <3BDD8677.FB77430C@earthlink.net>

Alexander Farber (EED) wrote:
> 
> Hi,
> 
> is there a cool way to set a hash value and simultaneously substitute
> some chars? I am fetching dates from Sybase and would like them to be
> 2001-10-29 instead of 2001/10/29 - but the following doesn't work of course:
[snip]
>     while (my $href = $sth -> fetchrow_hashref)       # create a list of hashes
>     {                                                 # ordered by the RELDATE
>         push @load, {
>                         FILEPATH  => $href -> {FILEPATH},
>                         ACANUMBER => $href -> {ACANUMBER},
>                         REVISION  => $href -> {REVISION},
>                         (RELDATE  => $href -> {RELDATE}) =~ tr|/|-|,
>                     };
>     }

How about replacing this with the following [untested] code:

while (my $href = $sth -> fetchrow_hashref) {
    $href->{RELDATE} =~ tr,/,-,;
    push @load => {%$href};
}

-- 
Klein bottle for rent - inquire within.


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

Date: 29 Oct 2001 17:39:22 +0000
From: nobull@mail.com
Subject: Re: (RELDATE => $href -> {RELDATE}) =~ tr|/|-|
Message-Id: <u97kte5os5.fsf@wcl-l.bham.ac.uk>

"Alexander Farber (EED)" <eedalf@eed.ericsson.se> writes:

> is there a cool way to set a hash value and simultaneously substitute 
> some chars?

The fact that the context of the expresion in your question is a hash
initialiser is incidental.

Your question is essentailly the same as Anonimus Cowerd's question '$x
=~ s/search/replace/ on temporary w/o changing $x' or Gregory Toomey's
'Functional equivant to =~ operator?' or John Lin's classic 'Idiom:
the expression of a copied & substituted string' (March 2001).

This question is probably overdue for inclusion in the FAQ.

For a good discussion see John's post
<9boir8$2ra@netnews.hinet.net> (and the ensuing thread).

http://groups.google.com/groups?selm=9boir8%242ra%40netnews.hinet.net

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Mon, 29 Oct 2001 18:43:26 -0000
From: David Wall <darkon@one.net>
Subject: Re: Any good free syntax coloring editors for Perl on Windows?
Message-Id: <Xns91498B8233057darkononenet@207.126.101.97>

Benjamin Goldberg <goldbb2@earthlink.net> wrote on 29 Oct 2001:

> 
> perltidy does a pretty good job of parsing Perl.
> 
> Hmm, going with the idea of perl can parse perl, how about a B::html
> module, to output an htmlized version of the code?

perltidy will output Perl code as HTML -- with syntax highlighting, even. 

-- 
David Wall
darkon@one.net


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

Date: Mon, 29 Oct 2001 11:20:50 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: CGI param/regex difficulties
Message-Id: <3BDD81E2.B23FC7EF@earthlink.net>

Simon Oliver wrote:
> 
> >     # convert all newlines, whatever they might be, to \n
> >     $data =~ m/(\015\012|\012\015?|\015)/ && $data =~ s/$1/\n/g;
> >     # then split on \n\n.
> >     my @paragraphs = split /\n\n/, $data;
> Am I being dumb...? Why match then subst ?

Umm, because I had originally thought of
    $data =~ m/(\015\012|\012\015?|\015)/
    my @paragraphs = split /$1$1/, $data;
And then changed my mind to the substitute.

I suppose doing:
    $data =~ s/(\015\012|\012\015?|\015)/\n/g;

> $data =~ s/\015\012|\015|\012/\n/g;
> 
> And please correct me if I'm wrong but which OS uses \012\015?
[snip]

None *in particular* but it's entirely possible that broken software of
some sort might do such things.

> And as an aside...
> 
> Under Perl qq{\n} inserts whatever the platform determines is the end
> of line character (as above) but if you want to create "standard" text
> as desrcibed in many RFC's then use CR/LF:

The purpose is not for outputting to some protocol or other, but so that
it could be easily split into paragraphs.

-- 
Klein bottle for rent - inquire within.


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

Date: Mon, 29 Oct 2001 17:35:13 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: CGI param/regex difficulties
Message-Id: <Pine.LNX.4.30.0110291730140.790-100000@lxplus023.cern.ch>

On Oct 29, Simon Oliver inscribed on the eternal scroll:

> Under Perl qq{\n} inserts whatever the platform determines is the end of
> line character

If you're aiming to process data from other platforms over a network
connection, then that doesn't help.  In fact, it only confuses.  Check
perldoc perlport for more-consructive advice on handling "socket"
data.



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

Date: 29 Oct 2001 10:22:12 -0800
From: martinblack26@yahoo.com (martinblack)
Subject: DBI MySQL problems
Message-Id: <c025943b.0110291022.1cb7008f@posting.google.com>

Hi, I've been having trouble with this script from day one. I'm not
sure what the problem is, but I'm trying to query the database with
the form parameters ie: $product_id = $q->param('product_id');. If the
item in question is already in the database, the script should UPDATE.
If not, the script should INSERT. Instead, I get a 500 error. If I
turn the warn flag on, I get:
"Filehandle main::header never opened at add.cgi line 29". and
"Use of uninitialized value at add.cgi line 107". I have totaly
revamped this script about four times, nothing seems to work. Any help
on this would be greatly apprecieated. Thanks in advance.
Cheers. Martinblack. 

Below is a copy of the script:

#!/usr/bin/perl

BEGIN {
open (STDERR, ">html/error.txt");
}

### add.cgi

	use DBI;
	use CGI::Carp qw(fatalsToBrowser carpout);
	use CGI;
	$q=new CGI;


	# input..................................

	$io{'company_id'} = $company_id = $q->param('company_id');
	$io{'product_id'} = $product_id = $q->param('product_id');
	$io{'title'} = $title = $q->param('title');
	$io{'description'} = $description  = $q->param('description');
	$io{'spex'} = $spex  = $q->param('spex');
	$io{'price'} = $price  = $q->param('price');
	$io{'sex'} = $sex  = $q->param('sex');
	

	# mainline...............................


	print header;

	$DBname= "dbi:mysql:minmin";
        $DBhost = "localhost";
        $DBusername = "minmin";
        $DBpassword = "fFUZsFtD";

	$dbh = DBI->connect("$DBname:$DBhost", $DBusername, $DBpassword ||   
  die "connection problem: ", $DBI::errstr;
	$dbh->{'RaiseError'} = 1;

	&kaboom;

	&print_output || die "we've got a problem: ";

  # Disconnect from the database
	$dbh->disconnect || die "disconnection problem: ", $DBI::errstr;
	exit;


 
	# the subs...............................


sub print_output{
   print<<HTML;
    <HTML><BODY>   
    <CENTER><FONT SIZE=5>
     Record added to database
      <P>
     he he he ha ha
      </P>
    </FONT></CENTER>
   </BODY></HTML>
HTML

} 

sub kaboom() { 


	$sth = $dbh->prepare( q[
		SELECT company_id, product_id
		FROM product
		WHERE company_id = ? and 
		product_id= ?
	] ) || die "prep problem: ", $DBI::errstr;
	$sth->execute( $company_id, $product_id ) || die "execution problem:
", $DBI::errstr;

	&fetch_results;
	
		
	if ($newid) {

	$dbh->do(do { local $" = ", "; qq[
		UPDATE product
		SET @{[map "$_ = ?", keys %io]}
		WHERE company_id = ? AND product_id = ?
	] }, undef,
	values %io,
	@io{qw(company_id product_id)} );

	} else {

	$dbh->do(do { local $" = ", "; qq[
		INSERT INTO product (@{[ keys %io ]})
		VALUES (@{[ ('?') x values %io ]})
	] }, undef, values %io );
		   
	}
}


sub fetch_results {
  
    while ($x = $sth->fetchrow_hashref) {
     $com = $x->{'company_id'};
     $pro = $x->{'product_id'};
   }
	$newid = $com ."-".$pro;   
}


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

Date: Mon, 29 Oct 2001 10:46:21 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: DBI MySQL problems
Message-Id: <3BDDA3FD.4C663FA9@vpservices.com>

martinblack wrote:
> 
> "Filehandle main::header never opened at add.cgi line 29". and
> "Use of uninitialized value at add.cgi line 107". 

If we knew which lines in your post of the code are numbers 29 and 107,
we might be able to help.

[snip of post of code whose line numbers are potentially messed up by
line breaks inserted by email programs and which is too long for me to
want to count through even if they weren't]

-- 
Jeff



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

Date: Tue, 30 Oct 2001 03:52:51 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Re: error on host by running my script, but it works offline, why?...
Message-Id: <oFgD7.7176$c5.81691@newsfeeds.bigpond.com>

"John Imrie" <johni@pa.press.net> wrote in message
news:3BDD469E.2030908@pa.press.net...
> This means that you have not red the FAQ that comes with Perl.

http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html

gtoomey





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

Date: Mon, 29 Oct 2001 11:53:32 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: How does a hash know what the keys are...
Message-Id: <eq1rttsgo4fovlf3hprvlf5ht4n5sm3v72@4ax.com>

 ..if I don't tell it?  (and this would be the danger of Cargo
Cult-ing) :)

I have begged and borrowed the following (shortented for the
newsgroup) code:

#! /usr/bin/perl -w
use strict ;
use diagnostics ;
use Text::CSV_XS () ;

my %data ;

parse_status_file("bda.csv", \%data) ;
parse_sal_file( "sal.csv",   \%data ) ;
parse_info_file( "adp.csv",  \%data ) ;

my $csv = Text::CSV_XS->new() ;
foreach my $cur ( sort keys %data ) {
  $csv->combine( $cur,
         @{ $data{$cur} }{qw( 	SSN 		
         			File_Num	
         		      	DOB		
         		      	DOH		
         		      	Reg
         		      	Site
         		      	Termed
         		      	Address_1
         		      	Address_2
         		      	City
         		      	State
         		      	ZIP
         		      	Phone
         		      	Current_Annual
         		      	New_Annual )} ) ;
  print $csv->string, "\n"
}

exit 0 ;

sub parse_sal_file {
  my( $file, $data ) = @_ ;
  local( *CUR ) ;
  open( CUR, $file ) or die "Can't open $file: $!\n";
  scalar <CUR>;    # discard header
  my $csv = Text::CSV_XS->new( );

  while( <CUR> ) {
    $csv->parse( $_ ) ;
    my @cur = $csv->fields() ;

    $data->{ $cur[0] }->{SSN}  = $cur[1] ;
    $data->{ $cur[0] }->{File_Num} = $cur[2] ;
    $data->{ $cur[0] }->{Current_Annual}  = $cur[3] ;
    $data->{ $cur[0] }->{New_Annual}  = $cur[4] ;  
  }

  return

there are other sub routines but (i think) this pretty much explains
what is happening.

Because of various reasons I use the Name as the key instead of the
SSN.  I am using the Name field as the key but to be honest I don't
know how.  

Does a hash take the first "thing" it sees as the key?  If I decide
someday to write another program to do this sort of thing but I want
to use another key I would (at this point) simply move what I want to
be key to the front of the file (which does work) but I was sort of
hoping to know how the process actually works.

(Or is Text::CSV_XS doing something un hash related here?)  

(Ps thanks to Fletch)  

--
TMTOWTDI: My way tends to be wrong...
lmoran@wtsg.com


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

Date: 29 Oct 2001 17:53:06 +0000
From: nobull@mail.com
Subject: Re: How does a hash know what the keys are...
Message-Id: <u94roi5o59.fsf@wcl-l.bham.ac.uk>

Lou Moran <lmoran@wtsg.com> writes:

> ..if I don't tell it?

I does not.  But you do tell it so this is irrelevant.

>  (and this would be the danger of Cargo Cult-ing) :)

> I have begged and borrowed the following (shortented for the
> newsgroup) code:

So what you are saying is you've copied and modified qcode that uses
more advanced concepts than you understand.

>     $data->{ $cur[0] }->{SSN}  = $cur[1] ;
>     $data->{ $cur[0] }->{File_Num} = $cur[2] ;
>     $data->{ $cur[0] }->{Current_Annual}  = $cur[3] ;
>     $data->{ $cur[0] }->{New_Annual}  = $cur[4] ;  

> Does a hash take the first "thing" it sees as the key? 

No, it takes whatever you tell it to.  In this case you tell it to use
$cur[0] (the first element of @cur).

> If I decide someday to write another program to do this sort of
> thing but I want to use another key I would (at this point) simply
> move what I want to be key to the front...

Or simply change which element of @cur you use as the key.

> I was sort of hoping to know how the process actually works.

Learn Perl.

> (Or is Text::CSV_XS doing something un hash related here?)  

Text::CSV_XS in the script you posted is not doing anything related to
hashes.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Mon, 29 Oct 2001 13:25:57 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: How does a hash know what the keys are...
Message-Id: <qn7rttkcojhfer687ekqikqfnqqdn18tu0@4ax.com>

On 29 Oct 2001 17:53:06 +0000, nobull@mail.com wrote wonderful things
about sparkplugs:

>> I was sort of hoping to know how the process actually works.
>
>Learn Perl.

<shrug>I'm working on it...</shrug>

Thanks for explaining this stuff to me anyway.

--
TMTOWTDI: My way tends to be wrong...
lmoran@wtsg.com


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

Date: 29 Oct 2001 08:13:51 -0800
From: pavanka@migv.mot.com (Pavan)
Subject: Inserting text in a file
Message-Id: <f0ea21a.0110290813.4a6a294f@posting.google.com>

I want to insert one line in a file.

say suppose the content of file is as following.

1.BASIC   Beginner's All-Purpose Symbolic Instruction Code
2.CICS    Customer Information Control System
4.COBOL   Common Business Oriented Language
5.DBMS    Data Base Management System

The line which I want to insert is :
" 3.GIGO    Garbage In, Garbage Out " after the 2nd line.

Pls let me know if any body knows about it.

Thanks,

Pavan.


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

Date: Mon, 29 Oct 2001 08:16:09 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Inserting text in a file
Message-Id: <3BDD80C9.74A0E713@vpservices.com>

Pavan wrote:
> 
> I want to insert one line in a file.

"perldoc -q insert" reveals this section title for perlfaq5:

"How do I change one line in a file/delete a line in a 
file/insert a line in the middle of a file/append to
the beginning of a file?"

-- 
Jeff



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

Date: Mon, 29 Oct 2001 18:19:23 -0000
From: David Wall <darkon@one.net>
Subject: Re: Logic Question
Message-Id: <Xns9149876E29EE2darkononenet@207.126.101.97>

bh_ent@hotmail.com (Drew Myers) wrote on 29 Oct 2001:
> I have a list of items which may vary from 15-80 items.  The number of
> items in the list will not vary while the perl script is executing.  I
> store the items in @totest.
> 
> The difficulty I'm having, is I want to do something to all the items,
> but in groups of 20. 

Here's an idea:

for my $position (0 .. $#totest) {
    my $group = int($position / 20);
    # do something to $totest[$position] based on the value of $group
}

The last group will be the one with < 20 items.

There's probably a better way to do this, but that's all I could think of 
off the top of my head -- other than solutions that were longer and looked 
even *more* like C code.  For example (yuck):

my $group=0;
LOOP: while (1) {
    my $position = $group * 20;
    for (0 .. 19) {
        last LOOP if $position >= @totest;
        # do something to $totest[$position]
        $position++;
    }
    $group++;
}


-- 
David Wall
darkon@one.net


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

Date: Mon, 29 Oct 2001 16:07:14 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <ttqvligot9642a@corp.supernews.com>

Following is a summary of articles from new posters spanning a 7 day
period, beginning at 22 Oct 2001 17:29:02 GMT and ending at
29 Oct 2001 14:34:32 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" email address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Find the News-Scan distribution on the CPAN!
      <URL:http://www.perl.com/CPAN/modules/by-module/News/>
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Copyright (c) 2001 Greg Bacon.
      Verbatim copying and redistribution is permitted without royalty;
      alteration is not permitted.  Redistribution and/or use for any
      commercial purpose is prohibited.

Totals
======

Posters:  126 (39.6% of all posters)
Articles: 224 (21.0% of all articles)
Volume generated: 368.9 kb (19.5% of total volume)
    - headers:    175.3 kb (3,620 lines)
    - bodies:     191.7 kb (6,581 lines)
    - original:   124.4 kb (4,482 lines)
    - signatures: 1.8 kb (51 lines)

Original Content Rating: 0.649

Averages
========

Posts per poster: 1.8
    median: 1.0 post
    mode:   1 post - 77 posters
    s:      1.8 posts
Message size: 1686.6 bytes
    - header:     801.3 bytes (16.2 lines)
    - body:       876.2 bytes (29.4 lines)
    - original:   568.5 bytes (20.0 lines)
    - signature:  8.1 bytes (0.2 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

   15    24.5 ( 12.9/ 11.6/  9.3)  Edwin =?iso-8859-1?Q?G=FCnthner?= <edgue@web.de>
    8    16.3 (  6.4/  9.8/  3.0)  "Krishna Kumar" <krishna.kumar@rhii.com>
    6    12.6 (  5.9/  6.7/  2.9)  "Steven Wüthrich" <spam@dsxs.net>
    6    11.7 (  5.7/  6.0/  3.3)  "Exodus" <exodus@thisaintreal.com>
    5     8.1 (  4.5/  3.6/  1.4)  "Kevin Brownhill" <kevinbrownhill@yahoo.com>
    4     4.9 (  3.1/  1.8/  1.1)  Philip S Tellis <philip@ncst.ernet.in>
    4     7.0 (  3.0/  4.0/  1.8)  ek <e_kelleher@hotmail.com>
    4     5.4 (  2.8/  2.6/  1.5)  Lex Thoonen <lex@nospam.peng.nl>
    3     5.1 (  2.5/  2.5/  1.2)  Ren Maddox <lmaddox@us.ibm.com>
    3     5.0 (  2.1/  3.0/  1.8)  "Colin Coe" <coec@iinet.net.au>

These posters accounted for 5.4% of all articles.

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

  24.5 ( 12.9/ 11.6/  9.3)     15  Edwin =?iso-8859-1?Q?G=FCnthner?= <edgue@web.de>
  16.3 (  6.4/  9.8/  3.0)      8  "Krishna Kumar" <krishna.kumar@rhii.com>
  12.6 (  5.9/  6.7/  2.9)      6  "Steven Wüthrich" <spam@dsxs.net>
  11.9 (  1.0/ 10.9/  2.7)      1  "news.earthlink.net" <kbatzer@earthlink.net>
  11.7 (  5.7/  6.0/  3.3)      6  "Exodus" <exodus@thisaintreal.com>
   8.1 (  4.5/  3.6/  1.4)      5  "Kevin Brownhill" <kevinbrownhill@yahoo.com>
   7.0 (  3.0/  4.0/  1.8)      4  ek <e_kelleher@hotmail.com>
   6.7 (  1.9/  4.8/  2.9)      3  Andy Spayam <frank.mckenney.mind@spring.com>
   6.6 (  2.5/  4.2/  2.4)      3  "Jerome" <tanathos21@yahoo.com>
   6.6 (  2.7/  3.8/  2.8)      3  Louis Erickson <wwonko@rdwarf.com>

These posters accounted for 5.9% of the total volume.

Top 10 Posters by OCR (minimum of three posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

1.000  (  0.6 /  0.6)      3  Anand Ramamurthy <anand_ramamurthy@yahoo.com>
0.986  (  2.9 /  3.0)      3  "John Smith" <john@smithIndustries.com>
0.799  (  9.3 / 11.6)     15  Edwin =?iso-8859-1?Q?G=FCnthner?= <edgue@web.de>
0.784  (  1.8 /  2.3)      3  "Eric Tetz" <myfullname@yahoo.com>
0.725  (  2.8 /  3.8)      3  Louis Erickson <wwonko@rdwarf.com>
0.655  (  2.1 /  3.2)      3  "Josh" <void@127.0.0.1>
0.653  (  1.4 /  2.1)      3  "Stephen Graham" <SPG@NoMrtbbrtbrbref.com>
0.610  (  1.8 /  3.0)      3  "Colin Coe" <coec@iinet.net.au>
0.600  (  1.1 /  1.8)      4  Philip S Tellis <philip@ncst.ernet.in>
0.598  (  2.9 /  4.8)      3  Andy Spayam <frank.mckenney.mind@spring.com>

Bottom 10 Posters by OCR (minimum of three posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.568  (  2.4 /  4.2)      3  "Jerome" <tanathos21@yahoo.com>
0.568  (  1.5 /  2.6)      4  Lex Thoonen <lex@nospam.peng.nl>
0.551  (  3.3 /  6.0)      6  "Exodus" <exodus@thisaintreal.com>
0.482  (  1.2 /  2.5)      3  Ren Maddox <lmaddox@us.ibm.com>
0.444  (  1.8 /  4.0)      4  ek <e_kelleher@hotmail.com>
0.438  (  2.9 /  6.7)      6  "Steven Wüthrich" <spam@dsxs.net>
0.427  (  1.3 /  3.1)      3  "Steve Jackson" <steve@NOSPAMdvdcc.com>
0.395  (  1.4 /  3.6)      5  "Kevin Brownhill" <kevinbrownhill@yahoo.com>
0.311  (  3.0 /  9.8)      8  "Krishna Kumar" <krishna.kumar@rhii.com>
0.206  (  0.9 /  4.1)      3  "Patrick J. Larkin" <plarkin@beth.k12.pa.us>

21 posters (16%) had at least three posts.

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      18  comp.lang.perl
      14  comp.lang.perl.modules
       3  comp.perl.lang.modules
       3  comp.lang.perl.moderated
       1  comp.answers
       1  comp.admin.policy
       1  comp.infosystems.www.misc
       1  comp.infosystems.www.servers.unix
       1  comp.protocols.snmp
       1  news.answers

Top 10 Crossposters
===================

Articles  Address
--------  -------

       6  "Steven Wüthrich" <spam@dsxs.net>
       3  Anand Ramamurthy <anand_ramamurthy@yahoo.com>
       1  steve <sstod@family-net.net>
       1  Jennifer Cranfill <cranfill@lclark.edu>
       0  adam denenberg <adam@dberg.org>
       0  "Andreas Winter" <awin@wros.de>
       0  "Jerome" <tanathos21@yahoo.com>
       0  wbracken <aacbracken@hotmail.com>
       0  "Alex Davidson" <alexd@NOSPAMsynergycsi.com>
       0  "M G" <perl.news@lfjr.net>


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

Date: 29 Oct 2001 10:59:44 -0800
From: sameervk@eudoramail.com (perlsam)
Subject: Perl 5.6.0 core dump (due to SIGCHILD handler?)
Message-Id: <4c20592c.0110291059.1c853e36@posting.google.com>

Hello,

I'm trying to track down the cause of this core dump. It seems to be
related to a signal handler for SIGCHILD. Any hints about where to
look would be much appreciated. The code is running on a Solaris 2.8
box.

Here is the signal handler code:

sub REAPER
{   
    my $pid         = waitpid(-1, &POSIX::WNOHANG);
    if ($pid == -1) {
        # no child waiting. Ignore it.
    }
    elsif (POSIX::WIFEXITED($?)) {
        # Child has actually exited only now
        $EXITED_PID = $pid;
    }
    else {
#        warn "False alarm on $pid";
    }
    $SIG{'CHLD'} = \&REAPER; # in case of unreliable signals   
}

I also have a 'use sigtrap' since I wanted a Perl code stacktrace.
That does not seem to work since the only message was:

Segmentation fault (core dumped)

gdb stack trace:

(gdb) bt
#0  0xd150c in Perl_newSV (len=0) at sv.c:3165
#1  0xb41f8 in Perl_newAV () at av.c:310
#2  0xfbf1c in Perl_new_stackinfo (stitems=32, cxitems=25) at
scope.c:83
#3  0xae760 in Perl_sighandler (sig=11) at mg.c:2166
#4  <signal handler called>
#5  0xd150c in Perl_newSV (len=0) at sv.c:3165
#6  0xb41f8 in Perl_newAV () at av.c:310
#7  0xfbf1c in Perl_new_stackinfo (stitems=32, cxitems=25) at
scope.c:83
#8  0xa22dc in Perl_vwarner (err=21, pat=0x160560 "Attempt to free
temp prematurely: SV 0x%lx", args=0xffbeba04) at util.c:1862
#9  0xa18b8 in Perl_warner (err=21, pat=0x160560 "Attempt to free temp
prematurely: SV 0x%lx") at util.c:1781
#10 0xd3da8 in Perl_sv_free (sv=0xefe2e4) at sv.c:3774
#11 0xa8688 in Perl_magic_setsig (sv=0x1bc1f4, mg=0x1bf188) at
mg.c:1027
#12 0xa5cfc in Perl_mg_set (sv=0x1bc1f4) at mg.c:158
#13 0xb84d4 in Perl_pp_sassign () at pp_hot.c:117
#14 0xb78c0 in Perl_runops_debug () at run.c:56
#15 0x2d510 in S_call_body (myop=0xffbebde0, is_eval=0) at perl.c:1761
#16 0x2cb3c in perl_call_sv (sv=0xe68284, flags=2) at perl.c:1638
#17 0xae930 in Perl_sighandler (sig=18) at mg.c:2171
#18 <signal handler called>
#19 0xff21a744 in _read () from /usr/lib/libc.so.1
#20 0xff20afe0 in _filbuf () from /usr/lib/libc.so.1
#21 0xd574c in Perl_sv_gets (sv=0x1693200, fp=0x17f7d0, append=0) at
sv.c:4256
#22 0x116fd0 in Perl_pp_backtick () at pp_sys.c:335
#23 0xb78c0 in Perl_runops_debug () at run.c:56
#24 0x2c220 in S_run_body (oldscope=1) at perl.c:1401
#25 0x2bbe0 in perl_run (my_perl=0x180008) at perl.c:1325
#26 0x27104 in main (argc=9, argv=0xffbee75c, env=0xffbee784) at
perlmain.c:52

perl -V:

Summary of my perl5 (revision 5.0 version 6 subversion 0)
configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos perth 5.6 generic_105181-17 sun4u sparc sunw,ultra-60
'
    config_args='-d'
    hint=previous, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef
usesocks=undef
  Compiler:
    cc='gcc', optimize='-g', gccversion=2.7.2.1
    cppflags='-g -DDEBUGGING -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64'
    ccflags ='-DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    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, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib '
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt -lsec
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: DEBUGGING USE_LARGE_FILES
  Built under solaris
  Compiled at Oct 26 2001 17:22:55
  @INC:
    /usr/local/perllib/sun4-solaris
    /usr/local/perllib
    /usr/local/perllib/site_perl/5.6.0/sun4-solaris
    /usr/local/perllib/site_perl/5.6.0
    /usr/local/perllib/site_perl

Thanks
Sameer


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

Date: 29 Oct 2001 18:53:31 GMT
From: "David H. Adler" <dha@panix.com>
Subject: Re: perl loozer
Message-Id: <slrn9tr9db.eho.dha@panix2.panix.com>

In article <m3pu79nh4m.fsf@mumonkan.sunstarsys.com>, Joe Schaefer wrote:
> Jonathan Stowe <gellyfish@gellyfish.com> writes:
> 
>> The construct :
>> 
>> print <<EOF;
>> 
>> EOF
>> 
>> is discussed in the perlop manpage in some detail.  
>                       ^^^^^^
> 
> ITYM "perldata" here, but you're right- it probably 
> *should* be in perlop.

The current development version of perl should now have it there,
demonstrating the power of actually submitting a patch. :-)

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
It's amazing what giant mutant ants that are the result of Man's
dabbling with the power of atomic energy can accomplish when they set
themselves to the task.    - Mark Rogaski


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

Date: Mon, 29 Oct 2001 18:30:46 +0000
From: mark grimshaw <m.grimshaw@salford.ac.uk>
Subject: Re: problems installing DBD::mysql
Message-Id: <3BDDA056.CB1D0167@salford.ac.uk>

"John J. Trammell" wrote:

> On Sun, 28 Oct 2001 13:57:07 +0000, mark grimshaw wrote:
> > As above on Linux RH7.0.  I have mysql installed (rpm -q mysql reports:
> > mysql-3.23.22-6) and mysqld is running without problems.  However,
> > trying to install DBD::mysql either via CPAN or manually produces errors
> > on make test -
> > no such file or directory for:
> > mysql.h
> > and
> > errmsg.h
> >
> > I thought I should install Mysql from cpan.  The CPAN install Mysql
> > starts by attempting to install DBD::mysql and produces the same
> > messages.
> >
> > Anyone know what package I'm missing and where to get it from?
> >
> You need to install the MySQL development package, whatever it
> may be called.  A quick Google search turned up an RPM
> "MySQL-devel-3.23.40-1", which may be the wrong version for you.

I started downloading that but it turned out I didn't need it.  Having
installed Mysql again and figured out that I had to get rid of the rpm
(/var/....) installation I'd done months back to get the new mysql working
properly in /usr/local/...., DBD::mysql threw up a problem complaining, during
make test, that the server wasn't running or that I didn't have permissions
(as root) to do the tests on the test database.  I'm new to mysql so couldn't
figure this one out as the mysql server was running.  However, I went ahead
with the make install and it now seems happy.  Thanks for the help.



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

Date: 29 Oct 2001 15:49:52 GMT
From: user2048 <user2048@yahoo.com>
Subject: Re: Sorting SGML
Message-Id: <Xns9149701EFF8AAmytokxyzzy@209.155.56.81>

Whatever you do, use a real SGML parser (ex. one based on James Clark's 
SP). There are perl modules to make interfacing easy.

Don't try to build your own parser with regexps, etc., if you want
robust SGML parsing.

Or convert the data to XML (using James Clark's SX) and then use
the perl XML modules.

"Nik" <L.N.Jewell@remove_this.leeds.ac.uk> wrote in
news:pan.2001.10.29.13.34.28.470.20404@remove_this.leeds.ac.uk: 

> Hi
> 
> I'm looking for a way to efficiently sort some SGML records...


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

Date: Mon, 29 Oct 2001 11:34:23 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Sorting SGML
Message-Id: <3BDD850F.3A87B4F1@earthlink.net>

Nik wrote:
> 
> Hi
> 
> I'm looking for a way to efficiently sort some SGML records.  An
> example would be the following (there are around 5000):
> 
> <ENTRY>
> <PERSNAME ID="PierreAbailard">Abailard, Pierre
> <GENDER>M</GENDER>
> <PERSDATE FROM="1079" TO="1142">1079&ndash;1142</PERSDATE>
> <SOURCE><BIBL INDEX="DSB"><I>DSB</I></BIBL></SOURCE>
> </PERSNAME>
> </ENTRY>
> 
> <ENTRY>
> <PERSNAME ID="HenryLAbbot">Abbot, Henry Larcom
> <GENDER>M</GENDER>
> <PERSDATE FROM="1831" TO="1927">1831&ndash;1927</PERSDATE>
> <SOURCE><BIBL INDEX="WBI"><I>WBI</I></BIBL></SOURCE>
> </PERSNAME>
> </ENTRY>
> 
> What I need to do is sort them on the Surname in the PERSNAME ID.
> 
> I'm no perl expert (as you'll be able to tell in a moment) and I am
> not sure of the most efficient way to do this.  One idea I had was to
> concatenate each record into a single line with separators, use
> regexps to extract the names and make them keys for the records in a
> hash, and sort the keys, and then outputting them again.
> 
> Is this the most efficient strategy?  I'm not looking for code., just
> strategic suggestions.

I don't see the point of concatenating each record into one line.
It seems to be something which would be done as a workaround for having
stupidly split on every newline.

The simplest hack I could think of for dealing with data like you have
would be something like this:

$/ = ""; # read in paragraph mode.
my %hash;
wihle( <> ) {
    m[<PERSNAME[^>]*>(.*)]
        or die "Paragraph $. contained no PERSNAME field.\n";
    $hash{$1} = $_;
}
print for @hash{sort keys %hash};
__END__

This of course is highly dependent on your data being in precisely the
format you've described.  If there might be any \n\n sequences anywhere
within a single entry, it won't work.

-- 
Klein bottle for rent - inquire within.


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

Date: Mon, 29 Oct 2001 16:07:09 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <ttqvldik9fr127@corp.supernews.com>

Following is a summary of articles spanning a 7 day period,
beginning at 22 Oct 2001 17:29:02 GMT and ending at
29 Oct 2001 14:34:32 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" email address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Find the News-Scan distribution on the CPAN!
      <URL:http://www.perl.com/CPAN/modules/by-module/News/>
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Copyright (c) 2001 Greg Bacon.
      Verbatim copying and redistribution is permitted without royalty;
      alteration is not permitted.  Redistribution and/or use for any
      commercial purpose is prohibited.

Excluded Posters
================

perlfaq-suggestions\@(?:.*\.)?perl\.com
faq\@(?:.*\.)?denver\.pm\.org

Totals
======

Posters:  318
Articles: 1066 (445 with cutlined signatures)
Threads:  260
Volume generated: 1894.2 kb
    - headers:    883.8 kb (17,503 lines)
    - bodies:     954.5 kb (32,293 lines)
    - original:   576.5 kb (20,948 lines)
    - signatures: 54.8 kb (1,281 lines)

Original Content Rating: 0.604

Averages
========

Posts per poster: 3.4
    median: 1.0 post
    mode:   1 post - 164 posters
    s:      5.8 posts
Posts per thread: 4.1
    median: 3.0 posts
    mode:   1 post - 60 threads
    s:      4.5 posts
Message size: 1819.6 bytes
    - header:     849.0 bytes (16.4 lines)
    - body:       916.9 bytes (30.3 lines)
    - original:   553.8 bytes (19.7 lines)
    - signature:  52.6 bytes (1.2 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

   50    90.1 ( 40.3/ 47.8/ 24.5)  Benjamin Goldberg <goldbb2@earthlink.net>
   39    65.6 ( 33.8/ 31.7/ 11.0)  Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
   28    42.2 ( 24.6/ 17.4/ 10.4)  Bart Lateur <bart.lateur@skynet.be>
   27    77.3 ( 31.8/ 41.8/ 31.1)  tadmc@augustmail.com
   26    62.5 ( 23.3/ 33.9/ 20.1)  mgjv@tradingpost.com.au
   20    38.0 ( 16.0/ 22.0/ 13.0)  Andrew Cady <please@no.spam>
   20    51.1 ( 17.7/ 27.3/ 20.3)  Mark Jason Dominus <mjd@plover.com>
   18    31.6 ( 16.5/ 15.0/ 10.6)  Jeff Zucker <jeff@vpservices.com>
   17    29.1 ( 11.2/ 15.6/  7.9)  Jonathan Stowe <gellyfish@gellyfish.com>
   17    36.3 ( 14.7/ 17.8/  7.6)  Uri Guttman <uri@sysarch.com>

These posters accounted for 24.6% of all articles.

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

  90.1 ( 40.3/ 47.8/ 24.5)     50  Benjamin Goldberg <goldbb2@earthlink.net>
  77.3 ( 31.8/ 41.8/ 31.1)     27  tadmc@augustmail.com
  65.6 ( 33.8/ 31.7/ 11.0)     39  Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
  62.5 ( 23.3/ 33.9/ 20.1)     26  mgjv@tradingpost.com.au
  51.1 ( 17.7/ 27.3/ 20.3)     20  Mark Jason Dominus <mjd@plover.com>
  44.8 ( 12.9/ 29.2/ 23.6)     16  Logan Shaw <logan@cs.utexas.edu>
  42.2 ( 24.6/ 17.4/ 10.4)     28  Bart Lateur <bart.lateur@skynet.be>
  38.0 ( 16.0/ 22.0/ 13.0)     20  Andrew Cady <please@no.spam>
  36.3 ( 14.7/ 17.8/  7.6)     17  Uri Guttman <uri@sysarch.com>
  32.8 ( 10.6/ 22.0/ 13.3)     14  garry@zvolve.com

These posters accounted for 28.5% of the total volume.

Top 10 Posters by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

1.000  ( 10.0 / 10.0)     11  "Steffen Müller" <tsee@gmx.net>
0.887  (  2.3 /  2.5)      5  Richard Trahan <rtrahan@monmouth.com>
0.842  (  9.9 / 11.8)      8  "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.li>
0.821  (  3.8 /  4.7)      8  "Diehard Duck" <diehard@nospam.userve.co.uk>
0.817  (  7.5 /  9.2)     12  Lou Moran <lmoran@wtsg.com>
0.806  ( 23.6 / 29.2)     16  Logan Shaw <logan@cs.utexas.edu>
0.799  (  9.3 / 11.6)     15  Edwin =?iso-8859-1?Q?G=FCnthner?= <edgue@web.de>
0.761  (  2.7 /  3.5)      8  "Graham W. Boyes" <me@REMOVETHIStoao.net>
0.744  ( 31.1 / 41.8)     27  tadmc@augustmail.com
0.744  ( 20.3 / 27.3)     20  Mark Jason Dominus <mjd@plover.com>

Bottom 10 Posters by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.438  (  2.9 /  6.7)      6  "Steven Wüthrich" <spam@dsxs.net>
0.430  (  7.6 / 17.8)     17  Uri Guttman <uri@sysarch.com>
0.426  (  4.2 /  9.8)     12  Ilya Zakharevich <nospam-abuse@ilyaz.org>
0.395  (  1.4 /  3.6)      5  "Kevin Brownhill" <kevinbrownhill@yahoo.com>
0.348  ( 11.0 / 31.7)     39  Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
0.347  (  1.9 /  5.5)     12  Tony Curtis <tony_curtis32@yahoo.com>
0.327  (  2.5 /  7.8)     11  usenet@jasonkohles.com
0.326  (  2.8 /  8.7)      7  Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
0.311  (  3.0 /  9.8)      8  "Krishna Kumar" <krishna.kumar@rhii.com>
0.282  (  2.6 /  9.2)     14  John J. Trammell <trammell@haqq.hypersloth.invalid>

47 posters (14%) had at least five posts.

Top 10 Threads by Number of Posts
=================================

Posts  Subject
-----  -------

   38  Perl Vs. Java
   26  What's wrong with File::Find
   20  What the **** is WRONG with this!?
   17  how to set up a CGI on my webpage
   15  NEWBIE: double sort on a string
   14  What exactly will "make install" do for my module?
   13  Newbie.
   13  lookingglass.pl
   13  Form Validation, detecting a comma
   12  Plaintext to passwd file?

These threads accounted for 17.0% of all articles.

Top 10 Threads by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Subject
--------------------------  -----  -------

  86.5 ( 32.6/ 51.2/ 30.6)     38  Perl Vs. Java
  48.1 ( 25.0/ 21.1/ 12.5)     26  What's wrong with File::Find
  33.7 ( 16.9/ 16.8/  8.2)     17  how to set up a CGI on my webpage
  32.4 ( 12.0/ 17.9/ 13.2)     13  lookingglass.pl
  31.6 ( 18.3/ 10.4/  5.6)     20  What the **** is WRONG with this!?
  30.4 (  9.8/ 19.4/ 13.0)     12  Plaintext to passwd file?
  30.2 ( 13.0/ 16.5/  7.5)     15  NEWBIE: double sort on a string
  26.4 ( 12.2/ 12.8/  7.0)     12  variable replacement
  24.5 ( 11.3/ 12.0/  7.1)     13  Newbie.
  24.0 ( 13.8/  9.8/  4.4)     14  What exactly will "make install" do for my module?

These threads accounted for 19.4% of the total volume.

Top 10 Threads by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.783  (  9.4/  12.0)      6  regular expression for url
0.768  (  3.8/   4.9)      8  Tracing ["non-interactive debugging"] like in REXX?
0.760  (  6.0/   7.9)      6  Memory management
0.751  (  3.5/   4.6)      8  perl loozer
0.738  ( 13.2/  17.9)     13  lookingglass.pl
0.737  (  1.5/   2.1)      5  Split on Win32
0.727  (  1.9/   2.7)      5  Dumping Perl Hashes
0.718  (  6.1/   8.5)     11  Hash to Array?
0.717  (  2.4/   3.4)      9  Jon Ericson
0.677  (  3.3/   4.8)     10  frage zum datum

Bottom 10 Threads by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.463  (  3.3 /  7.1)      8  getting %errorlevel% values with perl?
0.453  (  7.5 / 16.5)     15  NEWBIE: double sort on a string
0.443  (  4.4 /  9.8)     14  What exactly will "make install" do for my module?
0.428  (  1.6 /  3.7)      7  CPAN.pm complaining all the time
0.412  (  2.1 /  5.2)      6  a search question
0.389  (  1.9 /  5.0)     12  one-liner solution sought
0.377  (  2.8 /  7.5)      6  Greediness and Regular Expressions
0.375  (  0.4 /  1.1)      5  Break
0.368  (  3.2 /  8.6)      5  IIS and Perl - Why the corruption?
0.339  (  2.9 /  8.6)     11  Stripping Duplicates From Arrays

73 threads (28%) had at least five posts.

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      18  comp.lang.perl
      14  comp.lang.perl.modules
       3  comp.perl.lang.modules
       3  comp.lang.perl.moderated
       1  comp.answers
       1  comp.admin.policy
       1  comp.infosystems.www.misc
       1  comp.infosystems.www.servers.unix
       1  comp.protocols.snmp
       1  news.answers

Top 10 Crossposters
===================

Articles  Address
--------  -------

       6  "Steven Wüthrich" <spam@dsxs.net>
       5  Mark Taylor <mtaylor@lrim.com>
       4  Jeff Zucker <jeff@vpservices.com>
       3  Ann Tsai <mktgadm@usenix.org>
       3  Anand Ramamurthy <anand_ramamurthy@yahoo.com>
       2  hugo <hugo@fractalgraphics.com.au>
       2  jari.aalto@poboxes.com
       2  "Eric McDaniel" <ericm@vertical.com>
       2  "William Seeley" <william-seeley@home.com>
       2  "Tony McIver" <tmciver@yottanetworks.com>


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

Date: Mon, 29 Oct 2001 17:30:51 +0100
From: "Alexander Farber (EED)" <eedalf@eed.ericsson.se>
Subject: What taints my data?
Message-Id: <3BDD843B.1AF44617@eed.ericsson.se>

Hi,

the following CGI-script prints this error message:

  Insecure dependency in unlink while running with -T switch at
  /opt/local/perl-5.6.0/lib/5.6.0/File/Path.pm line 220. END failed--
  call queue aborted. 

when I uncomment the extract_files call below:

    for my $href (@$load)
    {
        my ($tempdir, $archive, $files);
        
        $archive = $href -> {FILEPATH};
        $tempdir = tempdir (CLEANUP => 1);
        chdir $tempdir or die "Can't change to $tempdir: $!\n";
    
        print "Changed current directory to $tempdir --\n";
          
        $files = list_files ($archive);
        die "No files found in $archive\n" unless @$files;
          
        #extract_files ($archive, $files);    # <=== THIS LINE
    }

I wonder what causes it, since the extract_files 
just extracts some files by opening pipes: 


    $ENV{PATH}            = '';
    $ENV{IFS}             = '';

$CAT    = '/bin/cat';
$GREP   = '/usr/bin/grep';
$GUNZIP = '/usr/bin/gunzip';
$LS     = '/bin/ls';
$TAR    = '/usr/bin/tar';
$UNZIP  = '/opt/local/bin/unzip';

local $File::Temp::DEBUG = 1;

sub extract_files ($$)
{
    my $archive = shift;
    my $files   = shift;
        
    if ($archive =~ /\.tar\.zip$/i)
    {   
        system ("$UNZIP -p $archive | $TAR xf - @$files") and die $!;
    }                       
    elsif ($archive =~ /\.tar$/i)
    {   
        system ("$TAR xf - @$files") and die $!;
    }
    elsif ($archive =~ /\.zip$/i)
    {
        system ("$UNZIP $archive @$files") and die $!;
    }
    elsif ($archive =~ /\.tar\.gz$/i or
           $archive =~ /\.tar\.Z$/i  or 
           $archive =~ /\.tgz$/i     or
           $archive =~ /\.taz$/i)
    {
        system ("$GUNZIP -c $archive | $TAR xf - @$files") and die $!;
    } 
    elsif ($archive =~ /\.gz$/i or
           $archive =~ /\.Z$/i)
    { 
        system ("$GUNZIP -c $archive > @$files") and die $!;
    }
    else
    {
        system ("$CAT $archive > @$files") and die $!;
    }
}


And is there a way to "untaint" this subroutine?

I also wonder how does perl "see" that extract_files
is dangerous, but the list_files is not (the script
behaviour doesn't change if I commoent it or not):

sub list_files ($)
{
    my $archive = shift;

    my ($pipe, @files);
                                                      # list all files:
    if ($archive =~ /\.tar\.zip$/i)
    {
        open ($pipe, "$UNZIP -p $archive | $TAR tf - |");
    }
    elsif ($archive =~ /\.tar$/i)
    {
        open ($pipe, "$TAR tf - |");
    }
    elsif ($archive =~ /\.zip$/i)
    {
        open ($pipe, "$UNZIP -Z1 $archive |");
    }
    elsif ($archive =~ /\.tar\.gz$/i or
           $archive =~ /\.tar\.Z$/i  or
           $archive =~ /\.tgz$/i     or
           $archive =~ /\.taz$/i)
    {
        open ($pipe, "$GUNZIP -c $archive | $TAR tf - |");
    }
    elsif ($archive =~ /\.gz$/i or                    # 1 file in archive
           $archive =~ /\.Z$/i)
    {
        open ($pipe, "$GUNZIP -l $archive |");
    }
    else                                              # 1 uncompressed file
    {
        open ($pipe, "$LS $archive |");
    }

    die "Can't open pipe: $!\n" unless $pipe;

    while (<$pipe>)
    {                                                      # skip abs. paths
        next if $archive =~ /\.t(?:ar|az|gz)/i and /^\//;  # in tar-archives
        push @files, $1 if /([\w\/.-]+?\.c[lr]\d+)$/i;
    }

    close $pipe or die "Couldn't open pipe: $!\n";
    return \@files;
}

Regards
Alex


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

Date: Mon, 29 Oct 2001 11:57:11 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: What taints my data?
Message-Id: <3BDD8A67.B1ECE214@earthlink.net>

Alexander Farber (EED) wrote:
> 
> Hi,
> 
> the following CGI-script prints this error message:
> 
>   Insecure dependency in unlink while running with -T switch at
>   /opt/local/perl-5.6.0/lib/5.6.0/File/Path.pm line 220. END failed--
>   call queue aborted.
> 
> when I uncomment the extract_files call below:
[snip]
>         $archive = $href -> {FILEPATH};
[snip]
>         $files = list_files ($archive);
[snip]
>         #extract_files ($archive, $files);    # <=== THIS LINE
>     }
> 
> I wonder what causes it, since the extract_files
> just extracts some files by opening pipes:

The problem is that the contents of $files is tainted, since it was
produced as the output of an external program.

-- 
Klein bottle for rent - inquire within.


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

Date: 29 Oct 2001 08:32:22 -0800
From: just.ice@mailcity.com (Spike)
Subject: XML parsing
Message-Id: <25e4dd8c.0110290832.6fca9b23@posting.google.com>

Hi. I am new to XML parsing and have enherited some code which uses
XMl::Simple.
This reads in the entire XML file and parses it into a data structure.
However, when a large file is encountered the machine runs out of
memory.

Is there some other way to deal with these XML files rather than the
way outlined above? Perhaps a module which deals with the file in a
step-wise fashion?

Thanks

Spike


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

Date: Mon, 29 Oct 2001 17:19:20 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: XML parsing
Message-Id: <scgD7.208490$K6.102361850@news2>

[Posted and mailed]

In article <25e4dd8c.0110290832.6fca9b23@posting.google.com>,
	just.ice@mailcity.com (Spike) writes:
> Hi. I am new to XML parsing and have enherited some code which uses
> XMl::Simple.
> This reads in the entire XML file and parses it into a data structure.
> However, when a large file is encountered the machine runs out of
> memory.
> 
> Is there some other way to deal with these XML files rather than the
> way outlined above? Perhaps a module which deals with the file in a
> step-wise fashion?

I'm fond of XML::Parser.  The event-driven nature of the module makes 
finding needles in large haystacks quite efficient.


-- 
    Clinton A. Pierce            Teach Yourself Perl in 24 Hours  *and*
  clintp@geeksalad.org                Perl Developer's Dictionary
"If you rush a Miracle Man,     for details, see http://geeksalad.org     
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

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


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