[30153] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1396 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 27 03:09:41 2008

Date: Thu, 27 Mar 2008 00:09:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 27 Mar 2008     Volume: 11 Number: 1396

Today's topics:
    Re: Aspell, perl and piping <ben@morrow.me.uk>
    Re: BEGIN, INIT etc... <uri@stemsystems.com>
    Re: display in a tree structure <vakayil.thobias@alcatel-lucent.com>
    Re: mysql_server_init error <ben@morrow.me.uk>
        need help on cgi to get multi pages and could sort by c <robertchen117@gmail.com>
        new CPAN modules on Thu Mar 27 2008 (Randal Schwartz)
    Re: Pattern matching <deepan.17@gmail.com>
        perl and cgi <ela@yantai.org>
    Re: perl and cgi <benkasminbullock@gmail.com>
    Re: perl and cgi <john@castleamber.com>
    Re: perl and cgi <ela@yantai.org>
    Re: pipe for stderr and stdout <ivan@0x4849.net>
    Re: pipe for stderr and stdout <noreply@gunnar.cc>
    Re: Readline using foreach and while <benkasminbullock@gmail.com>
    Re: Readline using foreach and while <szrRE@szromanMO.comVE>
    Re: The huge amount response data problem <falconzyx@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 27 Mar 2008 02:22:13 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Aspell, perl and piping
Message-Id: <lvcrb5-os21.ln1@osiris.mauzo.dyndns.org>


Quoth Sherman Pendley <spamtrap@dot-app.org>:
> Bill H <bill@ts1000.us> writes:
> 
> > system("aspell -a < checkthis.txt > errors.txt");
> >
> > but I would like to avoid if possible having to write the file and
> > then open and read the errors.txt file. Is there a way to pipe this
> > information straight from perl and get the results back?
> 
> Have a look at IPC::Open2, or IPC::Open3 if you're also interested in
> stderr.

IPC::Run is easier to use, and harder to get wrong.

Ben



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

Date: Thu, 27 Mar 2008 03:26:31 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: BEGIN, INIT etc...
Message-Id: <x7abkkalug.fsf@mail.sysarch.com>

>>>>> "p" == pgodfrin  <pgodfrin@gmail.com> writes:

  p> On Mar 26, 5:37 pm, xhos...@gmail.com wrote:
  >> pgodfrin <pgodf...@gmail.com> wrote:
  >> > On Mar 26, 3:49 pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
  >> > > pgodfrin wrote:
  >> > > > Anyone know of a good article that discusses when and why you would
  >> > > > use the BEGIN, UNITCHECK, CHECK, INIT and END code blocks?
  >> 
  p> Sorry - didn't mean to impugn the quality of the docs. All I was
  p> looking for is some sort of article from a trade rag, for instance,
  p> that discussed the utility of those code blocks. You know, maybe some
  p> sort of article where a really good Perl programmer describes how he
  p> (or she :) ) uses those code blocks in an effective manner.

simple answer is to ignore INIT, CHECK and the new UNITCHECK. they are
only for specialized modules and newbies should never need to go near
them. they fall into the rule (which covers symrefs and string eval)
that you shouldn't use them until you know when you don't need them. 

BEGIN and END are much more useful and you seem to know about them.

they are commonly used when you need to do something as soon as that
block of code is parsed (BEGIN) or when the program is exiting
(END). and the above rule applies as you don't know when you need or not
need them so don't bother to learn them yet. once you get into perl
deeper you will know more about initialization, compile vs runtime and
destruction. but now you don't know those so ignore BEGIN/END until you
need to learn them.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Thu, 27 Mar 2008 10:12:21 +0530
From: "Vakayil Thobias" <vakayil.thobias@alcatel-lucent.com>
Subject: Re: display in a tree structure
Message-Id: <1206592944.170356@slbhw0>


