[23990] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6191 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 28 03:05:36 2004

Date: Sat, 28 Feb 2004 00:05:06 -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           Sat, 28 Feb 2004     Volume: 10 Number: 6191

Today's topics:
    Re: gd 1.41 install errors in red hat 9 <jwillmore@remove.adelphia.net>
        hash of hashes with lists (cousin_bubba)
    Re: hash of hashes with lists (Jay Tilton)
    Re: hash of hashes with lists <matthew.garrish@sympatico.ca>
    Re: perldb history dump? <bill_knight2@yahoo.com>
        regex <yamini_rajan@nospam.com>
    Re: regex <tadmc@augustmail.com>
    Re: regex (Walter Roberson)
    Re: SOAP::Lite install problem <randy@theoryx5.uwinnipeg.ca>
    Re: Thanks for the advice <jwcorpening@verizon.net>
    Re: Thanks for the advice <jurgenex@hotmail.com>
    Re: Thanks for the advice <beable+unsenet@beable.com.invalid>
    Re: traversing array slices <gnari@simnet.is>
    Re: traversing array slices <jgibson@mail.arc.nasa.gov>
    Re: traversing array slices <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: traversing array slices <tadmc@augustmail.com>
    Re: traversing array slices (valued customer)
    Re: Win32::OLE - how to effectively create large spread (Tom Niesytto)
        Win32::SAPI4 question (Win32 events and Perl) <edmonson@sdf.lonestar.org>
        XML best practices (was: Python as replacement for PHP? (Cameron Laird)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 27 Feb 2004 23:48:30 -0500
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: gd 1.41 install errors in red hat 9
Message-Id: <pan.2004.02.28.04.48.27.990742@remove.adelphia.net>

On Fri, 27 Feb 2004 13:27:08 -0800, Stephen Strong wrote:

> how do i get this module installed here is the error i get when trying to
> make:
> 
> gcc -c  -I/usr/local/include -I/usr/local/include/gd -D_REENTRANT -D_GNU_SOU
> RCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/includ
> e -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pip
> e -march=i386 -mcpu=i686   -DVERSION=\"1.41\" -DXS_VERSION=\"1.41\" -fPIC
> "-I/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE"  -DHAVE_JPEG -DHAVE_TT
> F -DHAVE_XPM GD.c
> GD.xs:7:16: gd.h: No such file or directory

You don't have the GD header files installed on your system or installed
somewhere that the Makefile can't find them. It
*tells* you so in the output :-)

Solution - install the GD header files :-)

HTH

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
An Englishman never enjoys himself, except for a noble purpose.  
-- A. P. Herbert 



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

Date: 27 Feb 2004 18:56:29 -0800
From: cousin_bubba@hotmail.com (cousin_bubba)
Subject: hash of hashes with lists
Message-Id: <cf64e035.0402271856.3560fa18@posting.google.com>

Hello,

I am a newbie with perl so please exuse me if this is a dumb question.

In my script I have a hash of hashes and the values of the internal
hashes are lists or arrays.  I need to access all of the elements of
these arrays for comparison.

The hash of hashes looks like this:

%line_sec = (
             one => (
                     WXYZ => ["ABCD", "EFGH"],
                     TUVW => ["TEFH", "LPCD"],
                     ),
             two => (
                     DVDC => ["GHIJ", "ELFO"],
                     LMNO => ["PQRS", "TUVW"],
                     )
);

Basically I want to cycle through all of the four letter accronyms to
see if they match a current value called $current_acc.  The numbers
"one" "two" etc are command line arguments.  The $head_acc variable is
the key of the inner hashes.  I have tried the following but it
doesn't work:

foreach $match (@{$line_sec{$ARGV[0]}}{$head_acc})
{
 if ($match eq $current_acc)
   {
    ...
   }
}

The array I would like to obtain for the case of "one" and "WXYZ" for
instance would be (GHIH ELFO).

Is there a way I can do this?

