[28939] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 183 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 1 11:10:42 2007

Date: Thu, 1 Mar 2007 08:09:08 -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, 1 Mar 2007     Volume: 11 Number: 183

Today's topics:
    Re: Can't call method "Sql"... need help <nitte.sudhir@gmail.com>
        Combinatorics Problem <mitch.mcbride@gmail.com>
    Re: Combinatorics Problem <attn.steven.kuo@gmail.com>
    Re: Combinatorics Problem <attn.steven.kuo@gmail.com>
    Re: Combinatorics Problem <g_m@remove-comcast.net>
        Error In DBI - Cannot execute multiple statements <pankaj_wolfhunter@yahoo.co.in>
    Re: Error In DBI - Cannot execute multiple statements <mritty@gmail.com>
    Re: Error In DBI - Cannot execute multiple statements <paduille.4060.mumia.w+nospam@earthlink.net>
    Re: Hash of arrays of hashes... There's got to be a cle <alasdair@tetchytechie.co.uk>
    Re: Hash of arrays of hashes... There's got to be a cle <mark.clementsREMOVETHIS@wanadoo.fr>
        new CPAN modules on Thu Mar  1 2007 (Randal Schwartz)
    Re: Parent process unable to read messages from child p xhoster@gmail.com
        parse a log file question <robertchen117@gmail.com>
    Re: parse a log file question <mritty@gmail.com>
    Re: parse a log file question <robertchen117@gmail.com>
    Re: parse a log file question <jurgenex@hotmail.com>
    Re: parse a log file question <mritty@gmail.com>
        SOAP::Lite and header <stefan.braun@orca.ch>
        Too complex data structure? <robertchen117@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 28 Feb 2007 18:35:19 -0800
From: "kath" <nitte.sudhir@gmail.com>
Subject: Re: Can't call method "Sql"... need help
Message-Id: <1172716517.201710.67840@z35g2000cwz.googlegroups.com>

On Feb 28, 4:53 pm, "perlguru" <manojkumargu...@gmail.com> wrote:
> On Feb 28, 4:13 pm, sud...@gmail.com wrote:
>
>
>
>
>
>
>
> > hello,
>
> > I have a problem CGI script. I am really sorry, this looks quite
> > big...
>
> > I created a package pkg::fetch_history.pm and placed it in c:\Perl
> > \lib. Then I created a perl file to run from the commad promt. the
> > program executed well without fail. The code is as follows,
>
> > #!C:\Perl\bin\perl.exe
> > use pkg::fetch_history;
>
> > @dates = pkg::fetch_history::get_Dates();
> > foreach $d (@dates)
> > {       print "\n",$d;        }
>
> > the data base exists locally.
>
> > Then I created cgi script to populate the values into combo box, it
> > says
>
> > Can't call method "Sql" on an undefined value at C:/Perl/lib/pkg/
> > fetch_history.pm line 20.
>
> > I am not sure why is this. Below is the fetch_history.pm and
> > combobox.cgi script.
>
> > -----------------------------------------------------------------------------------------------
> > #!C:\Perl\bin\perl.exe
>
> > # this is fetch_history.pm
>
> > package pkg::fetch_history;
> > use strict;
> > use Win32::ODBC;
>
> > my $db = new Win32::ODBC('ServerStatistics');   #ODBC driver object
> > #if (!$db)
> > #{
> > #       print "Database could not be found\n";
> > #}
>
> > sub get_Dates
> > {
> >         my $q = "select distinct(build_date) from wdf_history order by
> > build_date";
> >         $db->Sql($q);
> >         my @dates;
> >         push(@dates, $db->Data()) while($db->FetchRow);
>
> >         return @dates;}
>
> > ---------------------------------------------------------------------
> > #!C:\Perl\bin\perl.exe
>
> > use CGI::Carp qw(fatalsToBrowser);
> > use CGI;
> > use pkg::fetch_history;
>
> > $cgi = new CGI;
> > print $cgi->header;
>
> > @dates = pkg::fetch_history::get_Dates();
> > print "here is the dates value",@dates;
> > print <<ENDHTML;
> > <html>
> > <head><title> Server statistics </title></head>
> > <body>
> > <select name="menu">
> > ENDHTML
>
> >                 foreach my $d(@datest)
> >                 {
> > print <<ENDHTML;
> >                         <option value="$d" selected>(please select:)</option>
> >                         <option value="$d">$d</option>
> > ENDHTML
>
> >                 }
> > ------------------------------------------------------------------
>
> > Am I wrong some where?
>
> > Thank you,
> > Regards,
> > kath.
>
> If this script runs fine from command prompt, ..... then I think you
> should check with permission.
> I see that you are not catching error at the time of opening
> connection to database.
> While executing script from web, it executes with lower permission,
> and it may not be allowed to connect to database.
>
> Try catching error at the time of opening connection to database...