"Martijn Lievaart" <m@rtij.nl.invlalid> wrote in message 
news:pan.2008.03.26.23.19.48@rtij.nl.invlalid...
> On Wed, 26 Mar 2008 16:37:32 +0530, Vakayil Thobias wrote:
>
>> Hello,
>>
>> I have to display the data from a file in tree structure(perl). The file
>> format is as follows(first field parent, second field child) :
>>
>> PM01 PM02
>> PM01 PM1A
>> PM02 PM03
>> PM03 PM04
>> PM04 PM05
>> PM04 PM06
>> PM1A PM1B
>> PM1A PM1C
>>
>> The output should be like this :
>> PM01 -- PM02 -- PM03 -- PM04 -- PM05
>>                                                            PM06
>> PM01     PM1A -- PM1B
>>                               PM1C
>>
>> Anybody have idea ?
>
> Something like (got a bit more complicated than I thought at first,
> someone is bound to come up with a better/shorter solution):
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> # Note all the commented out debug code!
> #use Data::Dumper;
>
> # read in the file
> # remember both parent -> children and
> # child -> parent
>
> # Need to remember all children to print the tree
> my %children;
>
> # Need to remember all parents to find all roots
> my %parent;
>
> while (<DATA>) {
>  my ($parent, $child) = split;
>  die if exists $parent{$child};
>  $parent{$child} = $parent;
>  push @{$children{$parent}}, $child;
> }
>
> #print Data::Dumper->Dump([\%parent], ["*parent"]), "\n";
> #print Data::Dumper->Dump([\%children], ["*children"]), "\n";
>
> # Get all nodes without a parent, those are the roots
> my @roots = grep { not exists $parent{$_} } keys %children;
> #print Data::Dumper->Dump(\@roots, ["*roots"]), "\n";
>
> # Print the tree
> for (@roots) {
>  print "$_";
>  print_children(1, $children{$_} );
> }
>
> # Print all children of the current node
> #
> # Parameters:
> # - $indent: The amount of nodes to indent
> # - $children_ref: reference to an array containing all children
> #                  or undef if there are no children.
> #
> sub print_children {
>  my ($indent, $children_ref) = @_;
>
>  # No children? Print a newline and quit this branch.
>  unless ($children_ref) {
>    print "\n";
>    return;
>  }
>
>  # There are children, print each one on a new line,
>  # with the proper indent. Use "+-" if more than one child,
>  # use "--" if only one. That way we get a nice tree look.
>  my @children = @$children_ref;
>  my $sep = @children==1 ? "--" : "+-";
>  my $first = 1;
>  for (@children) {
>    my $spaces = $first ? 0 : $indent*8-4;
>    $first = 0;
>    print " "x$spaces, " $sep ", $_;
>    print_children($indent+1, $children{$_});
>  }
> }
>
> __DATA__
> PM01 PM02
> PM01 PM1A
> PM02 PM03
> PM03 PM04
> PM04 PM05
> PM04 PM06
> PM1A PM1B
> PM1A PM1C
>
> HTH,
> M4

Hello Martijn Lievaart,
Excellent solution.
It's really workign fine.
Thank you very much.
Regards,
Thobias




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

Date: Thu, 27 Mar 2008 02:24:54 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: mysql_server_init error
Message-Id: <m4drb5-os21.ln1@osiris.mauzo.dyndns.org>


Quoth "Ela" <ela@yantai.org>:
> Google search returns few results, if any,
> 
> perl: relocation error: 
> /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBD/mysql/mysql.so: 
> undefined symbol: mysql_server_init
> 
> using CPAN to update DBI and DBD::mysql is of little help, neither do I 
> download the modules and install them help solve the problem.

I'm sure someone asked this just the other day...

You haven't got the MySQL client libraries installed, or if you have
ld.so can't find them. You probably need to install some sort of
mysql-client package.

Ben



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

Date: Wed, 26 Mar 2008 22:55:38 -0700 (PDT)
From: "robertchen117@gmail.com" <robertchen117@gmail.com>
Subject: need help on cgi to get multi pages and could sort by column from  Oracle
Message-Id: <60c388e5-2db2-4e42-b2a4-333c40625a0e@u10g2000prn.googlegroups.com>