Thanks in advance for your help.


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

Date: Sat, 28 Feb 2004 03:30:58 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: hash of hashes with lists
Message-Id: <404005a4.17731034@news.erols.com>

cousin_bubba@hotmail.com (cousin_bubba) wrote:

: I am a newbie with perl so please exuse me if this is a dumb question.
: 
: In my script I have a hash of hashes and the values of the internal
: hashes are lists or arrays.  I need to access all of the elements of
: these arrays for comparison.
: 
: The hash of hashes looks like this:
: 
: %line_sec = (
:              one => (
:                      WXYZ => ["ABCD", "EFGH"],
:                      TUVW => ["TEFH", "LPCD"],
:                      ),
:              two => (
:                      DVDC => ["GHIJ", "ELFO"],
:                      LMNO => ["PQRS", "TUVW"],
:                      )
: );

If it really does look like that, you have a train wreck.

More probably, it looks like:

    %line_sec = (
         one => {
                 WXYZ => ["ABCD", "EFGH"],
                 TUVW => ["TEFH", "LPCD"],
                 },
         two => {
                 DVDC => ["GHIJ", "ELFO"],
                 LMNO => ["PQRS", "TUVW"],
                 }
    );

: Basically I want to cycle through all of the four letter accronyms

All twelve of them?  Or just "WXYZ", "TUVW", "DVDC" and "LMNO" ?

: see if they match a current value called $current_acc.  The numbers
: "one" "two" etc are command line arguments.  The $head_acc variable is
: the key of the inner hashes.  I have tried the following but it
: doesn't work:
: 
: foreach $match (@{$line_sec{$ARGV[0]}}{$head_acc})

You did the dereferencing incorrectly.

Compare:
    @{ $line_sec{$ARGV[0]} } {$head_acc}   # wrong
    @{ $line_sec{$ARGV[0]}   {$head_acc} } # right

: {
:  if ($match eq $current_acc)
:    {
:     ...
:    }
: }
 
: The array I would like to obtain for the case of "one" and "WXYZ" for
: instance would be (GHIH ELFO).

Do you mean (GHIJ ELFO)?
 
This is baffling.  "one" and "WXYZ" have no evident relationship to the
anonymous array ["GHIJ", "ELFO"] .  Are you sure you know what you want?



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

Date: Fri, 27 Feb 2004 22:25:41 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: hash of hashes with lists
Message-Id: <QST%b.21537$253.1414605@news20.bellglobal.com>


"cousin_bubba" <cousin_bubba@hotmail.com> wrote in message
news:cf64e035.0402271856.3560fa18@posting.google.com...
> Hello,
>
> I am a newbie with perl so please exuse me if this is a dumb question.
>
> In my script I have a hash of hashes and the values of the internal
> hashes are lists or arrays.  I need to access all of the elements of
> these arrays for comparison.
>
> The hash of hashes looks like this:
>
> %line_sec = (
>              one => (
>                      WXYZ => ["ABCD", "EFGH"],
>                      TUVW => ["TEFH", "LPCD"],
>                      ),
>              two => (
>                      DVDC => ["GHIJ", "ELFO"],
>                      LMNO => ["PQRS", "TUVW"],
>                      )
> );
>

That's not how you create a hash of hashes of arrays. The keys for %line_sec
hold anonymous hashes, so you should use braces not parentheses:

%line_sec = (
             one => {
                     WXYZ => ["ABCD", "EFGH"],
                     TUVW => ["TEFH", "LPCD"],
                     },
             two => {
                     DVDC => ["GHIJ", "ELFO"],
                     LMNO => ["PQRS", "TUVW"],
                     }
);


> Basically I want to cycle through all of the four letter accronyms to
> see if they match a current value called $current_acc.  The numbers
> "one" "two" etc are command line arguments.  The $head_acc variable is
> the key of the inner hashes.  I have tried the following but it
> doesn't work:
>
> foreach $match (@{$line_sec{$ARGV[0]}}{$head_acc})
                                     ^^^^

