Re: Perl6

2007-11-12 Thread Mathieu Longtin
From what I understand, perl6 will include coroutine, so POE should become
considerably smaller and easier to write with.


On Nov 12, 2007 11:18 AM, Ivan B. Serezhkin [EMAIL PROTECTED] wrote:

 Good day.

 There is someone here who are from people who can guide and lead the
 development process POE for perl6?
 I have a great interest in this direction, but i have no experience in it.
 I think implement all functionality of POE for perl5 with perl6
 objects,  then  use really cool things in perl6, such as continuations.

 --
 Ivan B. Serezhkin




-- 
Mathieu Longtin
1-514-803-8977


Re: PoCo::Server::SimpleHTTP

2007-08-28 Thread Mathieu Longtin
Actually, you're kind of stuck with one port, as the https standard doesn't
allow running an http server and an https server on the same port.

Technically, you could probably do it (if the first 4 characters sent by the
client are not a proper HTTP verb, then it's got to be HTTPS), but I
haven't  seen any HTTP server implement this.

On 8/27/07, Kevin Scaldeferri [EMAIL PROTECTED] wrote:


 On Aug 24, 2007, at 7:26 AM, Kidney Bingos wrote:

  On Wed, Aug 22, 2007 at 04:32:49PM -0700, Kevin Scaldeferri wrote:
  [I sent this previously to the module maintainer, but got no
  response.  Maybe someone else knows.]
 
  Yeah, sorry for not replying, I've been busy recently and let my
  email backlog
  somewhat.
 
  I had a question about SSL support in SimpleHTTP.  When it is enabled
  on my server, if someone goes to an http://; URL, they just get a
  blank page, which isn't all that nice.  Is there some way to have it
  redirect them to the https://; version?
 
  I believe what you would need to do is create two SimpleHTTP
  instances,
  the first will listen on port 80 ( without SSL enabled ) and have a
  simple
  handler for .* that then redirects to the path with https://,
  usually achieved
  with a HTTP 301 response.
 
  The second instance would be listening on 443 ( with SSL enabled ).
 
  Does that make sense ?

 Yeah, it makes sense, and for a standard configuration would
 definitely work.  However, in my case I have to have the application
 running on an odd-ball port (and only one port).  However, since the
 users of this webserver are either other machines or developers, I
 may just decide to not worry about this and insist that the clients
 just need to do things right.


 -kevin




-- 
Mathieu Longtin
1-514-803-8977


Re: POE::Component::Server::HTTP, Keep alive, and leaking sockets

2007-03-21 Thread Mathieu Longtin

My memory is fuzzy, but I think if you close the browser, especially if it's
local, the sockets closes. I remember IE keeping the connections alive for a
while.

On 3/21/07, Eric Busto [EMAIL PROTECTED] wrote:


From what I have gathered, for a web server to be HTTP 1.1 compliant, it
must support keep alive, and keep alive is enabled by default.

When using POE::Component::Server::HTTP in its simple case, as in the
cookbook entry
http://poe.perl.org/?POE_Cookbook/Web_Server_With_Components, keeping
the connections open even after the event for the URL request has been
handled causes file descriptors to leak as the socket will not get
closed.

I can force the connection to get closed after the ContentHandler
triggers by having a PreHandler like so:
POE::Component::Server::HTTP-new (
Port= 80,
PreHandler  = {
'/' = sub { $_[0]-header(Connection =
'close') }
},
ContentHandler  = {
'/' = \web_status,
}
}

My question is, is this the right thing to do?  Is there a more
elegant method, or am I missing something that should be obvious?  If
I'm not missing anything, should this be added to the cookbook page for
a basic web server with PoCo::Server::HTTP?






---
This email message is for the sole use of the intended recipient(s) and
may contain
confidential information.  Any unauthorized review, use, disclosure or
distribution
is prohibited.  If you are not the intended recipient, please contact the
sender by
reply email and destroy all copies of the original message.

---





--
Mathieu Longtin


Re: POE DBI

2007-02-21 Thread Mathieu Longtin

Do any of them work with windows?

On 2/21/07, Matt Sickler [EMAIL PROTECTED] wrote:


POE::Component::EasyDBI is what I use - quite simple and can be powerful

On 2/20/07, Kevin Scaldeferri [EMAIL PROTECTED] wrote:

 Anyone want to strongly advocate for one of the four or so components
 that comes up on a CPAN search for POE DBI?

 -kevin






--
Mathieu Longtin
1-514-803-8977


Re: POE DBI

2007-02-21 Thread Mathieu Longtin

Been using perl, poe and dbi on windows for about 4 years. Compiling apps
with ActiveState's perlapp. It works great for what I do. I've been getting
around the DBI problem by using sqlite and making sure all my queries take
less than a tenth of a second. The db is simple enough that it works for
those apps.

On 2/21/07, Matt Sickler [EMAIL PROTECTED] wrote:


yes, DBI  and PoCoEasyDBI work just fine on windows

On 2/21/07, Bill Nash [EMAIL PROTECTED] wrote:


 Well...

 A better question would be: Do Perl and DBI work with windows?

 - billn

 On Wed, 21 Feb 2007, Mathieu Longtin wrote:

  Do any of them work with windows?
 
  On 2/21/07, Matt Sickler [EMAIL PROTECTED] wrote:
  
   POE::Component::EasyDBI is what I use - quite simple and can be
 powerful
  
   On 2/20/07, Kevin Scaldeferri [EMAIL PROTECTED] wrote:
   
Anyone want to strongly advocate for one of the four or so
 components
that comes up on a CPAN search for POE DBI?
   
-kevin
   
  
 
 
 
 






--
Mathieu Longtin
1-514-803-8977


Re: memory (session) leaks in perl

2006-08-22 Thread Mathieu Longtin
Its not impossible, its just more trouble to terminate a
session. POE suffers from poor huffman encoding as it is,
adding more obligatory code to do simple things makes it
worse. Now I have to put a line to register the signal, one
to deregister it, and a stop state, just to make sure I
deregister the signal, and I have to make sure all
terminating states yield to stop instead of just not
yielding when terminating.

Except for the UI_DESTROYED, how many signals do sessions
really wait for before terminating, as opposed to using
them informationaly?

Maybe have a call to stop the current session:

   $KERNEL-stop_session()

The session stops, no question asked, lose all the aliases,
all the signals, all the postback/callback become invalid,
etc... and _stop gets called, not necessarily in that
order.

-Mathieu

--- Rocco Caputo [EMAIL PROTECTED] wrote:

 Do you have a use case where it's impossible to do
 something under  
 the new behavior?  I'm working under the assumption that
 a session  
 can always find a way to call sig(YOUR_SIGNAL_HERE =
 undef) when  
 it's ready to be destroyed.
 
 To be fair regarding discussions on this list, Jonathan
 Steinert  
 announced the intent to make sig() hold sessions alive in
 his 19  
 October 2005 message titled Nastiness, and wrapping up
 signal  
 reforms.  I replied that day with:
 
  Big change.  I don't mind this; the old semantics of
 not holding a  
  reference count were tied to _signal, which delivered
 signals  
  without sessions explicitly asking for them.  _signal
 is gone now,  
  so we can tie the explicit interest of sig() into a
 reference count  
  to keep the session alive.
 
 Nobody else responded.  17 days later I replied with a
 public go- 
 ahead to make the change.
 
 -- 
 Rocco Caputo - [EMAIL PROTECTED]
 
 
 On Aug 21, 2006, at 09:58, Nick Williams wrote:
 
  There appears to be a lack of opinion on this issue.
 Would it be  
  therefore reasonable to backout the signal change in
 POE? Or can  
  anyone suggest a way around the problem?
 
  Nick.
 
  [EMAIL PROTECTED] wrote:
 
  On Wed, 2 Aug 2006, Mathieu Longtin wrote:
 
 
  It was my understanding that a session would stay
 alive as
  long as it has child sessions. Did that behavior
 change?
 
 
  No, this is not down to a child session - AFAIK, the
 behaviour  
  there has
  not changed.
 
 
  I'm in agreement with Nick here. If a session is
 stritly
  waiting for a child session to finish, then have it
 call
  waitpid.
 
  $_[KERNEL]-wait_for_child($session, state, @args);
 
  wait_for_child would add a link back to the current
  session, the same way set_delay does.
 
 
  The issue is not wait_for_child, it's wait_for_signal
 (which doesn't
  exist). The original problem report was that people
 were confused by
  setting up a signal handler for UIDESTROY didn't make
 the session
  persistent. That is standard signal semantics and the
 persistence
  could've easily been changed by using aliases.
 
  The new behaviour in POE (as of .3202) is that when
 placing a signal
  handler on a session, e.g.
 $kernel-sig('uidestroy', 'do_something');
  that will now increment the reference count of the
 session and  
  therefore
  make that session persistent until the signal handler
 is deleted via
  something (and note, not within the _stop event, since
 we don't  
  get that
  far).
 
  Nick.
 
 
  -Mathieu
 
 
  --- Nick Williams [EMAIL PROTECTED]
 wrote:
 
 
  So, I've found the reason that recent releases of
 POE
  cause me to get
  memory leaks - I know others have had problems also,
 so I
  wanted to get
  an open discussion of what I'm being bitten by and
  possible ways to
  workaround this.
 
  It turns out for me that my sessions aren't being
 garbage
  collected. In
  general, my POE system doesn't *require* the _stop
 event
  to be processed
  and so I never noticed this. However, peeking into
 the
  system shows a
  large number of sessions and I can see that none of
 the
  _stop events
  have been called.
 
  This is because of the change:
 
   2005-11-07 06:59:07 (r1852) by hachi
   poe/lib/POE/Resource/Signals.pm M;
  poe/lib/POE/Resource/Sessions.pm M
 
 Change signal watchers so they keep sessions
  alive.
 
 WARNING: This is a major semantics change in
 POE.
  It has the
 potential to make code 'hang' in places where
 it
  formerly did not.
 
 This change is necessary so sessions
 expressing
  an interest in SIG
 CH?LD do not die prematurely. (There is a
 planned
  mandatory warning
 for reaped children that were not being
 watched.)
  This change fixes
 RT 15215.
 
 
 
  The problem with this change is that if I set up a
 signal
  handler for
  something innocuous (e.g. to handle DIE, or one of
 my
  hand-rolled
  signals), this means that the session will do
 everything
  appropriately
  except be garbage collected. I think the intention
 of
  this change is
  reasonable, but to make it the default

Re: memory (session) leaks in perl

2006-08-21 Thread Mathieu Longtin
I'm with you on the wait_for_signal. 

However, I note that there is very little traffic on this
mailing list, not even a announcement of the last two POE
release.

So, I wonder if POE discussions are all on some other
mailing list, or stritly on IRC at this point.

-Mathieu


--- Nick Williams [EMAIL PROTECTED] wrote:

 There appears to be a lack of opinion on this issue.
 Would it be 
 therefore reasonable to backout the signal change in POE?
 Or can anyone 
 suggest a way around the problem?
 
 Nick.
 
 [EMAIL PROTECTED] wrote:
 
 On Wed, 2 Aug 2006, Mathieu Longtin wrote:
 
   
 
 It was my understanding that a session would stay alive
 as
 long as it has child sessions. Did that behavior
 change?
 
 
 
 No, this is not down to a child session - AFAIK, the
 behaviour there has
 not changed.
 
   
 
 I'm in agreement with Nick here. If a session is
 stritly
 waiting for a child session to finish, then have it
 call
 waitpid.
 
 $_[KERNEL]-wait_for_child($session, state, @args);
 
 wait_for_child would add a link back to the current
 session, the same way set_delay does.
 
 
 
 The issue is not wait_for_child, it's wait_for_signal
 (which doesn't
 exist). The original problem report was that people were
 confused by
 setting up a signal handler for UIDESTROY didn't make
 the session
 persistent. That is standard signal semantics and the
 persistence
 could've easily been changed by using aliases.
 
 The new behaviour in POE (as of .3202) is that when
 placing a signal
 handler on a session, e.g.
  $kernel-sig('uidestroy', 'do_something');
 that will now increment the reference count of the
 session and therefore
 make that session persistent until the signal handler is
 deleted via
 something (and note, not within the _stop event, since
 we don't get that
 far).
 
 Nick.
 
   
 
 -Mathieu
 
 
 --- Nick Williams [EMAIL PROTECTED]
 wrote:
 
 
 
 So, I've found the reason that recent releases of POE
 cause me to get
 memory leaks - I know others have had problems also,
 so I
 wanted to get
 an open discussion of what I'm being bitten by and
 possible ways to
 workaround this.
 
 It turns out for me that my sessions aren't being
 garbage
 collected. In
 general, my POE system doesn't *require* the _stop
 event
 to be processed
 and so I never noticed this. However, peeking into the
 system shows a
 large number of sessions and I can see that none of
 the
 _stop events
 have been called.
 
 This is because of the change:
 
   2005-11-07 06:59:07 (r1852) by hachi
   poe/lib/POE/Resource/Signals.pm M;
 poe/lib/POE/Resource/Sessions.pm M
 
 Change signal watchers so they keep sessions
 alive.
 
 WARNING: This is a major semantics change in
 POE.
 It has the
 potential to make code 'hang' in places where
 it
 formerly did not.
 
 This change is necessary so sessions
 expressing
 an interest in SIG
 CH?LD do not die prematurely. (There is a
 planned
 mandatory warning
 for reaped children that were not being
 watched.)
 This change fixes
 RT 15215.
 
 
 
 The problem with this change is that if I set up a
 signal
 handler for
 something innocuous (e.g. to handle DIE, or one of my
 hand-rolled
 signals), this means that the session will do
 everything
 appropriately
 except be garbage collected. I think the intention of
 this change is
 reasonable, but to make it the default behavior for
 all
 possible signals
 is a bit keen. If I put in place a handler for a
 signal,
 it does NOT
 mean that I want to WAIT for the signal, it usually
 means
 that the
 signal shouldn't even happen, but that I'm putting in
 place a handler
 *in-case* it happens. It certainly shouldn't make my
 session persistent!
 
 I'm not sure of the best way of fixing this.
 Possibly
 enhancing the
 API to have an explicity waitforsig() and maybesig()?
 (That's half
 tongue-in-cheek, but is actually one of the better
 solutions). In terms
 of normal API, a sig handler shouldn't block, so I
 would expect the
 sig() behaviour to follow that paradigm...
 
 Thoughts, anyone?
 
 Nick
 
 
   
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam
 protection around
 http://mail.yahoo.com
 
 
 
 
 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: memory (session) leaks in perl

2006-08-02 Thread Mathieu Longtin
It was my understanding that a session would stay alive as
long as it has child sessions. Did that behavior change?

I'm in agreement with Nick here. If a session is stritly
waiting for a child session to finish, then have it call
waitpid.

$_[KERNEL]-wait_for_child($session, state, @args);

wait_for_child would add a link back to the current
session, the same way set_delay does.

-Mathieu


--- Nick Williams [EMAIL PROTECTED] wrote:

 So, I've found the reason that recent releases of POE
 cause me to get 
 memory leaks - I know others have had problems also, so I
 wanted to get 
 an open discussion of what I'm being bitten by and
 possible ways to 
 workaround this.
 
 It turns out for me that my sessions aren't being garbage
 collected. In 
 general, my POE system doesn't *require* the _stop event
 to be processed 
 and so I never noticed this. However, peeking into the
 system shows a 
 large number of sessions and I can see that none of the
 _stop events 
 have been called.
 
 This is because of the change:
 
   2005-11-07 06:59:07 (r1852) by hachi
   poe/lib/POE/Resource/Signals.pm M;
 poe/lib/POE/Resource/Sessions.pm M
 
 Change signal watchers so they keep sessions
 alive.

 WARNING: This is a major semantics change in POE.
 It has the
 potential to make code 'hang' in places where it
 formerly did not.

 This change is necessary so sessions expressing
 an interest in SIG
 CH?LD do not die prematurely. (There is a planned
 mandatory warning
 for reaped children that were not being watched.)
 This change fixes
 RT 15215.
 
 
 
 The problem with this change is that if I set up a signal
 handler for 
 something innocuous (e.g. to handle DIE, or one of my
 hand-rolled 
 signals), this means that the session will do everything
 appropriately 
 except be garbage collected. I think the intention of
 this change is 
 reasonable, but to make it the default behavior for all
 possible signals 
 is a bit keen. If I put in place a handler for a signal,
 it does NOT 
 mean that I want to WAIT for the signal, it usually means
 that the 
 signal shouldn't even happen, but that I'm putting in
 place a handler 
 *in-case* it happens. It certainly shouldn't make my
 session persistent!
 
 I'm not sure of the best way of fixing this. Possibly
 enhancing the 
 API to have an explicity waitforsig() and maybesig()?
 (That's half 
 tongue-in-cheek, but is actually one of the better
 solutions). In terms 
 of normal API, a sig handler shouldn't block, so I
 would expect the 
 sig() behaviour to follow that paradigm...
 
 Thoughts, anyone?
 
 Nick
 
 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: using poe for web application server

2006-04-29 Thread Mathieu Longtin
If your data is a C structure, and you may want to load it
in shared memory, that way every CGI can access it.

Or you can use POE to run an HTTP server, which loads the
data on startup, and calls the C subroutine to answer each
call. 

Performance wise, the problem with POE is its not
multi-threaded, so you won't take advantage of a
multi-processor/multi-core system. You can probably use
some pooling and have multiple servers running, and use the
shared memory thing so not every process has its own copy
of the 200MB data.

-Mathieu

--- Manfred Meier [EMAIL PROTECTED] wrote:

 Hello list,
 
 I'm searching for a tool to solve one of my problems.
 Perhaps somebody 
 has a hint. The situation is: (on linux)
 
 - the software is for calculating routes in public
 transport networks 
 for special purposes,
 - people put the names of origin and destination in their
 webbrowser 
 into a form and submit this form,
 - using the CGI mechanism apache calls a (existing) perl
 program, that 
 calculates the route,
 
 That all is running fine. The perl program uses C
 subroutines over a 
 swig interface. The C subroutines read the graph data
 from disk and 
 perform a path finding algorithm.
 
 The problem is that each user request results in reading
 the whole data 
 for the routing graph (can be 200 MB or more). I would
 like to make this 
 faster. So I think basically I need a daemon which once
 reads the data 
 and then listens to requests from the cgi-program.
 
 I'm trying to find out if poe or mod-perl or fastcgi are
 possible 
 solutions. Can somebody give a hint, if poe makes sense
 here.
 
 Many thanks
 Manfred Meier
 
 
 
 
 
 
 
 
 
 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: Client::HTTP content filters (was Re: Looking for complex poe examples)

2006-04-21 Thread Mathieu Longtin
Unless you are parsing a really huge piece of XML or HTML,
I don't suggest doing it in a non-blocking manner. It is a
CPU intensive process, so you won't gain anything from
having POE wait for it instead of your own function.
Beside, for anything less than 1MB, it will probably be
fast enough to be unnoticeable to the app response time.

That being said, if you are parsing multi-megabytes XML
documents, you may want to break the parsing in smaller
chunks to allow POE to deal with incoming network requests
and whatnot.


--- Martijn van Beers [EMAIL PROTECTED] wrote:

 On Thu, 2006-04-20 at 14:49 -0700, [EMAIL PROTECTED]
 wrote:
  I've seen some poe snippets and modules, but I've yet
 to find a
  complete, and relatively complex application that uses
 many components.
  Can somebody point me to a project that shows how this
 can be done. I
  suspect something like the dailystrips design
  (http://poe.perl.org/?Rocco/features_for_dailystrips)
 on the wiki page
  would be perfect. I'd also really love to see how html
 or xml message
  parsing can be done in a non-blocking way (doesn't look
 like poco http
  can use filters). Thanks in advance.
 
 Hrm, yes. That's one of the things I still needed doing
 before I stopped
 working on Client::HTTP. You might want to try
 implementing it yourself
 if you desperately need it. Shouldn't be too hard I
 think. Add a
 parameter to Client::HTTPRequestFactory-new(), and use
 that in
 poco_weeble_io_read() (in HTTP.pm) instead of the
 hardcoded
 Filter::Stream.
 
 
 Martijn
 
 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


poe::stage and keeping a stage

2006-03-23 Thread Mathieu Longtin
I've started doing this:

$self-{req}{echo_request} = POE::Request-new(
stage = POE::Stage::Echoer-new(),  # == create stage on the 
fly
method= echo,
on_echo   = got_echo,
args  = {
message = request  . $self-{req}{i},
},
);

I don't store the stage anywhere, I just keep the request, since this is what I 
actually care about.

Is there a contra-indication to this?





exceptions and POE::Stage

2006-03-13 Thread Mathieu Longtin
While the new exception as signal mechanism is nice, it
makes it hard to finalize a request, since all you know is
what state the request died in.

So, in POE::Stage, would it be possible to override the DIE
signal possibility so that the handler (if part of the same
stage) has access to the request?

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: HTTP server in POE with a twist

2005-12-06 Thread Mathieu Longtin
In the content handler, return RC_WAIT instead of RC_OK,
this will delay the sending of the response.

When the $response object is filled and ready, call:
  $response-continue();

This will tell the server to send the response.

-Mathieu

--- Pedro Melo Cunha [EMAIL PROTECTED] wrote:

 Hi,
 
 I need to write a HTTP server that interacts with XMPP,
 using POE.
 
 The problem is that after a HTTP request, I have to do
 some XMPP  
 transactions and only after that I can generate the
 response.
 
  From the PoCo::Server::HTTP docs, I don't seem to be
 able to put a  
 request on hold, do some other stuff, and then generate
 the response,  
 correct?
 
 Anybody done something like this before?
 
 Thanks,
 




__ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 



poe::stage usage

2005-12-06 Thread Mathieu Longtin
Hi,

I know Rocco has been pestering us to look at POE::Stage
for a while, so I finally did that. I am a bit confused, so
I'm going to explain how I understand it works, and you
tell me if I got it right.

$self-{req} is the request currently being handled. You
store all the intervening stages so that they dissappear if
you cancel the request mid-way. Is that right?

Is $self-{rsp} strictly there for the recall method?

Is this more or less like $kernel-call(stage1,
hello_world):

   $stage1-hello_world();

And lastly, if I do this:

   $stage1 = undef;

To which extent are all the pending requests of $stage1
cancelled? Is everything immediate? Will it close any
associate sockets right away? What happens if I still have
request object that involves $stage1? Do I need to define
DESTROY in my stages to clean up after them?

Thanks

-Mathieu



__ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 



poe::stage and die

2005-12-06 Thread Mathieu Longtin
What does POE::Stage do when a method dies?



__ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 



Re: using context data in PoCo Client DNS

2005-11-10 Thread Mathieu Longtin
Speaking of which, I have been wondering why POE is
implemented with a whole bunch of names instead of
references. Any reason for that design decision?

Example:

$kernel-post('resolver', 'resolve',
  'response',
  $host, 'A', 'IN');

Wouldn't it have been cleaner and less error prone to have
something like this:

$resolver-resolve(response_callback, $host, 'A', 'IN');

Notice that this way, the compiler can catch most
misspelling.


-Mathieu




__ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com


Re: Perl2Exe and POE on Linux

2005-09-30 Thread Mathieu Longtin
Your problem might be related to the fact that POE uses
source filtering.

Perlapp doesn't support source code filtering, but the good
POE coders wrote quite a detailed section on how to deal
with perlapp in POE::Preprocessor's POD.

-Mathieu

--- Matt S Trout [EMAIL PROTECTED] wrote:

 On Fri, Sep 30, 2005 at 03:21:51PM -0500, Scott Neibarger
 wrote:
  Greetings,
  
  I downloaded the latest version of Perl2Exe for Linux
 and installed POE into
  its Perl 5.8.7 bundle.
  I've been able to get standalone Perl scripts with POE
 to work with the Perl
  bundle.
  However, if I build the executable, it dumps a
 segmentation fault with no
  core.
 
 First, try strace :)
 
 Second, the no core thing is a Dead Rat default. You
 should be able to
 get core files dumped somehow (but I forget the
 incantation).
 
  I was wondering if POE has been validated to work on
 RedHat Linux with
  Perl2Exe?
  I've made it work with Win32, but will also need to
 make it work on HP-UX,
  AIX and Solaris.
  
  Best Regards,
  
  Scott Neibarger
 
 -- 
  Matt S Trout   Specialists in perl consulting,
 web development, and
   Technical DirectorUNIX/Linux systems architecture
 and automation. Mail
 Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk
 for more information
 
  + Help us build a better perl ORM:
 http://dbix-class.shadowcatsystems.co.uk/ +
 




__ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com


Re: PoCo::Client::HTTP Bug

2005-05-04 Thread Mathieu Longtin
All I know is I had this issue with Poco::Server::HTTP. So
when I see automated content measurement, I'd rather have
them fixed in the library.

--- Arthur Bergman [EMAIL PROTECTED] wrote:
 
 
 On 4 May 2005, at 22:04, Matt Cashner wrote:
 
  On Wed, 2005-05-04 at 13:40 -0700, Mathieu Longtin
 wrote:
  Actually, you should do a use bytes before you
 calculate
  the length. Otherwise, unicode strings will get the
 number
  of characters, not bytes, and send the wrong length.
 
  poe itself does a use bytes on startup so doing that
 again here is not
  necessary.
 
  --
  sungo
 
 
 
 surely it is lexically scoped, is it not?
 
 -
 CTO @ Fotango Ltd
 +447834716919
 http://www.fotango.com/
 
 



Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html



Re: POE::Component::Client::DNS woes

2005-04-28 Thread Mathieu Longtin
Hum, if the first DNS servers works, why should it try the
other ones?

--- Lari Huttunen [EMAIL PROTECTED] wrote:
 Dear all,
 
 I have been trying to wrap my brain around the POE
 framework for a
 couple of days reading through the docs and trying out
 different
 things. I managed to modify the reference implementation
 of concurrent
 DNS resolver
 URL:http://poe.perl.org/?POE_Cookbook/DNS_Lookups to a
 PERL package, which expects an array ref of IP addresses
 as input and
 returns a hash ref of ip to name mappings as output. This
 now seems to
 work fine, except for the fact that the resolvers utilize
 only the
 first nameserver on the list passed to
 Net::DNS::Resolver, i.e.
 
 POE::Component::Client::DNS-spawn(
 Alias  = 'resolver',
 Timeout= 30,
 Nameservers = [qw(10.0.0.1 10.0.0.2 10.0.0.3)],
 );
 
 will only query the first server on the list (the test
 material
 consisted of about hundred IP adresses).
 
 10.0.0.10.1443  10.0.0.1.53: PTR?
 nn.nn.nn.nn.in-addr.arpa. (44)
 10.0.0.10.1444  10.0.0.1.53: PTR?
 nn.nn.nn.nn.in-addr.arpa. (43)
 ..
 
 In other words the resolution seems to working in
 parallel, but only
 the first name server is queried.  I have set the number
 of parallel
 workers to 9 through:
 
 sub INITIAL_COUNT () { 9 }
 
 This doesn't seem a bug in POE unless passing the
 Nameservers parameter
 in POE::Component::Client::DNS is somehow botched, which
 does not seem 
 to be the case. Reading the source code for
 Net::DNS::Resolver did not
 yield any obvious answers either. 
 
 Any suggestions?
 
 Anyway, thanks for the developers and contributors for a
 great 
 parallel programming framework! :) The learning curve is
 steep 
 but at least I have been able to take the first wobbly
 steps through
 perusing the rather extensive but distributed
 documentation. ;)
 
 -- 
 Sincerely,
 
 Lari Huttunen
 
 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