hi, please help me on:

I want to find like 1000+ records from Oracle database using dbi, but
the view could sort by column and could display by multi pages.

Anyone has this kind of experience?

Robert



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

Date: Thu, 27 Mar 2008 04:42:17 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Mar 27 2008
Message-Id: <JyDH2H.174B@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Acme-Shorten-ZoffixsModuleNames-0.003
http://search.cpan.org/~zoffix/Acme-Shorten-ZoffixsModuleNames-0.003/
use Zoffix Znet's modules without those uberly long names *har* *har* 
----
Algorithm-RandomMatrixGeneration-0.05
http://search.cpan.org/~tpederse/Algorithm-RandomMatrixGeneration-0.05/
Perl module to generate matrix given the marginals. 
----
Apache2-ASP-1.38
http://search.cpan.org/~johnd/Apache2-ASP-1.38/
Perl extension for ASP on mod_perl2. 
----
Apache2-Translation-0.23
http://search.cpan.org/~opi/Apache2-Translation-0.23/
Configuring Apache dynamically 
----
Baldrick-0.86
http://search.cpan.org/~hucke/Baldrick-0.86/
Baldrick Application Framework 
----
CGI-Application-Plugin-Flash-0.01
http://search.cpan.org/~bcbailey/CGI-Application-Plugin-Flash-0.01/
Flash ... 
----
CGI-Session-Flash-0.01
http://search.cpan.org/~bcbailey/CGI-Session-Flash-0.01/
The great new CGI::Session::Flash! 
----
CGI-Session-MembersArea-2.03
http://search.cpan.org/~rsavage/CGI-Session-MembersArea-2.03/
A resource guardian based on CGI::Session 
----
CPAN-1.92_60
http://search.cpan.org/~andk/CPAN-1.92_60/
query, download and build perl modules from CPAN sites 
----
Cache-Memcached-libmemcached-0.02001
http://search.cpan.org/~dmaki/Cache-Memcached-libmemcached-0.02001/
Perl Interface to libmemcached 
----
Config-INI-Access-0.999
http://search.cpan.org/~andy/Config-INI-Access-0.999/
Syntactic sugar for accessing data from .ini-files 
----
Crypt-PassGen-0.05
http://search.cpan.org/~tjenness/Crypt-PassGen-0.05/
Generate a random password that looks like a real word 
----
Cvs-Trigger-0.03
http://search.cpan.org/~mschilli/Cvs-Trigger-0.03/
Argument parsers for CVS triggers 
----
Data-Conveyor-0.03
http://search.cpan.org/~marcel/Data-Conveyor-0.03/
stage-based conveyor-belt-like ticket handling system 
----
Devel-PerlySense-0.0148
http://search.cpan.org/~johanl/Devel-PerlySense-0.0148/
Perl IDE with Emacs frontend 
----
Emacs-Run-ExtractDocs-0.01
http://search.cpan.org/~doom/Emacs-Run-ExtractDocs-0.01/
extract elisp docstrings to html form 
----
Enumeration-0.03
http://search.cpan.org/~roode/Enumeration-0.03/
Yet Another enumeration class implementation. 
----
File-SearchPath-0.03
http://search.cpan.org/~tjenness/File-SearchPath-0.03/
Search for a file in an environment variable path 
----
GD-3DBarGrapher-0.9.4
http://search.cpan.org/~swarhurst/GD-3DBarGrapher-0.9.4/
Create 3D bar graphs using GD 
----
Geo-GeoNames-0.06
http://search.cpan.org/~perhenrik/Geo-GeoNames-0.06/
Perform geographical queries using GeoNames Web Services 
----
HTML-FormWidgets-0.1.28
http://search.cpan.org/~pjfl/HTML-FormWidgets-0.1.28/
Create HTML form markup 
----
HTML-TableParser-Grid-0.0.4
http://search.cpan.org/~takeru/HTML-TableParser-Grid-0.0.4/
Provide access methods to HTML tables by indicating row and column 
----
HTML-TagHelper-0.01
http://search.cpan.org/~mamatux/HTML-TagHelper-0.01/
Generate HTML tags in an easy way 
----
HTML-WikiConverter-Wikispaces-0.02
http://search.cpan.org/~mjbudden/HTML-WikiConverter-Wikispaces-0.02/
Convert HTML to Wikispaces markup 
----
IO-Socket-TIPC-1.08
http://search.cpan.org/~infinoid/IO-Socket-TIPC-1.08/
TIPC sockets for Perl 
----
JSON-DWIW-0.23
http://search.cpan.org/~dowens/JSON-DWIW-0.23/
JSON converter that Does What I Want 
----
Keystone-Resolver-1.19
http://search.cpan.org/~mirk/Keystone-Resolver-1.19/
an OpenURL resolver 
----
Lyrics-Fetcher-Lyrics007-0.05
http://search.cpan.org/~jamesr/Lyrics-Fetcher-Lyrics007-0.05/
Fetcher module for David Precious' (BIGPRESH) Lyrics::Fetcher 
----
Mail-Karmasphere-Client-2.15
http://search.cpan.org/~shevek/Mail-Karmasphere-Client-2.15/
Client for Karmasphere Reputation Server 
----
Math-Function-Roots-0.062
http://search.cpan.org/~sjo/Math-Function-Roots-0.062/
Functions for finding roots of arbitrary functions 
----
Math-Function-Roots-0.063
http://search.cpan.org/~sjo/Math-Function-Roots-0.063/
Functions for finding roots of arbitrary functions 
----
Movie-Info-0.2
http://search.cpan.org/~simonw/Movie-Info-0.2/
get meta data from various format movie files 
----
Net-Whois-Raw-1.52
http://search.cpan.org/~despair/Net-Whois-Raw-1.52/
Get Whois information for domains 
----
Osgood-Client-1.1.1
http://search.cpan.org/~gphat/Osgood-Client-1.1.1/
Client for the Osgood Passive, Persistent Event Queue 
----
POE-1.0000
http://search.cpan.org/~rcaputo/POE-1.0000/
portable multitasking and networking framework for Perl 
----
POE-Component-App-PNGCrush-0.001
http://search.cpan.org/~zoffix/POE-Component-App-PNGCrush-0.001/
non-blocking wrapper around App::PNGCrush 
----
POE-Component-NonBlockingWrapper-Base-0.002
http://search.cpan.org/~zoffix/POE-Component-NonBlockingWrapper-Base-0.002/
POE based base class for non-blocking wrappers around blocking stuff 
----
Parse-Marpa-0.205_005
http://search.cpan.org/~jkegl/Parse-Marpa-0.205_005/
(Alpha) Earley's algorithm with LR(0) precomputation 
----
Parse-Marpa-0.205_006
http://search.cpan.org/~jkegl/Parse-Marpa-0.205_006/
(Alpha) Earley's algorithm with LR(0) precomputation 
----
Parse-Syslog-Mail-0.15
http://search.cpan.org/~saper/Parse-Syslog-Mail-0.15/
Parse mailer logs from syslog 
----
Perlipse-0.01
http://search.cpan.org/~jae/Perlipse-0.01/
----
SQL-DB-0.12
http://search.cpan.org/~mlawren/SQL-DB-0.12/
Perl interface to SQL Databases 
----
Sys-RunAlone-0.08
http://search.cpan.org/~elizabeth/Sys-RunAlone-0.08/
make sure only one invocation of a script is active at a time 
----
Sysadm-Install-0.27
http://search.cpan.org/~mschilli/Sysadm-Install-0.27/
Typical installation tasks for system administrators 
----
Template-Plugin-Chump-1.3
http://search.cpan.org/~simonw/Template-Plugin-Chump-1.3/
provides a Template Toolkit filter for Chump like syntax 
----
Template-Recall-0.14
http://search.cpan.org/~gilad/Template-Recall-0.14/
"Reverse callback" templating system 
----
Test-XML-Count-0.02
http://search.cpan.org/~akaplan/Test-XML-Count-0.02/
Perl extension for testing element count at a certain depth 
----
Text-DHCPLeases-v0.4
http://search.cpan.org/~cvicente/Text-DHCPLeases-v0.4/
Parse DHCP leases file from ISC dhcpd. 
----
Text-MicroMason-SafeServerPages-0.01
http://search.cpan.org/~satoh/Text-MicroMason-SafeServerPages-0.01/
Safety ServerPages syntax 
----
Text-NSP-1.09
http://search.cpan.org/~tpederse/Text-NSP-1.09/
Extract collocations and Ngrams from text 
----
Text-Printf-1.00
http://search.cpan.org/~roode/Text-Printf-1.00/
A simple, lightweight text fill-in class. 
----
Text-XLogfile-0.04
http://search.cpan.org/~sartak/Text-XLogfile-0.04/
read and write xlogfiles 
----
Time-Format-1.04
http://search.cpan.org/~roode/Time-Format-1.04/
Easy-to-use date/time formatting. 
----
WWW-Newzbin-0.06
http://search.cpan.org/~chrisn/WWW-Newzbin-0.06/
Interface to Newzbin.com's Usenet index 
----
WWW-Pastebin-Bot-Pastebot-Create-0.001
http://search.cpan.org/~zoffix/WWW-Pastebin-Bot-Pastebot-Create-0.001/
create pastes on sites powered by Bot::Pastebot 
----
WWW-Pastebin-PastieCabooSe-Retrieve-0.001
http://search.cpan.org/~zoffix/WWW-Pastebin-PastieCabooSe-Retrieve-0.001/
retrieve pastes from http://pastie.caboo.se/ 
----
WWW-Search-Yahoo-2.412
http://search.cpan.org/~mthurn/WWW-Search-Yahoo-2.412/
backend for searching www.yahoo.com 
----
WWW-Search-Yahoo-China-1.001
http://search.cpan.org/~mthurn/WWW-Search-Yahoo-China-1.001/
class for searching Yahoo! China 
----
Win32-EnvProcess-0.03
http://search.cpan.org/~clive/Win32-EnvProcess-0.03/
Perl extension to set or get environment variables from other processes 
----
Win32-FetchCommand-0.03
http://search.cpan.org/~clive/Win32-FetchCommand-0.03/
Filename extension association resolution. 
----
Win32-Mock-0.05
http://search.cpan.org/~saper/Win32-Mock-0.05/
Mock Win32 modules 
----
Win32-StreamNames-1.02
http://search.cpan.org/~clive/Win32-StreamNames-1.02/
Perl extension for reading Windows ADS names 
----
Wx-0.82
http://search.cpan.org/~mbarbon/Wx-0.82/
interface to the wxWidgets cross-platform GUI toolkit 
----
XML-LibXML-Simple-0.12
http://search.cpan.org/~markov/XML-LibXML-Simple-0.12/
XML::LibXML clone of XML::Simple::XMLin() 
----
XTerm-Conf-0.00_50
http://search.cpan.org/~srezic/XTerm-Conf-0.00_50/
change configuration of a running xterm 
----
ack-1.80
http://search.cpan.org/~petdance/ack-1.80/
grep-like text finder 
----
forks-BerkeleyDB-0.054
http://search.cpan.org/~rybskej/forks-BerkeleyDB-0.054/
high-performance drop-in replacement for threads 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Wed, 26 Mar 2008 21:32:09 -0700 (PDT)
From: Deepan Perl XML Parser <deepan.17@gmail.com>
Subject: Re: Pattern matching
Message-Id: <f2d501ab-2971-4c0e-940d-f17bf10e197a@i7g2000prf.googlegroups.com>

