[22912] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5132 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 24 18:05:40 2003

Date: Tue, 24 Jun 2003 15:05: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           Tue, 24 Jun 2003     Volume: 10 Number: 5132

Today's topics:
        comparing rows in a multidimensional array (perl user)
    Re: creating an array on the fly (Andres Monroy-Hernandez)
    Re: Database Connection Pooling in Perl CGI Script WITH <Juha.Laiho@iki.fi>
    Re: Database Connection Pooling in Perl CGI Script WITH (Pete Butler)
    Re: Database Connection Pooling in Perl CGI Script WITH (Pete Butler)
    Re: Help needed with Net::Telnet <mbudash@sonic.net>
    Re: Help needed with Net::Telnet <shotoku.taishi@virgin.net>
    Re: Help needed with Net::Telnet <shotoku.taishi@virgin.net>
    Re: LWP Extra Header Lines <abigail@abigail.nl>
        Oracle CLOB using DBI (Ken Chesak)
    Re: Please help with a script, knoledge needed! <estrunk @ home.nl>
    Re: Please help with a script, knoledge needed! <mbudash@sonic.net>
    Re: Please help with a script, knoledge needed! <estrunk @ home.nl>
    Re: POE drops one state from a session (Thomas)
    Re: s/// substitution with capture / memory in a variab <aburger@rogers.com>
    Re: soap::lite hellp needed with sms <katz@underlevel.net>
    Re: stopping PPM3 connecting to internet for LOCAL inst (Randy Kobes)
        Surprised by read() (Mark Wirdnam)
        Win32::OLE, Excel, and coloring (M. David Allen)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 24 Jun 2003 13:13:58 -0700
From: r230sl55@yahoo.com (perl user)
Subject: comparing rows in a multidimensional array
Message-Id: <588b17a9.0306241213.5a29dbd1@posting.google.com>

how can i compare rows (3 or more rows) in a multidiemensional array?
they all contain numeric values, i need to find its similar values and
unique values.


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

Date: 24 Jun 2003 12:58:05 -0700
From: andres@monroy.com (Andres Monroy-Hernandez)
Subject: Re: creating an array on the fly
Message-Id: <3591b31a.0306241158.4d4141cd@posting.google.com>

> does anyone know of a way to create an array on the fly?  ie, within a
> loop, each time the loop executes a new array will be created...
> 


my @arrayOfArrays;
while($i < 15){

    #a new array is created here
    my @yourNewArray;
    push(@ArraysOfArrays, \@yourNewArray);
   
    $i++;
}


Then if you want to print all the elements of your arrayOfArrays:
foreach my $Arrays (@ArraysOfArrays){
    print "@$Arrays\n";
}


In the documentation you can a more info on this topic:
http://www.perldoc.com/perl5.6/pod/perldsc.html#ARRAYS-OF-ARRAYS


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

Date: Tue, 24 Jun 2003 18:07:01 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: Database Connection Pooling in Perl CGI Script WITHOUT mod_perl
Message-Id: <bda3vm$ibe$1@ichaos.ichaos-int>

pmbutler@attbi.com (Pete Butler) said:
>I'm working on a Perl CGI application, and I'd like to set up database
>connection pooling for obvious performance-related reasons.
>
>However, the server I'm working on is provided by a third party, so I
>do NOT have access to mod_perl.
>
>Does anybody know of a way I can do connection pooling under these
>conditions?  Or am I just screwed without mod_perl?

CGI mode of operation is that the CGI program is executed separately for
each request. Also, the CGI program cannot affect the actual server in
any way.

With these, I find it very hard to see where you could store your
open database connections. Or, ok, you could have a separate standalone
process having the DB connections open, and then connecting to that
process form your CGI, but I think that wouldn't be that much faster.

As for performance; I think the cost of setting up a MySQL connection
can't be even 1/10 of the cost of firing up a CGI process, so your
bottleneck won't be the database connection set-up time.
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)


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

Date: 24 Jun 2003 14:00:19 -0700
From: pmbutler@attbi.com (Pete Butler)
Subject: Re: Database Connection Pooling in Perl CGI Script WITHOUT mod_perl
Message-Id: <9b766f0.0306241300.3a2ef934@posting.google.com>