RE: HTTPD meta refresh

2005-04-22 Thread Mathieu Longtin
If you're using POE::Component::Server::HTTP, you have to
set the 302 code in the response object, and then return
RC_OK from your handler. The component uses the return
values RC_OK, RC_DENY (not handled), RC_CONTINUE (show this
request to the next matching handler).

What the browser gets is the code you set in the $response
object.


--- Bob Faist [EMAIL PROTECTED] wrote:
 Not really a question but just sharing some info
 
 I used the suggestion by David to set the Location in
 the header and
 the 302 status code.  It turns out the problem was the
 HTTP status code
 I was returning from the content handler function was
 hard coded to be
 RC_OK.  If I set the status code to be 302 in the
 HTTP::Response object
 and then also returned 302 in the content handler
 function, the
 redirect in IE6 works just fine. 
 
 Thanks,
 Bob
 
 
 -Original Message-
 

**
 Confidentiality Notice
 The information contained in this e-mail is confidential
 and intended for
 use only by the person(s) or organization listed in the
 address. If you have
 received this communication in error, please contact the
 sender at O'Neil 
 Associates, Inc., immediately. Any copying,
 dissemination, or distribution
 of this communication, other than by the intended
 recipient, is strictly
 prohibited.

**
 
 From: David Davis [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, April 14, 2005 1:26 PM
 To: Bob Faist
 Cc: poe@perl.org
 Subject: Re: HTTPD meta refresh
 
 This isn't really a POE question, but I'll answer it.
 

http://www.w3.org/TR/REC-html40/struct/global.html#edef-META
 -
 Some user agents support the use of meta to refresh the
 current page
 after a specified number of seconds, with the option of
 replacing it by
 a different URI.
 Authors should not use this technique to forward users to
 different
 pages, as this makes the page inaccessible to some users.
 Instead,
 automatic page forwarding should be done using
 server-side redirects.
 - 
 
 Use a Location: header and a 302 status to redirect the
 browser.
 --
 David Davis
 Perl Developer
 http://teknikill.net/
 
 $7.95 per month hosting
 WITH ssh access
 http://hosting.teknikill.net/
 
 
 On 4/14/05, Bob Faist [EMAIL PROTECTED] wrote:
  POE 0.3009 and POE::Component::Server::HTTP question
  
  Windows XP
  CGI::Application
  
  The content handler provides a login page URL which is
 rendered 
  correctly.  Once the form is submitted, the user is
 validated and the 
  following HTML is returned to POE.
  
  HTML
HEAD
 titleAuthorizing.../title
META http-equiv=refresh
 

content=0;URL=http://bfaist-ws:32080/cgi-bin/emsng_ietm_poe/IETM_Menu
  .p
  l
/HEAD
  /html
  
  This meta refresh works OK in Firefox but does not work
 OK in IE6.  
  Any reasons why this would not work for IE?  If I run
 the CGI::App 
  alone with Apache, it handles the meta refresh OK in
 Firefox and IE6.
  
  There header attributes are being set in the response
 object.
  
  [Thu Apr 14 12:30:53 2005] server.pl: Setting Date
 equals Thu, 14 Apr
  2005 16:30:53 GMT
  [Thu Apr 14 12:30:53 2005] server.pl: Setting
 Set-Cookie equals 
 

emsng_ietm_poe_session_key=acb3e60100360eb087b5f1219865c730;
 path=/ 
  [Thu Apr 14 12:30:53 2005] server.pl: Setting
 Content-Type equals 
  text/html; charset=ISO-8859-1
  
 

**
  Confidentiality Notice
  The information contained in this e-mail is
 confidential and intended 
  for use only by the person(s) or organization listed in
 the address. 
  If you have received this communication in error,
 please contact the 
  sender at O'Neil  Associates, Inc., immediately. Any
 copying, 
  dissemination, or distribution of this communication,
 other than by 
  the intended recipient, is strictly prohibited.
 

**
  
 
 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


MessageBus

2005-04-20 Thread Mathieu Longtin
I like the idea, but I'd like to understand a bit more
what/how it does its thing.

Looking at your example, its unclear to me how consumers
and producers are distinguished by the bus. If I call

  $kernel-post($bus1, some_message, some, args);

Does the bus do something like this?

  $kernel-post($consumer2, some_message, some,
args);
  $kernel-post($consumer2, some_message, some,
args);

Also, why do producer need to attach themselves? If the bus
is a session with an alias, anyone can post a message to
it, no?

-Mathieu

 my $bus1 = MessageBus-new;
 my $bus2 = MessageBus-new;
 
 my $producer = Session-new;
 $producer-attach( $bus1 );
 $producer-attach( $bus2 );
 
 my $consumer1 = Session-new;
 my $consumer2 = Session-new;
 my $consumer3 = Session-new;
 
 $consumer1-attach( $bus1 );
 $consumer2-attach( $bus1 );
 $consumer3-attach( $bus2 );
 
 Events can now flow on each bus. Only sessions that
 attach to a 
 specific bus can send or receive messages on this bus.
 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: Can't post an event to sender session

2005-04-07 Thread Mathieu Longtin
Sounds like session #1 is garbage collected. But I'm not
sure why, since you keep a reference to it in component #3.


--- Pronichev Alexander [EMAIL PROTECTED] wrote:
 Greetings, 
 Note first that I am relatively new to POE and english
 isn't my native language.
 The problem is that I've 2 sessions (wrapped by my
 components), 1st session call an event of 2nd session and
 2nd session create new component, do it's job and then
 have to call an event of 1nd session. I do it like this:
 $kernel-post( $_[HEAP]-{sender}, ... ); I save a
 $_[HEAP]-{sender} in 2nd session by $_[SENDER]. Now the
 problem: if the 1st session didn't call
 $kernel-set_alias(...), in it's _start event, then the
 previous post, doesn't work, otherwise it works fine.
 What have I done wrong?
 
 -- 
 WBR dyker
 Agava Software
 