On Mar 26, 5:31 pm, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
> On 2008-03-26 04:00, Deepan Perl XML Parser <deepan...@gmail.com> wrote:
>
> > On Mar 25, 7:13 pm, Lawrence Statton <yankeeinex...@gmail.com> wrote:
> >> Deepan Perl XML Parser <deepan...@gmail.com> writes:
>
> >> > No i am writing my own XML parser.
>
> >> Don't.  There are many good XML parsers out there, the world doesn't
> >> need another one.
>
> > Okay then can you name any parsers that would get the CDATA section?
>
> Which one doesn't?
>
> LibXML certainly does (I just tested it). I think expat does, too.
> I have my doubts about the pure perl XML parser, but that has a lot of
> other problems too and shouldn't be used.
>
>         hp

This one XML::Parser doesn't. It just signals you as CDATA starts and
ends here. It is not possible to get the data which is present using
this.


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

Date: Thu, 27 Mar 2008 10:08:45 +0800
From: "Ela" <ela@yantai.org>
Subject: perl and cgi
Message-Id: <fsevjh$vvm$1@ijustice.itsc.cuhk.edu.hk>

Dear all,



Would you mind telling me how to fix this problem?



"You don't have permission to access abc.cgi on this server."



I've changed httpd.conf to include the doNav.cgi in the non cgi-bin 
directory,



ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