Hi, thanks for the reply. you are right. The connection to database
was not happening when run I from browser. But the same was working
fine when I run in command prompt. Me and my friend figured it out
that there wasn't establishing of connection to database was
happening.

Why only in the browser?

Then later one thing flashed, that I was using local DSN(user DSN) to
connect to database. Then I tried creating the System DSN tried to
run, it was working.

Any way, thanks a lot.


Regards,
kath.



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

Date: 28 Feb 2007 18:10:52 -0800
From: "Mitch  McBride" <mitch.mcbride@gmail.com>
Subject: Combinatorics Problem
Message-Id: <1172715052.217420.327000@p10g2000cwp.googlegroups.com>

I have a problem who's solution requires functionality beyond what
Math::Combinatorics and other combinatorics modules offer.  I need a
way of selecting combinations from different "buckets" that are
represented as nested arrays.  For instance, the array @n = (['1','2'],
['a','b'],['y','z']) would return:

1 a y
2 a y
1 b y
2 b y
1 a z
2 a z
1 b z
2 b z

Math::Combinatorics prints the array reference when I try using nested
arrays.  Anyone know of a module that can perform this type of
combination?  Thanks!


#!/usr/bin/perl -w

use Math::Combinatorics;

  my @n = (['1','2'],['a','b'],['y','z']);
  print join("\n", map { join " ", @$_ } combine(3,@n)),"\n";
  print "\n";


OUTPUT:
ARRAY(0x9ad0c28) ARRAY(0x9ae7b0c) ARRAY(0x9b94b50)



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

Date: 28 Feb 2007 22:46:03 -0800
From: "attn.steven.kuo@gmail.com" <attn.steven.kuo@gmail.com>
Subject: Re: Combinatorics Problem
Message-Id: <1172731563.050174.239560@v33g2000cwv.googlegroups.com>

On Feb 28, 6:10 pm, "Mitch  McBride" <mitch.mcbr...@gmail.com> wrote:
> I have a problem who's solution requires functionality beyond what
> Math::Combinatorics and other combinatorics modules offer.  I need a
> way of selecting combinations from different "buckets" that are
> represented as nested arrays.  For instance, the array @n = (['1','2'],
> ['a','b'],['y','z']) would return:
>
> 1 a y
> 2 a y
> 1 b y
> 2 b y
> 1 a z
> 2 a z
> 1 b z
> 2 b z
>


Try Iterator::Util;

use strict;
use warnings;
use Iterator::Util;

my @elements = ( [1, 2], [ qw/a b/ ], [ qw/y z/ ] );
my @iters = map iarray($_), @elements;
my @values = map $_->value, @iters;

while ( @elements > grep { $_ } map $_->is_exhausted, @iters ) {

    display(@values);

    for (my $i = 0; $i < @iters; ++$i) {
        if ($iters[$i]->is_exhausted) {
            $iters[$i] = iarray( $elements[$i] );
            $values[$i] = $iters[$i]->value();
        } else {
            $values[$i] = $iters[$i]->value();
            last;
        }
    }
}

display(@values);

sub display {
    print join " => ", @_;
    print "\n";
}


__END__

I and the author of Iterator::Util
both recommend the book 'Higher Order Perl'
by Mark Jason Dominus for its coverage
of iterators.

--
Hope this helps,
Steven



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

Date: 28 Feb 2007 23:38:52 -0800
From: "attn.steven.kuo@gmail.com" <attn.steven.kuo@gmail.com>
Subject: Re: Combinatorics Problem
Message-Id: <1172734732.332617.57740@q2g2000cwa.googlegroups.com>

On Feb 28, 10:46 pm, "attn.steven....@gmail.com"
<attn.steven....@gmail.com> wrote:
> On Feb 28, 6:10 pm, "Mitch  McBride" <mitch.mcbr...@gmail.com> wrote:
>

(snipped)

> Try Iterator::Util;
>

(snipped)


Of course, the while loop itself
can or should be replaced by an iterator:

use Iterator;
use Iterator::Util;