"codeWarrior" <GPatnude@adelphia.net> wrote in message news:<Jk0Ka.16470$Jw6.6946502@news1.news.adelphia.net>...
> DB Connections are relatively LOW overhead compared to loading / compiling /
> executing a Perl CGI --> Perhaps your CGI's need to be optimized... the
> other question is: How manny DB connections does your third-party server
> allow each account to have ??? you may be up against an arbitrary limit over
> which you have no control...

They only limit the number of cross-server connections; if script and
DB are on the same server, they claim they don't limit it.

Not that it matters a lot; I was trying to set up a connection pool as
"pre-emptive" performance tuning.  (The performance problems I'm
seeing appear to have more to do with the environment than the code,
but I figured tweaking the code might help a bit.)  Sounds like the
cost:benefit ratio isn't breaking correctly for me with this approach,
though.

> On top of that -- you'd probably be better off implicitly "connecting" and
> "disconnecting" in your script so you can immediately "free-up" any open
> connections that are not really in use... 

Already doing that, though nice to hear it re-affirmed as a solid
design decision.

> I have a FreeBSD / mySQL / postgreSQL dedicated server with about 200 sites
> hosted on it --- Roughly 30,000 queries per day and have no performance
> issues with database connections.... Perhaps your "third-party" server is
> 'over-hosting"...

Can't rule that out; site performance seems to vary quite a bit
depending on time of day.

> you might also analyze your SQL queries for efficiency /
> speed while you're at it...

In the queue; I don't claim to be a SQL guru, so I'm sure a little
research there will be well worth my while.

Thanks for the help!

-- Pete Butler


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

Date: 24 Jun 2003 14:08:27 -0700
From: pmbutler@attbi.com (Pete Butler)
Subject: Re: Database Connection Pooling in Perl CGI Script WITHOUT mod_perl
Message-Id: <9b766f0.0306241308.4155a65b@posting.google.com>

Juha Laiho <Juha.Laiho@iki.fi> wrote in message news:<bda3vm$ibe$1@ichaos.ichaos-int>...

> With these, I find it very hard to see where you could store your
> open database connections. Or, ok, you could have a separate standalone
> process having the DB connections open, and then connecting to that
> process form your CGI, but I think that wouldn't be that much faster.

Drat.

> As for performance; I think the cost of setting up a MySQL connection
> can't be even 1/10 of the cost of firing up a CGI process, so your
> bottleneck won't be the database connection set-up time.

I didn't realize the DB connection was chump change compared to the
CGI itself, so thanks for that tip.  Even so, I think I can help my
performance if I trim down the number of connections I make; I have it
set up so that each SQL query opens and closes its own connection. 
That's going to be a minimum of two connections per page load (one to
grab user session data, at least one to populate the page).  Maybe if
I do a little refactoring, I can get my code to open and pass around a
single connection.  Or something.

But regardless, thanks for letting me know I'm pretty much chasing a
dead end.

-- Pete Butler


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

Date: Tue, 24 Jun 2003 18:50:51 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Help needed with Net::Telnet
Message-Id: <mbudash-29196D.11505224062003@typhoon.sonic.net>

In article <bd9ngn$t4g$1@news8.svr.pol.co.uk>,
 "Shotoku Taishi" <shotoku.taishi@virgin.net> wrote:

> Hi
> 
> I would like to run commands remotely using net::telnet from CPAN.
> 
> I am trying to run the following:
> 
> #!/usr/bin/perl -w
> use strict;
> use Net::Telnet;
> 
> my $host= "Andromeda";
> my $username = "Andro";
> my $passwd = "stars";

above it look sllike you understand about 'use strict;', but below it 
appears you do not...
 
> $t = new Net::Telnet (Timeout => 10,
>                       Prompt  => '/c:\\\\users\\\\andro>$/i');

s/b:

my $t = new Net::Telnet (Timeout => 10,
                         Prompt  => '/c:\\\\users\\\\andro>$/i');

> $t->open("$host");
> $t->login($username, $passwd);
> @lines = $t->cmd("ls");

s/b:

my @lines = $t->cmd("ls");

> print @lines;
> 
> I get the following error message:
> 
> Global symbol "$t" requires explicit package name

i'm quite sure you're seeing more than just one such error... but make 
the changes and your script should at least compile...

hth-

-- 
Michael Budash


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