__ 
Yahoo! Messenger 
Show us what our next emoticon should look like. Join the fun. 
http://www.advision.webevents.yahoo.com/emoticontest


Re: anyone using any of the HTTP server components in a heavy use environment?

2005-03-24 Thread Mathieu Longtin
We're using PoCo::Server::HTTP, and most our request, even
if they require making multiple access to multiple sqlite
DBs, are answered within .2 seconds. I don't have any hard
numbers about concurrency, but it seems to be holding well.

--- John Napiorkowski [EMAIL PROTECTED] wrote:
 Sorry if this question has been addressed someplace.
 
 I'm wondering if anyone has used any of the HTTP
 servers that come with POE in a semiproduction/medium
 to heavy use environment?  What I mean by this is
 something that might server 40-60 connections per
 minute, including some database driven pages, etc.
 
 I know that my results might vary, and of course I
 will have to do a lot of testing, but I just want to
 find out if I am crazy to even be thinking of this.
 
 Thanks!
 John Napiorkowski
 
 
   
 __ 
 Do you Yahoo!? 
 Yahoo! Small Business - Try our new resources site!
 http://smallbusiness.yahoo.com/resources/ 
 



__ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 


Re: catching exceptions in sessions

2005-02-02 Thread Mathieu Longtin
Wait, the DIE signal is not sent directly to the session
that caused it?


