On 2013-03-20 "Sébastien Deseille via RT"
Show quoted text> The problem is fixed but the test end with another error message.
> I joined a new build.log.
Thank you again. It seems that Perl on Windows really does not like
'fork' and 'kill', I'll have to figure out a better way of spawning
processes and stopping them.
Show quoted text> Would you accept to explain to me how you have solved the problem
> with the path
> "C:\temp\SsoLeTxq4S/_queue_not_subscribed/1363798854.36413-send-cjFa"
> ? I understood it is link to the mix of slash and backslash but
> nothing more.
It's a bit of a mess… Plack::Handler::Stomp::NoNetwork uses
File::ChangeNotify to look for files containing STOMP frames under a
directory. File::ChangeNotify, when it can't use more advanced
filesystem-monitoring techniques, uses File::Find in a loop to detect
added/removed files. File::Find seems to have a little problem
building filenames under Windows: it will mix the slashes.
My test is checking that the correct files were produced by my code,
by building a regular expression for the expected filename, and
comparing it with what File::ChangeNotify returned. Due to the bug
with the slashes, my regex was not matching the returned string. So I
built a more complicated regex:
my $sent_dir_re = join '[/\\\\]', map {quotemeta}
$sent_dir->volume,$sent_dir->dir_list(1);
C<$sent_dir> is a Path::Class object; C<< ->volume >> returns "C:" or
something similar on Windows, an empty string on systems that don't
have volumes; C<< ->dir_list(1) >> returns the list of directory names
(skipping the first empty string that would signify "start at the
root"). I pass them through C<quotemeta> to make sure that the regex
engine won't get confused by strange characters, then join these
strings with C< [/\\] > (there's 4 back-slashes in the source because
that thing will be interpreted twice…). So, starting from a directory
name of:
C:\temp\SsoLeTxq4S\_queue_not_subscribed
I get this regex:
C:[/\\]temp[/\\]SsoLeTxq4S[/\\]_queue_not_subscribed
which will match whatever mix of slashes I get handed.
--
Dakkar - <Mobilis in mobile>
GPG public key fingerprint = A071 E618 DD2C 5901 9574
6FE2 40EA 9883 7519 3F88
key id = 0x75193F88
I wouldn't ever write the full sentence myself, but then, I never use
goto either.
-- Larry Wall in <199709032332.QAA21669@wall.org>