Date: Tue, 24 Jun 2003 20:08:41 +0100
From: "Shotoku Taishi" <shotoku.taishi@virgin.net>
Subject: Re: Help needed with Net::Telnet
Message-Id: <bda8ai$2rl$1@newsg4.svr.pol.co.uk>

Thank you. At least I got it to compile now. I did not know use strict; was
that strict. :-)

Now I get the following error:

timed-out waiting for login prompt at C:\test\mike.pl line 13

Thank you for your help so far.

Mike

"Michael Budash" <mbudash@sonic.net> wrote in message
news:mbudash-29196D.11505224062003@typhoon.sonic.net...
> In article <bd9ngn$t4g$1@news8.svr.pol.co.uk>,
>  "Shotoku Taishi" <shotoku.taishi@virgin.net> wrote:
>
> > Hi
> >
> > I would like to run commands remotely using net::telnet from CPAN.
> >
> > I am trying to run the following:
> >
> > #!/usr/bin/perl -w
> > use strict;
> > use Net::Telnet;
> >
> > my $host= "Andromeda";
> > my $username = "Andro";
> > my $passwd = "stars";
>
> above it look sllike you understand about 'use strict;', but below it
> appears you do not...
>
> > $t = new Net::Telnet (Timeout => 10,
> >                       Prompt  => '/c:\\\\users\\\\andro>$/i');
>
> s/b:
>
> my $t = new Net::Telnet (Timeout => 10,
>                          Prompt  => '/c:\\\\users\\\\andro>$/i');
>
> > $t->open("$host");
> > $t->login($username, $passwd);
> > @lines = $t->cmd("ls");
>
> s/b:
>
> my @lines = $t->cmd("ls");
>
> > print @lines;
> >
> > I get the following error message:
> >
> > Global symbol "$t" requires explicit package name
>
> i'm quite sure you're seeing more than just one such error... but make
> the changes and your script should at least compile...
>
> hth-
>
> --
> Michael Budash




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

Date: Tue, 24 Jun 2003 21:09:37 +0100
From: "Shotoku Taishi" <shotoku.taishi@virgin.net>
Subject: Re: Help needed with Net::Telnet
Message-Id: <bdabs3$uqu$1@newsg2.svr.pol.co.uk>

Hi

If I telnet a Unix box and if I use:

Prompt  => '/%/');

I do manage to run the "ls" command on the remote host.

I am having real problems with the Windows prompt.though :-(

"Shotoku Taishi" <shotoku.taishi@virgin.net> wrote in message
news:bda8ai$2rl$1@newsg4.svr.pol.co.uk...
> Thank you. At least I got it to compile now. I did not know use strict;
was
> that strict. :-)
>
> Now I get the following error:
>
> timed-out waiting for login prompt at C:\test\mike.pl line 13
>
> Thank you for your help so far.
>
> Mike
>
> "Michael Budash" <mbudash@sonic.net> wrote in message
> news:mbudash-29196D.11505224062003@typhoon.sonic.net...
> > In article <bd9ngn$t4g$1@news8.svr.pol.co.uk>,
> >  "Shotoku Taishi" <shotoku.taishi@virgin.net> wrote:
> >
> > > Hi
> > >
> > > I would like to run commands remotely using net::telnet from CPAN.
> > >
> > > I am trying to run the following:
> > >
> > > #!/usr/bin/perl -w
> > > use strict;
> > > use Net::Telnet;
> > >
> > > my $host= "Andromeda";
> > > my $username = "Andro";
> > > my $passwd = "stars";
> >
> > above it look sllike you understand about 'use strict;', but below it
> > appears you do not...
> >
> > > $t = new Net::Telnet (Timeout => 10,
> > >                       Prompt  => '/c:\\\\users\\\\andro>$/i');
> >
> > s/b:
> >
> > my $t = new Net::Telnet (Timeout => 10,
> >                          Prompt  => '/c:\\\\users\\\\andro>$/i');
> >
> > > $t->open("$host");
> > > $t->login($username, $passwd);
> > > @lines = $t->cmd("ls");
> >
> > s/b:
> >
> > my @lines = $t->cmd("ls");
> >
> > > print @lines;
> > >
> > > I get the following error message:
> > >
> > > Global symbol "$t" requires explicit package name
> >
> > i'm quite sure you're seeing more than just one such error... but make
> > the changes and your script should at least compile...
> >
> > hth-
> >
> > --
> > Michael Budash
>
>




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