--- Leif Gustafson [EMAIL PROTECTED] wrote:

 Sungo wrote:
 
  hell, i'm still waiting for the COMMENTS, let alone a
 pattern to emerge
  from them. the module seemed to kill the conversation
 and i've never
  figured out whether that meant that i hit a home run or
 totally scared
  everyone off :)
 
 I have some observations about the module.  Please
 correct me if I'm 
 wrong or if I've misunderstood anything about the design
 of the module.
 I like the idea of POE::Exceptions, but I feel it doesn't
 accurately 
 represent the way exceptions should be used.  I think one
 of the biggest 
 problems is the fact that it uses a POE DIE signal to
 indicate an 
 exception has occured.  I feel like this encourages
 programs to be 
 written that have a single exception session that
 handles exceptions 
 for the entire program.  This is probably okay for small
 programs. 
 However, I'm not sure how easy it would be once you start
 adding 
 components in the mix that throw and/or catch exceptions.
  It seems to 
 me in this case there would be a good chance that the
 wrong session 
 might catch another sessions exception.  In general, it
 would seem to 
 negate the modularity of components.
 I think what we need is a way to KNOW where the exception
 is going to 
 go.  With non-POE exceptions, when you throw an
 exception, you know 
 where the code is going to go (outside the eval in perl
 or in the catch 
 block in some other language).  With the current module,
 one doesn't 
 neccessarily know who's going to catch the exception. 
 Maybe we need the 
 kernel sending a predefined event to the parent of the
 session that 
 throws the exception (to represent a catch block in the
 calling 
 code)...I don't know.
 Of course, another problem is that we can't rethrow
 exceptions.  I think 
 this is an important concept in non-POE code.
 
 -- 
 LG
 