sub myiter {
    my @elements = @_;
    my @iters = map iarray($_), @elements;
    my @values;

    return Iterator->new( sub
        {
            Iterator::is_done if @elements == grep { $_ } map $_-
>is_exhausted,
@iters;
            unless (@values) {
                @values = map $_->value, @iters;
            } else {
                for (my $i = 0; $i < @iters; ++$i) {
                    if ($iters[$i]->is_exhausted) {
                        $iters[$i] = iarray( $elements[$i] );
                        $values[$i] = $iters[$i]->value();
                    } else {
                        $values[$i] = $iters[$i]->value();
                        last;
                    }
                }
            }
            return [ @values ];
        }
    );
}

my @elements = ( [1, 2], [ qw/a b/ ], [ qw/y z/ ] );

my $it = myiter(@elements);

do {
    my $foo = $it->value();
    display(@$foo) if @$foo;
} until $it->is_exhausted;

sub display {
    print join " => ", @_;
    print "\n";
}

--
Cheers,
Steven



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

Date: Thu, 1 Mar 2007 05:30:53 -0500
From: "~greg" <g_m@remove-comcast.net>
Subject: Re: Combinatorics Problem
Message-Id: <1NSdnQXO89HONnvYnZ2dnUVZ_qarnZ2d@giganews.com>


"Mitch McBride"> wrote
> ... I need a way of selecting combinations from different "buckets"
> that are represented as nested arrays.
> For instance, the array @n = (['1','2'], ['a','b'],['y','z']) would return:
> 1 a y
> 2 a y
> 1 b y
> 2 b y
> 1 a z
> 2 a z
> 1 b z
> 2 b z


use strict;
use warnings;
use Data::Dump qw(dump);

$|=1;

my @n = ( ['1','2'], ['a','b'],['y','z'] );