Date: 24 Jun 2003 20:58:05 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: LWP Extra Header Lines
Message-Id: <slrnbfheqt.el.abigail@alexandra.abigail.nl>

Robert (robert@nrc.net) wrote on MMMDLXXXIV September MCMXCIII in
<URL:news:22d0e990.0306240810.69454449@posting.google.com>:
,,  Hi,
,,    
,,  Does anyone know how to add extra request header lines with LWP?
,,  
,,  I've seen this way but thought I'd see if there's a 'better' way: 
,,  my @headers = (
,,     'User-Agent' => 'Mozilla/4.76 [en] (Win98)',
,,     'Accept-Language' => 'en',
,,     'Accept-Charset' => 'iso-8859-1',
,,     'Accept-Encoding' => 'gzip',
,,     'Accept' => 'image/gif, image/jpeg');
,,  my $response = $browser->get($url, @headers);


It all depends on what you find "a better way". LWP consists of a whole
set of modules, allowing you to do requests in many ways. Since you don't
tell use what $browser is in the above code, I don't know what it's doing.

The above code is mostly data, and just one method call. There isn't
much to improve anyway.

,,  And, maybe more importantly does anyone know where I can find a list
,,  of how different browser headers look?

In the source code of the various browsers. It's not a Perl question.



Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


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

Date: 24 Jun 2003 13:55:40 -0700
From: datavector@hotmail.com (Ken Chesak)
Subject: Oracle CLOB using DBI
Message-Id: <3f2f39c4.0306241255.67938703@posting.google.com>

Does someone have a working code sample of Perl/DBI returning a CLOB
column from Oracle.   Here is what I came up with, I counld not get
ORA_CLOB to work.

$sth1 = $dbh->prepare(q{
               BEGIN OPEN :cursor FOR
               SELECT dbms_lob.substr( comments, 30000, 1)
               FROM comments WHERE id_comment = 46;
                END;
       });

       $sth1->bind_param_inout(":cursor", \$sth2,  30000, {  ora_type 
=> ORA_RS
ET } );
       $sth1->execute();

       while ( @row = $sth2->fetchrow ) {
                print "row = @row\n";
        }

Thanks


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

Date: Tue, 24 Jun 2003 21:57:04 +0200
From: Eric Strunk <estrunk @ home.nl>
Subject: Re: Please help with a script, knoledge needed!
Message-Id: <jrahfv0ehjdv9o8ff1l2p4bjaaibidk5nv@4ax.com>

On Tue, 24 Jun 2003 00:49:56 GMT, Michael Budash <mbudash@sonic.net>
wrote:

>In article <nf7ffv47h4efaiu3ps50u80s5vsdv62nih@4ax.com>,
> Eric Strunk <estrunk @ home.nl> wrote:
>
>> Hello all,
>> 
>> I don't have any knoledge of perl but i have a script what is running
>> on the server and doesn't do his job.
>> 
>> It has to search along a lot of files and find a word in a line.
>> If it finds the word only this line has to be displayed on the screen.
>> Then it has to search for the next same word in the same file.
>> If it doesn't find the next word in a line it has to go to the next
>> file and do the same again.
>> 
>> Until the first word in the file it works nice and even the printing
>> is fine. But it never find the next line what contain the same search
>> querie, instead it goes to the next file and find there the first word
>> and so on.
>> 
>> This is the search file with printing,
>> -------------------------------------------------------------
>> #!/usr/bin/perl  
>> 
>> use strict;
>> use warnings;
>> use CGI;
>> use CGI::Carp ("fatalsToBrowser");
>> my $q = CGI->new;
>> my $zoek = $q->param("zoek");
>> chdir "/www/xxx.xxx.xxxxxx.xx/xxxx";
>> my @data_files = glob "*.*";
>> 
>> print CGI::header();
>> print CGI::start_html(" my searchengine");
>> 
>> print <<EOT;
>> <P><UL><BR><FONT SIZE=+1><B><I>Legenda:</I></B></FONT><P>
>> 1 = Recordnummer<BR>
>> 2 = Geslacht<BR>
>> 3 = Naam en voornamen<BR>
>> 4 = Geboorteplaats<BR>
>> 5 = Geboortedatum<BR>
>> 6 = Overlijdensdatum<BR>
>> 7 = Recordnummer vader<BR>
>> 8 = Recordnummer moeder<BR></UL><P><HR WIDTH=33% ALIGN=LEFT>
>> EOT
>> 
>> 
>> my $hits = 0;
>> foreach my $file ( @data_files ) {
>>     if ( !open F, "<$file" ) {
>>         warn "Could not open $file ($!)\n";
>>         next;
>>     }
>> 
>>     my $found = 0;
>>     while (<F>) {
>>         if ( /$zoek/i ) {
>>             $hits++;
>>             print
>> "<pre><b>Bestandsnaam</b><br>\n<i>$file</i></PRE><br>\n";
>>             print "<pre>    1  2      3
>> 4                                                     5          6
>> 7       8</pre>" ; \
>> 		print "<pre>$_\n<br></PRE>";
>>             last;
>
>^^^^^^^^^^^^^^^^^^^
>remove this line
>
>>         }
>>     }
>>     close F;
>> }
>> 
>> print "<h3>", $hits ? $hits : "Geen", " bestanden gevonden</H3>";
>> 
>> --------------------------------------------------------------------
>> This is it, can anyone help me please to get all the lines in one file
>> and go to the next file after that.
>> 
>> Kind regards 
>> Eric.
>
>hth-
Hello out there,