ScriptAlias /cgi-bin/ "/var/www/html/ice-front/test/"



and



added Addtype



AddType application/x-httpd-cgi .cgi



restart the httpd service



Google search returns results which may be of no information.



And my link is :



http://137.189.50.236/test



Best Regards,

Ela




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

Date: Wed, 26 Mar 2008 19:16:33 -0700 (PDT)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: perl and cgi
Message-Id: <5958b80b-fca3-4257-b400-534208acdf14@e6g2000prf.googlegroups.com>

On Mar 27, 11:08 am, "Ela" <e...@yantai.org> wrote:

> Google search returns results which may be of no information.

Well, don't be so sure:

http://tinyurl.com/2v9epe

Anyway your question is about Apache configuration, not Perl.



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

Date: 27 Mar 2008 02:25:21 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: perl and cgi
Message-Id: <Xns9A6DCFC18677Acastleamber@130.133.1.4>

"Ela" <ela@yantai.org> wrote:

> Dear all,
> 
> 
> 
> Would you mind telling me how to fix this problem?
> 
> 
> 
> "You don't have permission to access abc.cgi on this server."


did you chmod 755 abc.cgi ?

-- 
John

http://johnbokma.com/perl/


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

Date: Thu, 27 Mar 2008 10:36:24 +0800
From: "Ela" <ela@yantai.org>
Subject: Re: perl and cgi
Message-Id: <fsf17c$123$1@ijustice.itsc.cuhk.edu.hk>

