Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

bart (450)

+ -

  Comment: Re:Do you even need a toolkit? (Score 1) on 2010.06.23 4:51

by bart on 2010.06.23 4:51 (#72107)
Attached to: Strawberry Win32 GUI programming

I said

And I've never seen a service with a GUI, I'm not sure if it will behave nicely.

and today I found this blog post: Do you still use the MessageBox API in your Windows Service? (Or do you display any type of User Interface?)

and it says:

Starting with Windows Vista and above, user interfaces generated by Windows services can’t be seen. And even worst, your service could be stuck waiting for some user input that the user cannot give as she does not see anything!

It goes on to give a generic solution (plus a simple solution for just a messagebox), but it's anything but trivial.

But I was right to be wary.

And I'm not sure that this solution will work on a Windows earlier than Vista. At worst, you might have to hack in 2 interfaces, for multiple versions of Windows.

Read More 9 comments
Comments: 9
+ -

  Comment: Do you even need a toolkit? (Score 1) on 2010.06.15 2:41

by bart on 2010.06.15 2:41 (#72079)
Attached to: Strawberry Win32 GUI programming
As you said

periodically pop up alerts on my machine

do you even need a GUI toolkit? It seems to me like a plain MessageBox API call is all you need.

That is, unless you want the script to continue running while the message is shown. In that case, you could set up a simple window with The GUI Loft. Oldie, but probably good enough.

And I've never seen a service with a GUI, I'm not sure if it will behave nicely.

Read More 9 comments
Comments: 9
+ -

  Comment: Damn right! (Score 1) on 2010.04.08 8:05

Just like that one text editor...

I often use an idiom that I try to fetch an item, and if successful I want to do something with it; if not successful, the code returns undef (false). Typically, the code goes something like this:

if(my $item = get_item(@params)) {
    # do something with $item
    print $item->{text};

but this text editor complains about it, stating, in a dialog box:

a single = in a conditional is usually a typo, use == or eq to compare.
Do you want to continue?

every. single. time. I run that script.

Goddamnit, I know already. It's not a typo. Just get out of my way already, and let me do as I please.

That text editor is Padre.

Read More 26 comments
Comments: 26
+ -

  Journal: Headsup on command line for shortcuts in Windows XP on 2010.03.02 9:26

Journal by bart on 2010.03.02 9:26
User Journal

For Strawberry Perl, and Padre, I use a custom entry in the Start Menu, which technically is a shortcut (*.LNK file). For example, for Padre the command line in the shortcut file was:

C:\WINDOWS\system32\cmd.exe /c PATH=c:\strawberry\perl\bin;c:\strawberry\c\bin;%PATH% && padre

Likewise, the command line for my Strawberry shell was:

Read More 0 comments

+ -

  Comment: Fun! (Score 1) on 2010.02.24 5:05

by bart on 2010.02.24 5:05 (#71724)
Attached to: Unpacking data structures with signatures
Wow, this looks incredibly fun. Things like this make me actually want to play with Perl6 — which, admittedly, is something that does not happen too often.
Read More 1 comments
Comments: 1
+ -

  Comment: Why not? (Score 1) on 2010.02.16 14:25

by bart on 2010.02.16 14:25 (#71701)
Attached to: don't do this

I don't see why one shouldn't be allowed to do this, as it's not really different from plain calling

     &sick;   # or sick();

As part of the source hasn't been compiled (or parsed) yet, you can only jump — or call — backwards.

Read More 2 comments
Comments: 2
+ -

  Comment: Re:download stand-alone binary version of Padre (Score 1) on 2010.02.14 12:54

Interesting approach — if only it worked... It turns out not to be so easy.

I tried the "experimental" "Padre Stand Alone for Linux", but it immediately died, complaining about an incompatibility between Wx and ("GLIBCXX_3.4.9 not found").

Anyway... Do you see this approach as a solution for all big projects in Perl? Building all these binary distros seems like a lot of work to me. Plus, with several projects, you get a lot of separate file trees, with possibly a lot of overlap. That may be a bit of a shame, depending on how you look at it.

Read More 62 comments
Comments: 62
+ -

  Comment: Installing or upgrading Padre is a pain (Score 1) on 2010.02.09 9:00

I recently thought of installing Padre on the most recent CentOS (which, in case you didn't know, is a community supported enterprise version of Red Hat Linux). The huge number of modules that need an upgrade is discouraging: it wants to upgrade 24 modules (and install 81 more), even after I already installed Wx.

The main problem I have with that is that I don't want to change anything in the system Perl, as this is contrary to the spirit of CentOS: don't upgrade anything that is stable, as the upgrade might break stuff.

What I want is to "upgrade" these modules only for Padre, i.e. locally.

Now what dagolden already mentioned would easily solve that problem: CPAN should be set up to install locally, i.e; not modifying the system libraries, by default, or at the very least, provide a painless option to do so.Having to mess with arguments for Makefile.PL with sometimes dubious, or at the very least, unpredictable results, is not the best imaginable solution.

p.s. I recently upgraded Padre to the newest version on Windows, and again, it wanted to upgrade tens of modules. Is that really necessary? It's so bad, eh, there are so many of them that CPAN almost chokes, that I almost skipped the upgrade.

Read More 62 comments
Comments: 62
+ -

  Comment: Put it in a module! (Score 1) on 2010.01.22 16:53

But since lots of people don't use the command line (they hit Perl via a batch script or similar) now I might also need to hijack perl.exe entirely to deal with it (except that breaks things that do pass-through code to child Perl's for process isolation reasons).

Eh, no, you don't have to patch perl.exe. Instead, put it in a module. Just like diagnostics does nothing but explaining warnings and errors better.

You can load this module on the command line using -M, or you could set an environment variable like PERL5LIB, so it gets used in every Perl script that gets run from the batch file.

Read More 13 comments
Comments: 13
+ -

  Comment: Encode::Repair (Score 1) on 2010.01.07 14:31

by bart on 2010.01.07 14:31 (#71496)
Attached to: Decoding multiple encoded utf-8 in perl or ruby

Earlier today, moritz uploaded a new module, Encode::Repair, to CPAN, which has fixing this kind of trouble in mind. But 5 times? That's a bit steep...

Read More 7 comments
Comments: 7
+ -

  Comment: Can it do this? (Score 1) on 2009.12.18 5:52

by bart on 2009.12.18 5:52 (#71421)
Attached to: Upgrade you Makefile.PL with eumm-upgrade

One major problem we have had in the past is with Scalar::Util, which has 2 modes: XS mode, and PP mode. The latter did not include the functionality to create weak references, and it was the version that PPM installed. Often, that was precisely the functionality we needed the module for... Yet, the version number of Scalar::Util was the same for both... Just requiring a high enough version number for the module did not do any good.

Can your extension detect that? "We need Scalar::Util so and so and it has to include weaken"?

Read More 2 comments
Comments: 2
+ -

  Comment: Oh, BTW... (Score 1) on 2009.12.11 4:17

by bart on 2009.12.11 4:17 (#71369)
Attached to: Please stop ignoring tickets

Thanks for cross-posting between and I still have a soft spot for and I'm still not quite following closely, so it's much appreciated, even though I guess it's not making your life easier. Probably quite the contrary.

Read More 2 comments
Comments: 2
+ -

  Comment: Another idea on context, for menus and buttons (Score 1) on 2009.12.10 3:30

by bart on 2009.12.10 3:30 (#71363)
Attached to: i like context menus

Here's another thing that I don't remember actually having seen on an editor yet — or at least, on a free or cheap editor — I don't actually know if Kephra does: let the tool buttons and menu entries depend on the type of file.

It removes clutter if you don't show any menu entries that don't make sense on this type of file.

For example, if you have the Java compiler (javac) defined as a tool, it makes no sense to show it as an option for a Perl script. And vice versa: show perl only as a tool for Perl scripts and modules, but not for Java source files, or for HTML.

That implies making the context menus very dynamic, as they should be both dependent on file type, and be user configurable as well. This may be a bit of a technical challenge.

Read More 2 comments
Comments: 2
+ -

  Comment: Re:Loops (Score 1) on 2009.12.08 5:54

by bart on 2009.12.08 5:54 (#71347)
Attached to: Template::Tiny 0.01 - Request for features

And filters. I may not imagine the bad things that would happen if and/or item.value contain text with substrings that are meaningful as HTML markup.

Besides, for a template system I want to be able to insert text between every listed item, but not after the final item; just like join does in Perl, but then with a loop-ish instead of a functional syntax. (Just being able to test for the last iteration in the loop, would do the trick.)

I don't remember the syntax TT2 uses for such a feature, but I'm pretty sure it can do it.

Read More 10 comments
Comments: 10
+ -

  Comment: Incomplete examples (Score 1) on 2009.11.14 13:54

by bart on 2009.11.14 13:54 (#71134)
Attached to: Vim: Does Your Pod Have Valid Perl?

This is not working with incomplete sample code, is it? Code that does not include the necessary (but trivial) use Foo::Bar lines, or object instantiation (Foo::Bar->new)?

Just because code is incomplete, doesn't mean that it's wrong.

And adding redundant code is not making examples clearer.

Read More 2 comments
Comments: 2