Still have a question.
Everytime a hit takes place it is putting header info above it. 
$file and the line wit 12345678

How do i get it to print it once for a file, but only if found
something in the file.

Another cry 
Eric.



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

Date: Tue, 24 Jun 2003 20:24:55 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Please help with a script, knoledge needed!
Message-Id: <mbudash-8C3F3B.13245424062003@typhoon.sonic.net>

In article <jrahfv0ehjdv9o8ff1l2p4bjaaibidk5nv@4ax.com>,
 Eric Strunk <estrunk @ home.nl> wrote:

<snip>

> Still have a question.
> Everytime a hit takes place it is putting header info above it. 
> $file and the line wit 12345678
> 
> How do i get it to print it once for a file, but only if found
> something in the file.

while (<F>) {
   my $hdrprinted;
   if ( /$zoek/i ) {
      $hits++;
      unless ($hdrprinted) {
         # print the header here
         $hdrprinted++;
      }
      print "<pre>$_\n<br></PRE>\n";
   }
}

hth-
-- 
Michael Budash


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

Date: Tue, 24 Jun 2003 23:26:39 +0200
From: Eric Strunk <estrunk @ home.nl>
Subject: Re: Please help with a script, knoledge needed!
Message-Id: <kmfhfv8bvtd5sg33thua4rm8pqvop8h09a@4ax.com>

On Tue, 24 Jun 2003 20:24:55 GMT, Michael Budash <mbudash@sonic.net>
wrote:

<snip>

>> How do i get it to print it once for a file, but only if found
>> something in the file.
>
>while (<F>) {
>   my $hdrprinted;
>   if ( /$zoek/i ) {
>      $hits++;
>      unless ($hdrprinted) {
>         # print the header here
>         $hdrprinted++;
>      }
>      print "<pre>$_\n<br></PRE>\n";
>   }
>}
>
>hth-

It didn't work out still have all the headers i had before, put all
the code down here again.

#!/usr/bin/perl  

use strict;
use warnings;
use CGI;
use CGI::Carp ("fatalsToBrowser");
my $q = CGI->new;
my $zoek = $q->param("zoek");
chdir "/xxx/xxx.xxx.xx/xxxxx";
my @data_files = glob "*.*";

print CGI::header();
print CGI::start_html("genealogische zoekmachine");

print <<EOT;
<P><UL><BR><FONT SIZE=+1><B><I>Legenda:</I></B></FONT><P>
1 = Recordnummer<BR>
2 = Geslacht<BR>
3 = Naam en voornamen<BR>
4 = Geboorteplaats<BR>
5 = Geboortedatum<BR>
6 = Overlijdensdatum<BR>
7 = Recordnummer vader<BR>
8 = Recordnummer moeder<BR></UL><P><HR WIDTH=33% ALIGN=LEFT>
EOT