Dear Ben,

Thanks a lot for your help. Indeed why I was asking that is because without 
using other installed modules or my own modules, the CGI script works well 
otherwise.

The first row of use includes:

use Bio::Graphics; use Bio::Graphics::Feature; use Bio::SeqFeature::Generic; 
use Bio::SeqIO; use GeneticCode;

I once wonder it's the problem of httpd but it should be not. I have already 
included use CGI qw(:standard);

Thanks once again~~ 




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

Date: Wed, 26 Mar 2008 19:28:46 -0700 (PDT)
From: Ivan Novick <ivan@0x4849.net>
Subject: Re: pipe for stderr and stdout
Message-Id: <d83bd57d-ba0e-4337-accd-c6a06907dabc@e6g2000prf.googlegroups.com>

On Mar 26, 5:33 pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> Ivan Novick wrote:
> > From within perl i want to start a first process 'A' which writes to
> > both STDOUT and STDERR.
>
> > From the same perl script i want to start 2 more processes.
>
> > One, 'B', that reads from STDOUT of 'A"
>
> > The other, 'C', that reads from STDERR 'A'
>
> > Is this possible from within perl?
>
> Yes.
>
> --
> Gunnar Hjalmarsson
> Email:http://www.gunnar.cc/cgi-bin/contact.pl