sub Comb
{
  if(@_ == 1)
  {
    return map { [$_] } @{ $_[0] };
  }
  my @A = Comb( @_[0..$#_-1] );
  my @B = @{ $_[$#_] };
  my ($a,$b);
  return map{ $a=$_; map{ $b=$_; [@{$a},$b] } @B} @A;
}

# The basic idea is that to combine
#    ( ['1','2'], ['a','b'],['y','z'] )
# you first combine
#   ( ['1','2'], ['a','b'] ),
# getting
#   ( ['1','a'], ['1','b'], ['2','a'], ['2','b'] )
# Then you append each element in ['y','z']
# to each of those arrays, getting:

my @m = Comb(@n);
dump(\@m);

#[
#  [1, "a", "y"],
#  [1, "a", "z"],
#  [1, "b", "y"],
#  [1, "b", "z"],
#  [2, "a", "y"],
#  [2, "a", "z"],
#  [2, "b", "y"],
#  [2, "b", "z"],
#]
# in lexicographical order.

# note: the recursion has to start by turning ( ['1','2'] )
# into ( ['1'], ['2'] )


# ~greg







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

Date: 1 Mar 2007 04:09:42 -0800
From: "pankaj_wolfhunter@yahoo.co.in" <pankaj_wolfhunter@yahoo.co.in>
Subject: Error In DBI - Cannot execute multiple statements
Message-Id: <1172750982.893297.54780@30g2000cwc.googlegroups.com>

Greetings,

Sample script

#!/usr/bin/perl -w

use DBI;

$dbh = DBI->connect("DBI:Oracle:dbname","username","password") || die
"Cannot connect to Database : $DBI::errstr\n";

$dbh->do(q{
        spool test.sql
        select sysdate from dual
        spool off
    });


Error:

DBD::Oracle::db do failed: ORA-00900: invalid SQL statement (DBD
ERROR: error possibly near <*> indicator at char 10 in '
        <*>spool test.sql
        select sysdate from dual
        spool off
    ') [for Statement "
        spool test.sql
        select sysdate from dual
        spool off
    "] at hi.txt line 8.

What is wrong with the query?

Help would be appreciated

TIA



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

Date: 1 Mar 2007 07:12:20 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Error In DBI - Cannot execute multiple statements
Message-Id: <1172761940.194149.310070@31g2000cwt.googlegroups.com>

On Mar 1, 7:09 am, "pankaj_wolfhun...@yahoo.co.in"
<pankaj_wolfhun...@yahoo.co.in> wrote:
> Subject: Error In DBI - Cannot execute multiple statements

That's exactly correct.  You cannot execute multiple statements.  This
is not an error in DBI.  It's an error in your code.

> $dbh->do(q{
>         spool test.sql
>         select sysdate from dual
>         spool off
>     });
>
> Error:
>
> DBD::Oracle::db do failed: ORA-00900: invalid SQL statement (DBD
> ERROR: error possibly near <*> indicator at char 10 in '
>         <*>spool test.sql
>         select sysdate from dual
>         spool off
>     ') [for Statement "
>         spool test.sql
>         select sysdate from dual
>         spool off
>     "] at hi.txt line 8.
>
> What is wrong with the query?

You are trying to execute three statements at once.

$dbh->do('spool test.sql');
$dbh->do('select sysdate from dual');
$dbh->do('spool off');

or, if you prefer not typing as much, perhaps:
$dbh->do($_)
  for ('spool test.sql', 'select sysdate from dual', 'spool off');


Of course, I would recommend not using a SQL*Plus-specific feature
like this, and just do it the "normal" way.
my ($date) = $dbh->selectrow_array('select sysdate from dual');
open my $ofh, '>', 'test.sql' or die $1;
print $ofh "$date\n";

Paul Lalli



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

Date: Thu, 01 Mar 2007 15:48:35 GMT
From: "Mumia W." <paduille.4060.mumia.w+nospam@earthlink.net>
Subject: Re: Error In DBI - Cannot execute multiple statements
Message-Id: <nBCFh.7910$Jl.2083@newsread3.news.pas.earthlink.net>

On 03/01/2007 06:09 AM, pankaj_wolfhunter@yahoo.co.in wrote:
> Greetings,
> 
> Sample script
> 
> #!/usr/bin/perl -w
> 
> use DBI;
> 
> $dbh = DBI->connect("DBI:Oracle:dbname","username","password") || die
> "Cannot connect to Database : $DBI::errstr\n";
> 
> $dbh->do(q{
>         spool test.sql
>         select sysdate from dual
>         spool off
>     });
> 
> 
> Error:
> 
> DBD::Oracle::db do failed: ORA-00900: invalid SQL statement (DBD
> ERROR: error possibly near <*> indicator at char 10 in '
>         <*>spool test.sql
>         select sysdate from dual
>         spool off
>     ') [for Statement "
>         spool test.sql
>         select sysdate from dual
>         spool off
>     "] at hi.txt line 8.
> 
> What is wrong with the query?
> 
> Help would be appreciated
> 
> TIA
> 

It sounds like your database software is configured to disallow multiple 
SQL statements to be put into a single query. Break the statements up:

$dbh->do(q{ spool test.sql });
$dbh->do(q{ select sysdate from dual });
$dbh->do(q{ spool off });

Note that I have no knowledge of Oracle.



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

Date: Thu, 01 Mar 2007 02:56:48 +0000
From: tetchy <alasdair@tetchytechie.co.uk>
Subject: Re: Hash of arrays of hashes... There's got to be a cleaner way than this...
Message-Id: <45e640af$0$22120$db0fefd9@news.zen.co.uk>

Mark Clements wrote:
<SNIP>

> <snip>
>>>
>>> my %theInterfaceHash = (
>>>         'lo'     => [ { ip => '127.0.0.1/8', mtu => '16436' } ],
>>>         'eth0'    => [ { ip => '192.168.58.23/24', mtu => '1500' }, {
>>> ip => '192.168.48.23/24', mtu => '1500' }, { ip => '172.16.16.23/16',
>>> mtu => '1492' } ],
>>>         'eth1'    => [ { ip => '192.168.44.23/24', mtu => '1500' } ]
>>>         );
> 
> I'd keep this data in an external file (YAML, XML or somesuch), and use
> a templating system to generate the config files.
> 

Strange you should say that, I do.  The only interface that is defined
in the hash in the live script is lo.  The purpose of the script is to
interpret a config file.  The script here is just a hello-world app to
illustrate my methodology in moving from a hash of hashes to it's
current hash of array of hashes..

Thanks for your input.

Al


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

Date: Thu, 01 Mar 2007 07:36:51 +0100
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: Hash of arrays of hashes... There's got to be a cleaner way than this...
Message-Id: <45e67481$0$25917$ba4acef3@news.orange.fr>

tetchy wrote:
> Mark Clements wrote:
> <SNIP>
> 
>> <snip>
>>>> my %theInterfaceHash = (
>>>>         'lo'     => [ { ip => '127.0.0.1/8', mtu => '16436' } ],
>>>>         'eth0'    => [ { ip => '192.168.58.23/24', mtu => '1500' }, {
>>>> ip => '192.168.48.23/24', mtu => '1500' }, { ip => '172.16.16.23/16',
>>>> mtu => '1492' } ],
>>>>         'eth1'    => [ { ip => '192.168.44.23/24', mtu => '1500' } ]
>>>>         );
>> I'd keep this data in an external file (YAML, XML or somesuch), and use
>> a templating system to generate the config files.
>>
> 
> Strange you should say that, I do.  The only interface that is defined
> in the hash in the live script is lo.  The purpose of the script is to
> interpret a config file.  The script here is just a hello-world app to
> illustrate my methodology in moving from a hash of hashes to it's
> current hash of array of hashes..
> 
OK - can you show snippets of the config file and typical output? Your 
test script has been simplified a bit too far to work out what it is you 
are trying to do.


regards,

Mark


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

Date: Thu, 1 Mar 2007 05:42:10 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Mar  1 2007
Message-Id: <JE7MIA.x98@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.

Algorithm-Cluster-1.35
http://search.cpan.org/~mdehoon/Algorithm-Cluster-1.35/
Perl interface to the C Clustering Library. 
----
Attribute-Overload-Match-0.01
http://search.cpan.org/~karasik/Attribute-Overload-Match-0.01/
argument-dependent handlers for overloaded operators 
----
Catalyst-Plugin-ClamAV-0.03
http://search.cpan.org/~fujiwara/Catalyst-Plugin-ClamAV-0.03/
ClamAV scanning Plugin for Catalyst 
----
Coro-3.501
http://search.cpan.org/~mlehmann/Coro-3.501/
coroutine process abstraction 
----
DBIx-Perlish-0.19
http://search.cpan.org/~gruber/DBIx-Perlish-0.19/
a perlish interface to SQL databases 
----
Data-Validate-0.04
http://search.cpan.org/~tlinden/Data-Validate-0.04/
Validate Config Hashes 
----
Date-Calc-5.5.1
http://search.cpan.org/~tchatzi/Date-Calc-5.5.1/
Gregorian calendar date calculations 
----
Device-Gsm-1.48
http://search.cpan.org/~cosimo/Device-Gsm-1.48/
Perl extension to interface GSM phones / modems 
----
Egg-Model-DBIC-0.02
http://search.cpan.org/~lushe/Egg-Model-DBIC-0.02/
DBIx::Class for Egg. 
----
Egg-Release-1.12
http://search.cpan.org/~lushe/Egg-Release-1.12/
WEB application framework release version. 
----
Egg-Release-1.13
http://search.cpan.org/~lushe/Egg-Release-1.13/
WEB application framework release version. 
----
Email-Address-1.885
http://search.cpan.org/~rjbs/Email-Address-1.885/
RFC 2822 Address Parsing and Creation 
----
FTN-Nodelist-1.07
http://search.cpan.org/~stro/FTN-Nodelist-1.07/
Process FTN nodelist 
----
HTML-Widget-Factory-0.055
http://search.cpan.org/~rjbs/HTML-Widget-Factory-0.055/
churn out HTML widgets 
----
HTML-Widget-Factory-0.056
http://search.cpan.org/~rjbs/HTML-Widget-Factory-0.056/
churn out HTML widgets 
----
HTML-Widgets-SelectLayers-0.07
http://search.cpan.org/~ivan/HTML-Widgets-SelectLayers-0.07/
Perl extension for selectable HTML layers 
----
IO-Simple-0.01
http://search.cpan.org/~ericjh/IO-Simple-0.01/
Perl extension for blah blah blah 
----
IO-Simple-0.02
http://search.cpan.org/~ericjh/IO-Simple-0.02/
Adds object oriented cabalilities to file handles and provides fatal handling. 
----
Image-TestJPG-1.0
http://search.cpan.org/~jhudge/Image-TestJPG-1.0/
Test the validity of JPEG image streams. 
----
LaTeX-Table-v0.0.2
http://search.cpan.org/~limaone/LaTeX-Table-v0.0.2/
Perl extension for the automatic generation of LaTeX tables. 
----
Lemonldap-NG-Handler-0.75
http://search.cpan.org/~guimard/Lemonldap-NG-Handler-0.75/
The Apache protection module part of Lemonldap::NG Web-SSO system. 
----
Lemonldap-NG-Manager-0.44
http://search.cpan.org/~guimard/Lemonldap-NG-Manager-0.44/
Perl extension for managing Lemonldap::NG Web-SSO system. 
----
Lemonldap-NG-Portal-0.62
http://search.cpan.org/~guimard/Lemonldap-NG-Portal-0.62/
The authentication portal part of Lemonldap::NG Web-SSO system. 
----
Log-Handler-0.09_01
http://search.cpan.org/~bloonix/Log-Handler-0.09_01/
A simple handler to log messages to log files. 
----
Log-Handler-0.09_02
http://search.cpan.org/~bloonix/Log-Handler-0.09_02/
A simple handler to log messages to log files. 
----
Mail-DKIM-0.23
http://search.cpan.org/~jaslong/Mail-DKIM-0.23/
Signs/verifies Internet mail with DKIM/DomainKey signatures 
----
Net-DHCPClientLive-0.02
http://search.cpan.org/~mingzhang/Net-DHCPClientLive-0.02/
stateful DHCP client object 
----
Net-EPP-Client-0.07
http://search.cpan.org/~gbrown/Net-EPP-Client-0.07/
a client library for the TCP transport for EPP, the Extensible Provisioning Protocol 
----
Net-Frame-Device-1.03
http://search.cpan.org/~gomor/Net-Frame-Device-1.03/
get network device information and gateway 
----
Net-Random-1.4
http://search.cpan.org/~dcantrell/Net-Random-1.4/
get random data from online sources 
----
Net-SIP-0.23
http://search.cpan.org/~sullr/Net-SIP-0.23/
Framework SIP (Voice Over IP, RFC3261) 
----
Net-SSL-ExpireDate-1.03
http://search.cpan.org/~hirose/Net-SSL-ExpireDate-1.03/
obtain expiration date of certificate 
----
POE-Component-Generic-0.0911
http://search.cpan.org/~gwyn/POE-Component-Generic-0.0911/
A POE component that provides non-blocking access to a blocking object. 
----
Sort-Half-Maker-0.03
http://search.cpan.org/~ferreira/Sort-Half-Maker-0.03/
Create half-sort subs easily 
----
Template-Declare-0.03
http://search.cpan.org/~jesse/Template-Declare-0.03/
Perlish declarative templates 
----
Text-CSV-LibCSV-0.01
http://search.cpan.org/~jiro/Text-CSV-LibCSV-0.01/
comma-separated values manipulation routines (using libcsv) 
----
Verilog-Perl-2.372
http://search.cpan.org/~wsnyder/Verilog-Perl-2.372/
----
WWW-TV-0.07
http://search.cpan.org/~tigris/WWW-TV-0.07/
Parse TV.com for information about TV shows. 
----
Wx-Perl-Packager-0.04
http://search.cpan.org/~mdootson/Wx-Perl-Packager-0.04/
----
Wx-Perl-Packager-0.05
http://search.cpan.org/~mdootson/Wx-Perl-Packager-0.05/
----
Wx-Perl-Packager-0.06
http://search.cpan.org/~mdootson/Wx-Perl-Packager-0.06/
----
Wx-Perl-Packager-0.07
http://search.cpan.org/~mdootson/Wx-Perl-Packager-0.07/
----
XML-API-0.12
http://search.cpan.org/~mlawren/XML-API-0.12/
Perl extension for creating XML documents 


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: 01 Mar 2007 02:06:01 GMT
From: xhoster@gmail.com
Subject: Re: Parent process unable to read messages from child process
Message-Id: <20070228211117.873$6e@newsreader.com>

"Gauri" <himagauri@gmail.com> wrote:
> Hi,
> I appreciate the quick response.
>
> Apologies for the typo--
> The statement in the main code is:
>     foreach $uncompclient($selectpipe->can_read){
>
> my @filedetail = map {<$_>} @list_of_child_handles;
> Could you please explain series of blocking read in details with
> respect to my code?

The reason for using a select is so that you can do something useful
while waiting for data to become ready for reading.  But you don't
have anything useful to do.  So don't use select.  In your spawning code,
instead of adding the handle to the IO::Select object just push it onto
@list_of_child_handles.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 1 Mar 2007 04:50:09 -0800
From: "robertchen117@gmail.com" <robertchen117@gmail.com>
Subject: parse a log file question
Message-Id: <1172753409.360657.50330@8g2000cwh.googlegroups.com>

hi all,

the log file format is a long list of the item like:
Fri Oct  6 00:00:23 2006: TR_execute_task( Lib/Task: library_name1/
task_name2 run by www.hp.com on 7 targets, out = 257

I want to count the number of targets based on library_name1/
task_name2, but there are many library names and task names, so the
array size not know. How could I do this?

My perl codes is like this:

 ....
open (TSK, "more /tmp/task28.log | grep '$now' | grep 'out =' |") or
die "cannot fork: $!";

while (<TSK>) { # count them up.
        ($foo,$foo,$foo,$time,$foo,$foo,$foo,$taskinfo,$foo,$foo,$foo,
$foo,$targets,$foo,$foo,$foo, $bytes) = split ' ';

should be like array[$taskinfo] += $targets;

How could I define the array or hash dynamicly?

Please help me, thanks.



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

Date: 1 Mar 2007 05:05:07 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: parse a log file question
Message-Id: <1172754307.435704.64610@z35g2000cwz.googlegroups.com>

On Mar 1, 7:50 am, "robertchen...@gmail.com" <robertchen...@gmail.com>
wrote:
> hi all,
>
> the log file format is a long list of the item like:
> Fri Oct  6 00:00:23 2006: TR_execute_task( Lib/Task: library_name1/
> task_name2 run bywww.hp.comon 7 targets, out = 257
>
> I want to count the number of targets based on library_name1/
> task_name2, but there are many library names and task names, so the
> array size not know.

Perl couldn't care less what the size of the array is.  Arrays grow
and shrink dynamically.

> How could I do this?
>
> My perl codes is like this:
>
> ....
> open (TSK, "more /tmp/task28.log | grep '$now' | grep 'out =' |") or
> die "cannot fork: $!";
>
> while (<TSK>) { # count them up.
>         ($foo,$foo,$foo,$time,$foo,$foo,$foo,$taskinfo,$foo,$foo,$foo,
> $foo,$targets,$foo,$foo,$foo, $bytes) = split ' ';

GAH!

my ($time, $taskinfo, $targets, $bytes) = (split ' ')[3,7,12,16];

> should be like array[$taskinfo] += $targets;
>
> How could I define the array or hash dynamicly?

Other than the missing dollar sign, what exactly is wrong with that
statement?  Did you try it out, or are you simply assuming it doesn't
work?

Please post a short-but-complete script that demonstrates the error
you're experiencing.

Paul Lalli



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

Date: 1 Mar 2007 05:15:17 -0800
From: "robertchen117@gmail.com" <robertchen117@gmail.com>
Subject: Re: parse a log file question
Message-Id: <1172754917.867774.43110@p10g2000cwp.googlegroups.com>

Sorry my question should be like this:
Fri Oct  6 00:00:23 2006: TR_execute_task( Lib/Task: library_name1/
task_name2 run bywww.hp.comon7 targets, out =3D 257

I know I can use $task_hash{$taskinfo} +=3D targets; -->count by lib/
task name.
but problems is I also need to count by time:
output should like this:

9:00am - 9:59am
  8,010  task2 lib3  77 targets     200,345 output
  3,221  task12  lib3    12 targets  1,530,234 output
 .=2E.

Do we have hash over hash? What should we implement this?


On 3=D4=C21=C8=D5, =CF=C2=CE=E79=CA=B105=B7=D6, "Paul Lalli" <mri...@gmail.=
com> wrote:
> On Mar 1, 7:50 am, "robertchen...@gmail.com" <robertchen...@gmail.com>
> wrote:
>
> > hi all,
>
> > the log file format is a long list of the item like:
> > Fri Oct  6 00:00:23 2006: TR_execute_task( Lib/Task: library_name1/
> > task_name2 run bywww.hp.comon7 targets, out =3D 257
>
> > I want to count the number of targets based on library_name1/
> > task_name2, but there are many library names and task names, so the
> > array size not know.
>
> Perl couldn't care less what the size of the array is.  Arrays grow
> and shrink dynamically.
>
> > How could I do this?
>
> > My perl codes is like this:
>
> > ....
> > open (TSK, "more /tmp/task28.log | grep '$now' | grep 'out =3D' |") or
> > die "cannot fork: $!";
>
> > while (<TSK>) { # count them up.
> >         ($foo,$foo,$foo,$time,$foo,$foo,$foo,$taskinfo,$foo,$foo,$foo,
> > $foo,$targets,$foo,$foo,$foo, $bytes) =3D split ' ';
>
> GAH!
>
> my ($time, $taskinfo, $targets, $bytes) =3D (split ' ')[3,7,12,16];
>
> > should be like array[$taskinfo] +=3D $targets;
>
> > How could I define the array or hash dynamicly?
>
> Other than the missing dollar sign, what exactly is wrong with that
> statement?  Did you try it out, or are you simply assuming it doesn't
> work?
>
> Please post a short-but-complete script that demonstrates the error
> you're experiencing.
>
> Paul Lalli




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

Date: Thu, 01 Mar 2007 14:57:03 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: parse a log file question
Message-Id: <3RBFh.32257$kr6.27893@trndny09>

robertchen117@gmail.com wrote:
> the log file format is a long list of the item like:
> Fri Oct  6 00:00:23 2006: TR_execute_task( Lib/Task: library_name1/
> task_name2 run by www.hp.com on 7 targets, out = 257
>
> I want to count the number of targets based on library_name1/
> task_name2, but there are many library names and task names, so the
> array size not know.

So what? Arrays in Perl grow dynamically.

> My perl codes is like this:
> ....
> open (TSK, "more /tmp/task28.log | grep '$now' | grep 'out =' |") or
> die "cannot fork: $!";

Ahhhhh! Is there a specific reason why you are shelling out 3 external 
processes for a task that could be done by two lines of Perl internally?
Besides, that's a totally useless use of more(1).
And where is $now coming from?

Suggestion:
    open (TSK, "/tmp/task28.log") or die "cannot fork: $!";

> while (<TSK>) { # count them up.

Suggestion continued:
        if (/$now/ and /out =/) {

>        ($foo,$foo,$foo,$time,$foo,$foo,$foo,$taskinfo,$foo,$foo,$foo,
> $foo,$targets,$foo,$foo,$foo, $bytes) = split ' ';

If you need a placeholder for a dummy value it is customary to use undef. 
Beside, you can index the result from split like a array. I suggest you read 
up on "array slice", too. Oh, and while you are at it check out the 
documentation for split(), too. It defaults to split on whitespace if the 
pattern is missing.
So you want something like
    ($taskinfo) = (split)[7];

> should be like array[$taskinfo] += $targets;

$taskinfo is a string, isn't it? The numerical value of a string is (unless 
it starts with a number) always 0. In other words you are overwriting 
array[0] over and over again.
Did you mean to use a hash instead?

> How could I define the array or hash dynamicly?

You don't. Perl arrays and hashes are always dynamic.

jue 




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

Date: 1 Mar 2007 07:04:29 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: parse a log file question
Message-Id: <1172761469.470088.98630@8g2000cwh.googlegroups.com>

On Mar 1, 8:15 am, "robertchen...@gmail.com"

> Do we have hash over hash? What should we implement this?

I can't understand the vast majority of your post - that's why I told
you to post a short-but-complete script, which you ignored - so I'll
just answer this question:  Yes, hashes of hashes are valid.  Please
read:
perldoc perlreftut
perldoc perllol
perldoc perldsc

Paul Lalli




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

Date: Thu, 1 Mar 2007 16:23:45 +0100
From: "Stefan Braun" <stefan.braun@orca.ch>
Subject: SOAP::Lite and header
Message-Id: <54o9g0F21thv1U1@mid.individual.net>

Hello,



I have to add an AuthHeader to a call of a webservice.





The header has to look like:



<soap:Header>

    <AuthHeader xmlns="xyz">

        <Company>XXX</Company>

        <Username>TEST</Username>

    </AuthHeader>

</soap:Header>



Has someone a idea how to do it? I didn't found a example in internet.



Thanks  for your help.



Regards



Stefan 




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

Date: 1 Mar 2007 05:29:01 -0800
From: "robertchen117@gmail.com" <robertchen117@gmail.com>
Subject: Too complex data structure?
Message-Id: <1172755741.228922.36770@k78g2000cwa.googlegroups.com>

Please ignore my first post for not clear question, here is my issue:

My log file with a long list like this item:
Fri Oct  6 00:00:23 2006: TR_execute_task( Lib/Task: library_name1/
task_name2 run by www.hp.com on 7 targets, out = 257

I know I can use $task_hash{$taskinfo} += targets; -->count by lib/
task name. Also need count the bytes according to the lib/task name.
And problems is I also need to count by time:
output should like this:

9:00am - 9:59am
  8,010  task2 lib3  77 targets     200,345 output
  3,221  task12  lib3    12 targets  1,530,234 output
 ...
 10:00am - 10:59am
 ....

This would need very complex data structure, please help me how to do?
Do we have hash over hash? What should we implement this?

Thanks a lot for help...



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

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


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