my $hits = 0;
foreach my $file ( @data_files ) {
    if ( !open F, "<$file" ) {
        warn "Could not open $file ($!)\n";
        next;
    }
    my $found = 0;
    while (<F>) {
    my $hdrprinted;
        if ( /$zoek/i ) {
            $hits++;
            unless ($hdrprinted) {
	   print "<pre> test </pre>\n";

print"<pre><b>Bestandsnaam</b><br>\n<i>$file</i></PRE><br>\n";
                print "<pre>  1  </pre>" ; \
  	  $hdrprinted++;
	}   
	print "<pre>$_\n<br></PRE>";
        }

    }
    close F;
}

print "<h3>", $hits ? $hits : "Geen", " bestanden gevonden</H3>";

------------------------------------------------------------------------
It still prints everything between unless [$hdrprinted ] and
$hdrprinted every hitt, does something be declared???

Thanks for the last answer you did give.
I'm verry glad you posted it.

Kind regards
Eric.


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

Date: 24 Jun 2003 15:02:34 -0700
From: thomas-ggl-01@data.iatn.net (Thomas)
Subject: Re: POE drops one state from a session
Message-Id: <4f2cac50.0306241402.10c941b4@posting.google.com>

"bd" <bdonlan@bd-home-comp.no-ip.org> wrote in message news:<pan.2003.06.15.01.23.09.20493@bd-home-comp.no-ip.org>...
> I'm trying to write an IRC game bot, but POE's dropping the
> 'irc_connected' state:

 ...snip...

> sub testirc_connected {
>     print "connected\n";
>     my ( $heap, $kernel ) = @_[ HEAP, KERNEL ];
>     $kernel->post( 'IRC', 'privmsg', 'bd_', 'hello, world!' );
>     $kernel->post('IRC', 'join', $channel);
> }

I am very new to POE and P::C::IRC, but the docs state, "NOTE: When
you get an ``irc_connected'' event, this doesn't mean you can start
sending commands to the server yet. Wait until you receive an irc_001
event (the server welcome message) before actually sending anything
back to the server."

You should create another method, irc_001, and do your privmsg and
channel joining, etc., from that method. (And of course tell POE you
want the 001 event so it calls your method.)

> It dosen't work yet (I'm getting the IRC working before the game logic).
> It gives me:
> _start at ./cmod-poe.pl line 71.
> connected
> a 'irc_connected' state was sent from
> /usr/share/perl5/POE/Component/IRC.pm at 343
> to session 2, but session 2 has neither that
> state nor a _default state to handle it
> (I ctrl-C it here)

If the changes I recommended above don't fix this problem, take a look
at the examples provided with the latest release of P::C::IRC.

I'm not familiar with the way you created your POE session. The way I
start my script is like this:

# ---------------------

new POE::Component::IRC('mybot') or die "Doh!\n";
new POE::Session
(
	'main' => [ qw(_start _stop irc_001 irc_kick irc_error irc_socketerr
irc_disconnected irc_msg irc_public) ]
);
$poe_kernel->run();

# ---------------------

Then instead of naming your functions test*, e.g. testirc_connected,
you would name them irc_connected, etc.

Regards,
Thomas


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

Date: Tue, 24 Jun 2003 20:20:34 GMT
From: Alex Burger <aburger@rogers.com>
Subject: Re: s/// substitution with capture / memory in a variable
Message-Id: <mo2Ka.9741$O31.1825@news02.bloor.is.net.cable.rogers.com>

>
>
>   $right = '"two **** $1 **** four"' ; # made a subtle change here...
>   ...
>   $string =~ s/$left/$right/ee;
>  
>
Thanks Tad and everyone else.  I am going to go ahead and use the above 
method.

>Warning Will Robinson!!
>
>Then you should be wary of the large security issues associated
>with allowing such a thing.
>
>Are you aware of the danger? 
>
I have made note of that in the docs of my program for users to see, and 
the feature also has to be enabled (default is off).  The only people 
that will be able to modify the strings are administrators via 
configuration files, so I can only tell them to make sure they are kept 
secure..

I am going to look at Brian McCauley's String::Interpolate module also.  
Maybe that will help..

Thanks again!

Alex



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