How about a hint as to how?

Ivan Novick
http://www.myperlquiz.com/


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

Date: Thu, 27 Mar 2008 04:49:51 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: pipe for stderr and stdout
Message-Id: <650jngF2d2jetU1@mid.individual.net>

Ivan Novick wrote:
> On Mar 26, 5:33 pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
>> Ivan Novick wrote:
>>> From within perl i want to start a first process 'A' which writes to
>>> both STDOUT and STDERR.
>>> From the same perl script i want to start 2 more processes.
>>> One, 'B', that reads from STDOUT of 'A"
>>> The other, 'C', that reads from STDERR 'A'
>>> Is this possible from within perl?
>>
>> Yes.
> 
> How about a hint as to how?

I'm not able to tell you any details, but I'd study "perldoc perlipc" 
and "perldoc perlfork" and start playing with code.

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


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

Date: Wed, 26 Mar 2008 18:29:56 -0700 (PDT)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: Readline using foreach and while
Message-Id: <02f2e638-3da2-49df-b457-f23aa9b58da0@s19g2000prg.googlegroups.com>

On Mar 26, 9:52 am, Ben Morrow <b...@morrow.me.uk> wrote:

> > To read a file into an array use:
>
> > my @ary = <handle>;
>
> No. This reads the contents of the file into a list, and then assigns
> that list to an array. The contents of the array are no longer anything
> to do with the file.

I'm not sure what sense you're using the word "read" here but it isn't
the usual one.
If I read a book, the words go into my head, but after that if I burn
the book, then usually my head doesn't catch fire, and if I shoot
myself in the head, then the book doesn't get a bullet hole through
it.

Similarly, in my understanding of the word "read" for computers, if I
read a file into an array, I don't expect that deleting or altering
the array after the "read" statement has finished will affect the
file, and vice-versa.


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

Date: Wed, 26 Mar 2008 21:45:32 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: Readline using foreach and while
Message-Id: <fsf8pd08nt@news2.newsguy.com>

nolo contendere wrote:
> On Mar 26, 10:19 am, "szr" <sz...@szromanMO.comVE> wrote:
>> nolo contendere wrote:
>>> On Mar 26, 12:33 am, "szr" <sz...@szromanMO.comVE> wrote:
>>>> Ben Morrow wrote:
>>>>> Quoth Frank Seitz <devnull4...@web.de>:
>>>> [...]
>>
>>>>>> use strict;
>>>>>> use warnings;
>>
>>>>>> my @a = qw/a b c/;
>>>>>> for my $v (@a) {
>>>>>> push @a,'d' if $v eq 'c';
>>>>>> print "$v\n";
>>>>>> }
>>
>>>>> Good point. for is a little weird in this respect...
>>
>>>> Nothing really weird about it. In that case above, it's no
>>>> different than:
>>
>>>> for (my $i=0; $i<@a; $i++) {
>>>> my $v = $a[$i];
>>>> push @a,'d' if $v eq 'c';
>>>> print "$v\n";
>>
>>>> }
>>
>>>> In either case, it's going over the array, one element at a time,
>>>> in sequence, s oif you "push" something onto the end, it grows the
>>>> array by one and thus the for look keeps going.
>>
>>> I think the 'weirdness' stems from the notion that 'for' supposedly
>>> builds up a list prior to iterating over it,
>>
>> Exactly. It builds a list, when necessary (like when you
>> use for (<FH>) { ... } ), unless it's alreayd there ( like
>> with for my $element (@array) { ... } ) and /THEN/ iterates over it.
>>
>> It just keeps going until the list is expended. Adding to the array
>> like in the quoted examples above makes the list longer and hence
>> the extra iteration (since the length of the list is checked each
>> time through the loop.)
>>
>
> Provably untrue. See Ben's example. I'll restate the concept below.
>
> my @ary = qw/a b c/;
> # for (@ary, ()) {
> # for ( (), @ary ) {
> for ( @ary ) {
>     push @ary, 'd' if /c/;
>     print;
> }
>
> ...
>
> only the uncommented 'for' line prints a 'd' at the end. so what you
> say MAY be true if LIST is ONLY an array.

