Hej!
I have made some tries to use Padre and I really like it!!
At the end of the mail there are some proposals, but first ….
Background:
Here are my experiences from these tries using Padre. I am quit new to
installing from CPAN using the cpan-utility, but I have used Perl for more than
20 years.
I am using:
- Strawberry-perl-5.12.2.0
- Perl 5, version 12, subversion 2 (v5.12.2) built for MSWin32-x86-multi-thread
- Windows 7 Home Premium with Service Pack 1
I wanted to do a small local HTTP server. Got the idea to use Padre to find the
problems I had. Tried different thing but I was all the time stuck in the
install from CPAN. After some restarts and using force to inhibit the tests I
succeeded to install Padre and Dancer. But I still had problems.
To used something very simple to start with i tried the code proposed in
"Testing a (Perl) Web application without a lot of setup"
http://szabgab.com/blog/2009/03/1238019597.html. Without adding the line marked
below, it did not work. Had good support from Padre. However Padre often
blocked when the debugged code was blocking.
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin";
use MyServer;
my $server = MyServer->new;
$server->host('localhost'); # added ================
$server->run;
Se also https://rt.cpan.org/Public/Dist/Display.html?Name=HTTP-Server-Simple
During all my tries the test of Test::TCP seemed to be a problem, so I started
trying to find the cause of blocking of the tests. Sometimes I was using Padre,
but in many cases it also blocked. Sometimes Padre even was impossible to kill,
so I had to restart Windows.
After a lot of tries I wrote:
https://rt.cpan.org/Public/Bug/Display.html?id=66437. In
https://rt.cpan.org/Public/Bug/Display.html?id=66016 Jan Dubois has found
problems in the perl implementation of fork in Windows.
Proposal:
To make it easier to install Padre in Windows using cpan the problems with the
blocking tests of Test::TCP need to be fixed in some way. A short term
workaround is needed. Probably it will take some time to fix the fork
implementation in perl.
Proposed test case 1 for Padre:
This “perl -e "if ($pid=fork){kill(9, $pid);} else {sleep 1000}"” is always
blocking from the command line, but works in Padre. “if ($pid=fork){kill(9,
$pid);} else {sleep 1000}” could be a test case for the debugger in Padre.
Proposed test case 2 for Padre:
Adding a Win32::Sleep(0); to “test case 1” gives problem in Padre.
Running this:
my $pid;
if ($pid=fork){
Win32::Sleep(0);
kill(9, $pid);
exit 1;
}
else
{
sleep 1000;
exit 2;
};
exit 3;
in Padre using the debugger gives at least for me unexpected result. I
understand that it is difficult (impossible?) to handle a fork in a debugger,
so it is perhaps not part of the specification!
(Running this: perl -e "if ($pid=fork){Win32::Sleep(0); kill(9, $pid);} else
{sleep 1000}" from the command line works most of the times.)
Proposed test case 3 for Padre:
When starting the debugger with code below I get the error message: Debugging
failed. Did
you check your program for syntax errors?
Adding the my $dummy; “fixes” the problem.
use strict;
use warnings;
=================> my $dummy; <===========
use IO::Socket;
my $sock = new IO::Socket::INET (
LocalHost => 'localhost',
LocalPort => '7070',
Proto => 'tcp',
Listen => 1,
Reuse => 1,
);
die "Could not create socket: $!\n" unless $sock;
for (0..2){
my $new_sock = $sock->accept();
while(<$new_sock>) {
print $_;
}
};
close($sock);
Best regards
Bo Johansson
_______________________________________________
Padre-dev mailing list
Padre-dev@perlide.org
http://mail.perlide.org/mailman/listinfo/padre-dev