Those braces aren't balanced properly, either:

@{$line_sec{$ARGV[0]}{$head_acc}}


Matt




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

Date: Sat, 28 Feb 2004 04:00:29 +0000 (UTC)
From: bill <bill_knight2@yahoo.com>
Subject: Re: perldb history dump?
Message-Id: <c1p3ot$m8j$1@reader2.panix.com>

In <403EC634.4080604@rochester.rr.com> Bob Walton <invalid-email@rochester.rr.com> writes:

>bill wrote:

>> I use perldb with Readline enabled.  Is there any straightforward
>> way to dump the available command history from a perldb session?

>You might check out the "H" debugger command.

That's just the ticket.  Thanks.

Bill



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

Date: Fri, 27 Feb 2004 22:06:07 -0600
From: "yamini" <yamini_rajan@nospam.com>
Subject: regex
Message-Id: <e74a9f9632a8c4a6b497c3cde10d6072@localhost.talkaboutprogramming.com>

hi,
print "\t" x ($tab/8),' ' x ($tab%8);
 

     -what it is doing?can anyone explain



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

Date: Fri, 27 Feb 2004 22:19:22 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: regex
Message-Id: <slrnc405ma.4gh.tadmc@magna.augustmail.com>

yamini <yamini_rajan@nospam.com> wrote:

> print "\t" x ($tab/8),' ' x ($tab%8);


There is no regex there.

Where do you think you see a regex?

Please put the subject of your article in the Subject of your article.


> can anyone explain


The docs that come with perl can.


print() is in perlfunc.pod.

Backslash escapes, such as \t, are in "Quote and Quote-like Operators"
section in perlop.pod.

The x operator is in the "Multiplicative Operators" section in perlop.pod.

So is the / operator (division).  So is the % operator (modulus). 

All that's left is ' '. That is a string containing one space character.


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


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

Date: 28 Feb 2004 04:23:18 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: regex
Message-Id: <c1p53m$t78$1@canopus.cc.umanitoba.ca>

In article <e74a9f9632a8c4a6b497c3cde10d6072@localhost.talkaboutprogramming.com>,
yamini <yamini_rajan@nospam.com> wrote:

:print "\t" x ($tab/8),' ' x ($tab%8);


:     -what it is doing?can anyone explain

There's no regex there.

$tab is a character position. The position is being divided by 8 to
calculate a number of \t characters to print. The remainder upon division
by 8 ($tab % 8) are printed as spaces. 
-- 
   "[...] it's all part of one's right to be publicly stupid." -- Dave Smey


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

Date: Fri, 27 Feb 2004 22:44:48 -0600
From: "Randy Kobes" <randy@theoryx5.uwinnipeg.ca>
Subject: Re: SOAP::Lite install problem
Message-Id: <61V%b.70$l44.1533@news1.mts.net>

"Steven N. Hirsch" <shirsch@adelphia.net> wrote in message
 news:su6dnTVvqMtun6vd4p2dnA@adelphia.com...
> Dan Pelton wrote:
> > I am trying to install SOAP::Lite on a Sun box.
> > I tried installing the module using the following command and got the
> > error "don't know what it is". I can get it directly from the authors
> > web site, but I was wondering what my problem is? The author states that
> > it has been testes under Perl 5.7.1. Does SOAP::Lite version 0.55 work
> > under Perl 5.8?
>
> FYI, I am seeing the same thing.  SOAP::Lite seems to have vanished from
> the CPAN indices between last Friday and the end of the weekend.  Who is
> in charge of PAUSE data-management?

It's now reappeared in CPAN.

>
> Steve
>
> p.s. - Yes, SOAP::Lite works fine under Perl 5.8.x assuming you can make
> heads or tails out of the documentation.

Try http://soaplite.com/resources.html - there's a number of nice
articles and tutorials there that should get one started.