Isn't that because the two commented one are two lists being combined 
into a new list, and it's *that* new list that's being iterated over, so 
even if you add to @ary, it doesn't change the "new list", which is just 
that, a new list created at the start of the loop before iterating 
begins - therefore the values of the new list are set and @ary has 
nothing to do with it after the create of the "new list."

Isn't this correct?

-- 
szr 




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

Date: Wed, 26 Mar 2008 23:27:00 -0700 (PDT)
From: "falconzyx@gmail.com" <falconzyx@gmail.com>
Subject: Re: The huge amount response data problem
Message-Id: <c776f49d-4eb1-4765-a617-c2e4b1e125c8@s19g2000prg.googlegroups.com>

On Mar 26, 1:50=A0am, xhos...@gmail.com wrote:
> RedGrittyBrick <RedGrittyBr...@SpamWeary.foo> wrote:
>
> > I find it hard to understand what you are saying but I think the answer
> > is: Yes, Perl is well suited to programming with multiple threads (or
> > processes).
>
> I agree with the "(or processes)" part, provided you are running on a Unix=

> like platform. =A0But in my experience/opinion Perl threads mostly suck.
>
> --
> --------------------http://NewsReader.Com/--------------------
> The costs of publication of this article were defrayed in part by the
> payment of page charges. This article must therefore be hereby marked
> advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate=

> this fact.

Here is my refactor code, which still at a very slow speed, please
advice me how to improve it, thanks very much:

  require LWP::Parallel::UserAgent;
  use HTTP::Request;
  use LWP::Simple;
  use threads;

  # display tons of debugging messages. See 'perldoc LWP::Debug'
  #use LWP::Debug qw(+);
	my $reqs =3D [
		HTTP::Request->new('GET',"http://www...."),
		HTTP::Request->new('GET', "......"
		..............# about nearly 200000 url here

  ];

  my $pua =3D LWP::Parallel::UserAgent->new();
  $pua->in_order  (10000);  # handle requests in order of registration
  $pua->duplicates(0);  # ignore duplicates
  $pua->timeout   (1);  # in seconds
  $pua->redirect  (1);  # follow redirects

  foreach my $req (@$reqs) {
    print "Registering '".$req->url."'\n";
    if ( my $res =3D $pua->register ($req) ) {
        print STDERR $res->error_as_HTML;
    }
  }
  my $entries =3D $pua->wait();

  foreach (keys %$entries) {
    my $res =3D $entries->{$_}->response;
		threads->new(\&format_html, $res->content);

  }
  foreach my $thr (threads->list()) {
      $thr->join();   # I think it does not work......
  }

  sub format_html {
		my ($html_data) =3D shift;
    my $word;
    my $data;
    while ( $html_data =3D~ m{...}igs ) {
    	$word =3D $1;
  	}
    while ( $html_data =3D~ m{...}igs ) {
        $data =3D $1;
        save_data( $word, $data );
    }
    while ( $data =3D~ m{...}igs ) {
        my $title =3D $1;
        my $sound =3D $1.$2;
        if ( defined($sound) ) {
            save_sound( $word, $title, $sound );
        }
    }
}

sub save_data {
	my ( $word, $data ) =3D @_;
    open ( FH, " > ..." ) or die "Can not open $!";
    print FH $data;
    close(FH);
}



sub save_sound {
	my ( $word, $title, $sound ) =3D @_;
    getstore("...", "...") or warn $!;

}



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

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

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 1396
***************************************


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