It would probably be wise to watch and see what it's doing... but yes, those very (very) old CPANs will install new versions of perl, sometimes without asking. The very best way to deal with this would be to install a newer version of perl (if possible) from a solaris binary repo. -Paul
- Paul Miller
If for some reason you haven't yet watched all seven parts of this, you really owe it to yourself to take the 40 minutes to do so immediately. Drop everything and watch these. I'm completely serious.
- Paul Miller
You second regex doesn't have any ()s in it. The $1 is populated from the ()s. Rather than saying RTFM, I'll say R this part of TFM: [href://http://perldoc.perl.org/perlret... matches]. -Paul
- Paul Miller
You can use some kind of [doc://sprintf|number formating] or you can learn about regular expressions ([doc://perlretut]). Heck, I think you can even do this with $x = $old + 0. Cheers. -Paul
- Paul Miller
Traditionally, RE can't do this kind of balanced matching. Modern perl 5.10s have special support for it and even older perls have special (?{ code }) matchers than can do the counting for you. What you really want is a parser. Your best bet is probably: [mod://Text::Balanced] rather than RE. Although, to be honest, I've done it both ways and prefer using (?{ code }) to T::B as I find it difficult to operate. -Paul
- Paul Miller
See [mod://IPC::Open3]. Should solve the problem nicely — although it may require some thought. There are also really nice [mod://POE] solutions for this, particularly if you want to do something event based instead of polling the inputs/outputs. -Paul
- Paul Miller
Autoloads are less popular without a good reason these days. They certainly have a purpose, but it should be fairly rare. If you want to avoid some of the work of blessing by hand, check out [mod://Moose] — it's the new cool thing. I'm thinking I may have missed the question though, so perhaps I'm not 100% relevant. Still, if you haven't already: check out Moose. It's the new cool thing. -Paul
- Paul Miller
That's correct. There are rare cases where it doesn't work. The correct way to do this is as follows: my $res = eval { might_explode(); 1 }; die "omgish: $@\n" unless $res; # Also, why invoke print and exit when this will do? Note that die $@ if $@ almost always works. I can't recall the example case I saw, but it's reproducible stuff. It's not like it just randomly doesn't work. Well, maybe with threads. -Paul
- Paul Miller
That /g is making the whole regex try to match again. I don't think it's helping you here. Try the non-greedy anything match instead and get specific about your delimiter. You *said* what you wanted. It looks like this: my ($site, $digits) = $String =~ m{ ^(.{3}) # the site code .+? # noise, as little as possible though (\d+) # the digits (keepers) \. # the delimiter }x; -Paul
- Paul Miller
I use [mod://X11::GUITest] for this stuff. I used to like the KGS Go server, but I hated the way the client interacted with my linux desktop. WMS made several terrible design decisions that made it somewhat less portable than Java programmers pretend their programs should be... ... so I wrote a program to find KGS windows and move them back onto my desktop (from off the screen) and/or put them where I want them to go (instead of whatever random position WMS calculated). I won't cut and paste the whole thing, but here's basically how it worked: use strict; use warnings; use X11::GUITest ':ALL'; my $cur = GetInputFocus; sub onscreen { my ($x, $y) = @_; return 0 if $x > 1280 or $x < 0; return 0 if $y > 1024 or $y < 0; return 1; } for(;;) { my $root = GetRootWindow; for my $window (grep {defined $_->{n}} map {{id=>$_, n=>GetWindowName($_)}} GetChildWindows($root)) { if( $window->{n} =~ m/Room List/ ) { my ($x, $y, $w, $h) = GetWindowPos($window->{id}); # warn "\$x=$x, \$y=$y, \$w=$w,...
- Paul Miller
every random number generated was unique. This was expected. I had a stats teacher that would have everyone write down a coin flip sequence and then he'd explain how he could tell who cheated: not enough repeats. I guess I'd expect to see a few repeats in my sequence of random numbers. Probably not as many as you're seeing... I think there are other [href://http://portal.acm.org/citatio...] with the windows PRNG too. Maybe win7 fixed it. I guess I expected to find some things on CPAN for this, but I didn't -- unless you're willing to use cygwin. Then there seem to be a few choices. [mod://Crypt::Random] (will this work without the entropy daemon?) and [mod://Math::Random::MT::Auto] (should I be using this too?) seem fairly interesting. UPDATE: Ahh, interesting. I didn't understand the issue at all. -Paul
- Paul Miller
[Corion] and [ikegami] are correct. But I can never remember all the weird little things with qx and system (et al); so I just use [mod://IPC::System::Simple] and all my problems are solved for me. -Paul
- Paul Miller