best regards,
randy kobes





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

Date: Sat, 28 Feb 2004 04:03:24 GMT
From: JC <jwcorpening@verizon.net>
Subject: Re: Thanks for the advice
Message-Id: <gqU%b.3554$TF2.1779@nwrdny02.gnilink.net>

Tad McClellan wrote:
>>I code alot with PERL, 
> No you don't.
> You code a lot with Perl.
> Perl is not an acronym.

Why do you waste your time to "correct" me?
PERL = Practical Extraction and Report Language.

Get a life, or a girlfriend.
-jc



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

Date: Sat, 28 Feb 2004 04:12:02 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Thanks for the advice
Message-Id: <myU%b.2284$C65.1352@nwrddc01.gnilink.net>

JC wrote:
> Tad McClellan wrote:
>>> I code alot with PERL,
>> No you don't.
>> You code a lot with Perl.
>> Perl is not an acronym.
>
> Why do you waste your time to "correct" me?
> PERL = Practical Extraction and Report Language.
>
> Get a life, or a girlfriend.

Mabye because apparently you don't know that this "explanation" is wrong and
a "reverse acronym"?
Maybe you don't even know that there is a FAQ about it:
    "What's the difference between "perl" and "Perl"?"

However, Tad jumped the gun a bit, too.
He couldn't know if maybe you are programming a lot in some other
programming language PERL which is different from Perl?

jue




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

Date: Sat, 28 Feb 2004 06:19:09 GMT
From: Beable van Polasm <beable+unsenet@beable.com.invalid>
Subject: Re: Thanks for the advice
Message-Id: <15smgv3ex5.fsf@dingo.beable.com>

JC <jwcorpening@verizon.net> writes:

> Thanks for replying to my original post and for pointing me in some
> directions.  As I mentioned, I code alot with PERL, but I'm pretty
> much self-taught, so I'm sure that I learned incorrectly and am at a
> very intro level, still.
> 
>  > And don't call sub-routines with a '&' unless you really
>  > know what you're doing.
> 
> Nope, I don't know enough to know otherwise.

Call subroutines with parentheses, like this:

mysub();

sub mysub
{
   print "doidy doidy doidy\n";
}

>  > XML::DOM
>  > XML::DOM::Document
> 
> Nope, don't know what these mean. 

These are module names. Take a look at http://search.cpan.org and
type these names in. Search for documentation on installing modules,
like "perldoc perlmodinstall" for example. Using modules will make
writing programs easier.


-- 
Why doesn't a twirp like you stop giving advice to the big boys like
me and Mel who know how to talk to people without putting them to
sleep? -- George Hammond
   


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

Date: Fri, 27 Feb 2004 23:40:17 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: traversing array slices
Message-Id: <c1okf3$ak9$1@news.simnet.is>

"TonyShirt" <tonyshirt@hotmail.com> wrote in message
news:52d54c07.0402271440.236a3ce7@posting.google.com...
> #I'm Trying to traverse an array slice that has been passed to a sub
> #I'm not sure what perl is doing when I set the reference to @_
>
>
> $Slice[1]=["a","b","c"];
> $Slice[2]=["d","e","f"];
>
> printslice(\@Slice);

this call your sub with one argument, an arrayref
judging from your following code, you probably meant to:
    printslice(@Slice);

> sub printslice{
> @tempslice = @_;

    my @tempslice = @_;

> foreach my $x (@tempslice){

here $x is an array ref

>     foreach ($w,$y,$z){
>     print $w."\n";
>     }

amazing. begone!
you want to print the first element of the array $x refers to
    print "$x->[0]\n";

> }
> }
>

gnari





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

Date: Fri, 27 Feb 2004 16:15:50 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: traversing array slices
Message-Id: <270220041615501832%jgibson@mail.arc.nasa.gov>

In article <52d54c07.0402271440.236a3ce7@posting.google.com>, TonyShirt
<tonyshirt@hotmail.com> wrote:

> #I'm Trying to traverse an array slice that has been passed to a sub
> #I'm not sure what perl is doing when I set the reference to @_
> 
> 
> $Slice[1]=["a","b","c"];
> $Slice[2]=["d","e","f"];
> 
> printslice(\@Slice);

You are calling printslice with an array reference.

> 
> 
> sub printslice{
>  @tempslice = @_;

You have copied the one-element @_ array to @tempslice.

>  
>  foreach my $x (@tempslice){

You are iterating over your one-element array. During the only
iteration, $x will be the value of the array reference.

>      foreach ($w,$y,$z){

You want to iterate over the original array, so replace the above line
with the following line to dereference the array and iterate over its 2
elements:

      foreach my $y ( @$x ) {

>         print $w."\n";

Each element is an array reference. Replace the above with the
following to print the first element in the reference array:

         print $$y[0]."\n"

>      }
>  }
> }
> 
> #I would like the output to be the first value in the slice i.e.:
> 
> #a
> #d
> 
> #Could any one help?

#!/usr/local/bin/perl

$Slice[1]=["a","b","c"];
$Slice[2]=["d","e","f"];

printslice(\@Slice);

sub printslice{
   @tempslice = @_;
   
   foreach my $x (@tempslice) {
       foreach my $y ( @$x ) {
      print $$y[0]."\n";
       }
   }
}

__OUTPUT__
a
d


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

Date: Fri, 27 Feb 2004 16:42:47 -0800
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: traversing array slices
Message-Id: <76oo1c.oou.ln@goaway.wombat.san-francisco.ca.us>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

On 2004-02-27, TonyShirt <tonyshirt@hotmail.com> wrote:
> #I'm Trying to traverse an array slice that has been passed to a sub
> #I'm not sure what perl is doing when I set the reference to @_

use strict;
use warnings;

(plus the comments you've already gotten)

- --keith

- -- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAP+QGhVcNCxZ5ID8RArVoAJ9u6SzvstxCLb0LH9rzkcVtMksD2QCfeci1
uqXXDXatZSfYdraLbNaQdJ0=
=8FyU
-----END PGP SIGNATURE-----


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

Date: Fri, 27 Feb 2004 17:49:38 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: traversing array slices
Message-Id: <slrnc3vlsi.42l.tadmc@magna.augustmail.com>

TonyShirt <tonyshirt@hotmail.com> wrote:

> #I'm Trying to traverse an array slice that has been passed to a sub


No you're not. You are trying to traverse an LoL that is passed
via a reference to an array.


> #I'm not sure what perl is doing when I set the reference to @_


You do not set any reference to @_ ...


> $Slice[1]=["a","b","c"];
> $Slice[2]=["d","e","f"];
> 
> printslice(\@Slice);


The arguments are not a slice. The argument is an array reference.

   printslice( @Slice[1,2] );

_That_ would be passing an array slice.


> sub printslice{
> 	@tempslice = @_;
> 	
> 	foreach my $x (@tempslice){
> 	    foreach ($w,$y,$z){
> 		    print $w."\n";


I am at a complete loss as to what you think that inner foreach
is supposed to be doing. You are printing a variable that has
never been given any value...


> 	    }
> 	}
> }
> 
> #I would like the output to be the first value in the slice i.e.:


There are NO "slices" anywhere in the code you posted!


> #a
> #d
> 
> #Could any one help?


We could if we knew what you wanted.

Here is my guess:

---------------------
sub printslice{
        my($array_ref) = @_;

        foreach my $inner_array (@$array_ref){
              next unless defined $inner_array;  # $Slice[0] is undef
              print "$inner_array->[0]\n";       # print the first element
        }
}
---------------------


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


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

Date: 27 Feb 2004 19:43:32 -0800
From: scooterm@hotmail.com (valued customer)
Subject: Re: traversing array slices
Message-Id: <1b347673.0402271943.5f9f962e@posting.google.com>

tonyshirt@hotmail.com (TonyShirt) wrote in message news:<52d54c07.0402271440.236a3ce7@posting.google.com>...
> #I'm Trying to traverse an array slice that has been passed to a sub
> #I'm not sure what perl is doing when I set the reference to @_
> 
> 
> $Slice[1]=["a","b","c"];
> $Slice[2]=["d","e","f"];
Assuming you *really* meant to start with zero-indexed 
array element ... $Slice[0] ...
> 
> printslice(\@Slice);
> 
> 
> sub printslice{
> 	@tempslice = @_;
> 	
> 	foreach my $x (@tempslice){
> 	    foreach ($w,$y,$z){
> 		    print $w."\n";
> 	    }
> 	}
> }
> 
> #I would like the output to be the first value in the slice i.e.:
> 
> #a
> #d
> 
> #Could any one help?

You might be mixing things up, what you are calling a 'slice'
is really a pair of anonymous array references inside an array
called 'Slice'. If you are used to programming Python, then that
is probably causing the mixup. 

The following example might be more what you intended.

### INITIALIZE
my @Slice = ();
$Slice[0]=["a","b","c"];
$Slice[1]=["d","e","f"];

### call the subroutine passing a single argument (array ref)
&printslice(\@Slice);

sub printslice
{
    ### grab the single argument (array ref)
    my $tempslice = shift;
    
    ### deref and loop through the array
    ### and assign the nested ref to $x
    foreach my $x (@{$tempslice})
    {
        ### deref $x and get the zero-th element
        print $x->[0]."\n";
    }
}


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

Date: 27 Feb 2004 20:37:48 -0800
From: woland99@yahoo.com (Tom Niesytto)
Subject: Re: Win32::OLE - how to effectively create large spreadsheet?
Message-Id: <694461f6.0402272037.14b4ab19@posting.google.com>

Folks - thanks A LOT for all the replies.
I learned several good lessons from them.

And YES - writing ia all at once takes no time whatsoever.
All you have to do is to calculate the Range parameters and
move the line that set Value property outside of the loop:

foreach $ref (@{$array_ref})
{
  $row_num++;
  $col_num = 0;
  foreach $cell_value (@{$ref})
  {
    $col_num++;
  }
}
$wsheet->Range($wsheet->Cells(1,1), $wsheet->Cells($row_num, $col_num)
)->{Value} = $array_ref;

Now it takes about a second ;-)

Cheers,

JT

woland99@yahoo.com (Tom Niesytto) wrote in message news:<694461f6.0402262024.6a72d5bf@posting.google.com>...
> Howdy - I am using Win32::OLE to create a spreasheet from data.
> Spreadsheet is fairly big (2000 rows x 30 columns) and cells contain 
> embedded newlines (if itwas not for that I would simbly import tab
> delimited file). 
> To write to Excel spreadsheet I do sth like:
> -----------------------------------------
> sub write_array_as_excel_file
> {
> my $output_file = shift;
> my $array_ref = shift; #reference to array of references to arrays
> 
> eval{$excel = Win32::OLE->GetActiveObject('Excel.Application')};
> die "Excel not installed" if $@;
> 
> unless (defined $excel) {
>     $excel = Win32::OLE->new('Excel.Application', 'Quit')
> 		    or die "Oops, cannot start Excel";
> }
> #to avoid excessive dialogs when saving in non-Excel format
> $excel->{DisplayAlerts} = 0;
> 
> # get a new workbook
> my $wbook = $excel->Workbooks->Add
> 	|| print STDERR "didnt add new workbook: $!\n";
> 
> # write to a particular cell
> my $wsheet = $wbook->Worksheets(1);
> my $ref;
> my $cell_value;
> my $row_num = 0;
> my $col_num = 0;
> 
> foreach $ref (@{$array_ref}) {
> $row_num++;
> $col_num = 0;
> 
> foreach $cell_value (@{$ref}){
> $col_num++;
> $wsheet->Cells($row_num,$col_num)->{Value} = "$cell_value";
> }
>  
> }
> $wbook->SaveAs($fullname_output_file);
> undef $wbook;
> }
> -----------------------------
> 
> Problem is - it is slow. 
> Takes about 20 mins to write out the output.
> What am I doing wrong here?
> 
> Thanks for any pointers,
> 
> JT


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

Date: Fri, 27 Feb 2004 22:20:32 -0500
From: Michael Edmonson <edmonson@sdf.lonestar.org>
Subject: Win32::SAPI4 question (Win32 events and Perl)
Message-Id: <c1p1dv$1knqid$1@ID-171963.news.uni-berlin.de>

I've been playing around with the Win32::SAPI4 module, which provides
access to a slightly crufty version of Microsoft's speech API.  I've
been able to get a simple speech example working, though I've been
unable to figure out how how events such as "SpeakingStarted" and
"SpeakingDone" are accessed.  These are mentioned in the "vb.chm"
documentation (Microsoft Speech SDK/document/vb.chm, under Voice Text 
Control, Events), which says only:

   Events
   The Voice Text control can receive the following events:

   SpeakingDone()
   Occurs when speaking is finished and no text remains in the
   playback queue.

   SpeakingStarted()
   Occurs when speaking has started.

I was wondering if anyone has any idea how these events, or Win32
events in general, may be accessed via Perl.  Is Win32::Event involved? 
  Or are they supposed to be implemented and registered somehow as 
callback subs?  Or something else?

Here is some code that speaks a string (that part works, anyway),
trying to receive notification when playback is finished:

   #!/usr/bin/perl -w
   # speech demo

   use strict;
   use Win32::SAPI4;
   use Win32::Event;

   my $vt = new Win32::SAPI4::VoiceText();

   $vt->Select($vt->find("Gender=1"));

   my $text = "this is only a test";

   $vt->Speak($text);

   sub SpeakingDone {
       # ???
       die "speakingdone";
   }

   sub SpeakingStarted {
       # ???
       die "speakingstarted";
   }

   my $ev = new Win32::Event(0,0,"SpeakingDone");
   $ev->wait(5000);
   # seems to block the speech from starting for 5 seconds
   # rather than being signaled when it ends

   print "done\n";

Unfortunately, neither callback sub is ever invoked, and the 
Win32::Event code just seems to get in the way.  I know I can just loop 
while testing the "IsSpeaking" property, which is okay, but I'm actually 
mostly concerned about events because interacting with them seems 
unavoidable when using the Voice Dictation control.

Any advice at all would be appreciated.  The Win32::SAPI4 and 
Win32::Event docs are woefully brief, and Google has been surprisingly 
coy about coughing up Win32 event-related Perl code.

Michael


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

Date: Sat, 28 Feb 2004 03:54:49 -0000
From: claird@lairds.com (Cameron Laird)
Subject: XML best practices (was: Python as replacement for PHP?)
Message-Id: <1040489b2ookafd@corp.supernews.com>

In article <30260531.0402271901.1bbdda99@posting.google.com>,
simo <simoninusa2001@yahoo.co.uk> wrote:
			.
			.
			.
>Perl - bloody fast, if you're doing lots of text processing/regex
>(e.g. XML parsing) then Perl is it, probably best for sysadmin tasks
>too. We use this for large reports at work. I love its hash handling
			.
			.
			.
Let me get this straight:  your preferred vehicle for XML
parsing is Perl regular expressions?  That's ... well, it's
a different impression than I've ever gained from anyone
else with deep XML experience.  It's sure not my first
instinct.
-- 

Cameron Laird <claird@phaseit.net>
Business:  http://www.Phaseit.net


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

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


Administrivia:

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

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

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

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

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


------------------------------
End of Perl-Users Digest V10 Issue 6191
***************************************


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