Date: Tue, 24 Jun 2003 15:44:01 -0500
From: Yarden Katz <katz@underlevel.net>
Subject: Re: soap::lite hellp needed with sms
Message-Id: <86znk7mcj2.fsf@underlevel.net>

mike solomon <mike_solomon@lineone.net> writes:

[snip]
> If anyone knows if there is a way to produce a / rather than a # I
> will be really grateful

It's very easy, just use:

  -> on_action(sub {sprintf '%s/%s', @_})

In your SOAP object.  To have the changes affect all SOAP objects
(globally), use:

use SOAP::Lite
  on_action => sub {sprintf '%s/%s', @_};

HTH,
-- 
Yarden Katz <katz@underlevel.net>  |  Mind the gap


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

Date: 24 Jun 2003 19:06:13 GMT
From: randy@theoryx5.uwinnipeg.ca (Randy Kobes)
Subject: Re: stopping PPM3 connecting to internet for LOCAL installs
Message-Id: <slrnbfh7bv.o6n.randy@theoryx5.uwinnipeg.ca>

On Tue, 24 Jun 2003 09:37:38 +0100, Chris Lowth <dont@want.spam> wrote:
>Randy Kobes wrote:
>
>> On Mon, 23 Jun 2003 13:28:49 +0100, Chris Lowth <dont@want.spam> wrote:
>>>I want to use "PPM" in ActiveState perl 5.8.0 on NT4 to install a module
>>>from a local file. I have downloaded the zip file and unzipped it. Then
>>>run
>>>        ppm install IO-Stringy.ppd
>>>This hangs.
>>>Running "tcpdump" on the firewall, I can see that the command is trying to
>>>connect to ppm.activestate.com (which my firewall forbids - I am trying to
>>>simulate a truely off-line install).
>> 
>> Are you running the ppm command from the same directory as
>> where the ppd file is located?
>
>Yes
>Oh - and sorry - the example module is IO-stringy not IO-Stringy.

Is the example file also called IO-stringy.ppd (case sensitive)?
And also, in the ppd file, does the HREF specification of
the CODEBASE tag correspond to where the (local) archive is
on your system? If it specifies a http:// address, then this
would explain why it's trying to connect. And finally, is
the NAME attribute of the ARCHITECTURE tag specified as
MSWin32-x86-multi-thread-5.8, appropriate for ActivePerl 8xx?

-- 
best regards,
randy


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

Date: 24 Jun 2003 11:29:56 -0700
From: mark.wirdnam@stud.unibas.ch (Mark Wirdnam)
Subject: Surprised by read()
Message-Id: <3c6df95c.0306241029.16c01a93@posting.google.com>

Hello!

I've given this problem a weekend of consideration without conclusion.
I'm trying to use the "read"-command, for step-by-step reading from a
binary file. On my computer at work (Mac OS X, perl 5.6.0), the
scripts I write work. At home on Redhat Linux 8, perl 5.8.0, the same
scripts don't work - with the same files!
The symptoms are as if one read doesn't leave the file-pointer in the
right place for the second read, bytes are getting lost.

Here's an example of one such script:

open H, shift;
read H, $grab, 12;
($riff, $size, $wave) = unpack "A4VA4", $grab;

print "see whether it's a .wav: $riff - $size - $wave\n";
print "finding the chunks...\n";
$check = read H, $grab, 8;
while ($check == 8) {
    ($cid, $csize) = unpack "A4V", $grab;
    print "finding a chunk $cid of size $csize.\n";
    read H, $grab, $csize; # brings me to the next chunk
    $check = read H, $grab, 8; }

Maybe you can see the mistake i'm making? 

Thank you, 
Mark


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

Date: 24 Jun 2003 12:37:17 -0700
From: mda@idatar.com (M. David Allen)
Subject: Win32::OLE, Excel, and coloring
Message-Id: <977c4ea8.0306241137.52a665a@posting.google.com>

Hello,

I've been using ActiveState's ActivePerl to generate Excel
spreadsheets using the Win32::OLE module.  The rudimentary examples
that are out there on the web show the way to set up specific ranges
and enter data into cells, but what I'm looking for at this point is
how to set the background color of cells.

Does anybody know how to do this with Win32::OLE?  If this module maps
to Microsoft's API, is there any complete documentation out there
about which hash keys inside of range or cell objects map to which
features in the application?

Any help would be appreciated.


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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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


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


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