__ 
Do you Yahoo!? 
Take Yahoo! Mail with you! Get it on your mobile phone. 
http://mobile.yahoo.com/maildemo 


catching exceptions in sessions

2005-02-01 Thread Mathieu Longtin
Hi,

is there a way in a POE::Session to put an eval { } around
all the states, and if an exception occurs, forward it to
another state?

Thanks

-Mathieu



__ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250


Re: catching exceptions in sessions

2005-02-01 Thread Mathieu Longtin
Well, POE::Exception fits exactly what I wanted to do.

I just wish it was integrated in POE instead of being a
separate module. 


-Mathieu


--- Rocco Caputo [EMAIL PROTECTED] wrote:

 On Tue, Feb 01, 2005 at 03:00:34PM -0600, Tim Klein
 wrote:
  Does POE::Exceptions work with POE::NFA, or only with
 POE::Session?
 
 It is a subclass of POE::Session.  There is no exceptions
 class built
 atop POE::NFA.
 
 POE::Exceptions was originally written as an experimental
 prototype so
 people could evaluate it, comment upon it, and come up
 with a generic
 mechanism for POE exceptions.  We're still waiting for
 that general
 pattern to emerge. :)
 
 -- 
 Rocco Caputo - http://poe.perl.org/
 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: PoCo HTTP Client not releasing sockets

2004-12-13 Thread Mathieu Longtin
Done. I submitted it, its bug #8846.

The test only works on Linux, but I've seen the problem
occur on windows as well. Anybody knows how to tell how
many file descriptors a process has using perl calls?

-Mathieu

 If you turn it into a Test::More style test, 
 I'll add it to Client::HTTP's tests.  That'll 
 fairly ensure that the problem gets fixed 
 before the next release.

 -- 
 Rocco Caputo - http://poe.perl.org/





__ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250


fix to PoCo::Server::HTTP

2004-10-06 Thread Mathieu Longtin
I made a few fixes to PoCo::Server::HTTP. Bug 1609 and
7364. Also, a way to add an alias to the session, and set
the IP address served.

I tried emailing the owner of the package (Richard Clamp),
but got no response.

How should I go about propagating those fixes to CPAN?

-Mathieu





___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com


which http server to use

2004-09-13 Thread Mathieu Longtin
Hi,

I'm trying to move a bunch of CGI scripts to a POE server,
mostly for performance.

Looking at CPAN, I see three different POE component HTTP
server:

POE::Component::Server::HTTP
POE::Component::Server::SimpleHTTP
POE::Component::Server::HTTPServer

All of which have been patched in the last six months.

So, I guess my questions are:
- What are the differences, beside the names?
- Which should I use?

Thanks

-Mathieu




___
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now. 
http://messenger.yahoo.com


running CGI scripts from POE

2003-09-23 Thread Mathieu Longtin
Has anyone written a POE HTTP server that allows for CGI
scripts to be ran as external process?

Thanks

-Mathieu

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com