Stories
Slash Boxes
Comments
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 ]

mauzo (8185)

mauzo
  (email not shown publicly)
+ -

  Comment: Re:making hard things easier (Score 1) on 2010.02.09 8:45

Maybe, on a spare week-end, I'll try to come up with a mechanism that allows people to drop tarballs in some directory to have them build alongside the core.

I thought that, at least in theory, you could just untar a distribution in ext/ and tell Configure to build it? I've no idea if this still works with the ext/ dist/ cpan/ rearrangement, though.

Read More 62 comments
Comments: 62
+ -

  Comment: sitecustomize.pl (Score 1) on 2010.01.23 13:19

So build Strawberry with -Dusesitecustomize, and put it in there. That's exactly what it's there for, and anyone who knows enough to know they don't want it can turn it off with the -f switch.
Read More 13 comments
Comments: 13
+ -

  Comment: /etc/xdg isn't always right (Score 1) on 2010.01.09 18:08

The current version uses the existence of /etc/xdg to determine that we are on a Freedesktop.org system; under FreeBSD (and possibly other systems) this is incorrect. The system XDG config dir is located at /usr/local/etc/xdg, since /etc is reserved for the base system.
Read More 2 comments
Comments: 2
+ -

  Comment: Re:done_testing( $arg )? (Score 1) on 2009.11.19 9:07

by mauzo on 2009.11.19 9:07 (#71183)
Attached to: The unfortunate demise of the plan

Yes, this seems the way to go to me, especially since I have been writing my tests like

    use Test::More;

    my $tests;

    BEGIN { $tests += 2 }
    for (list()) {
        ok $_, "List member ok";
    }

    BEGIN { plan tests => $tests }

for quite a while now. AFAIC done_testing($tests) simply removes the need for the ugly BEGIN blocks.

The other thing I quite like about done_testing is that is removes the need for SKIP: blocks. Rewriting this (which is generally how I would write a complicated skip block)

    SKIP: {
        my $skip;
        $reason and skip "reason", $skip;

        BEGIN { $skip += 3 }
        ok...;
        ok...;
        ok...;

        BEGIN { $tests += $skip }
    }

as simply

    {
        $reason and last;

        $tests += 3;
        ok...;
        ok...;
        ok...;
    }

seems like an improvement to me. If I think the reason is particularly important I can put in a skip "reason", 1 just to get it recorded in the TAP somewhere.

Read More 25 comments
Comments: 25
+ -

  Comment: Re:uniq (Score 1) on 2009.10.08 19:33

by mauzo on 2009.10.08 19:33 (#70822)
Attached to: Finding Duplicate Files
OK, so had I thought a bit more I might have written

echo .../*.t .../*.t | sort | uniq -d

The other point, that filenames can contain special characters, I was aware of, but I tend to assume that 'my' files won't (unless I know that they do). If I were working on some arbitrary set of files I would have done the job in Perl (I was going to say find -print0 and {sort,uniq} -z would work, but apparently (my) uniq doesn't have a -z option. Weird.). Thanks for the correction, though, since it's important to be aware of in general.

A more important bug I was also ignoring is that the length of the list of files may exceed ARG_MAX. Since this is one of Ovid's test directories, I presume that's not actually that unlikely :).

Read More 8 comments
Comments: 8
+ -

  Comment: uniq (Score 1) on 2009.10.06 10:19

by mauzo on 2009.10.06 10:19 (#70799)
Attached to: Finding Duplicate Files

(ls aggtests/pips/api/v1/xml/*.t; ls aggtests/pips/api/builder/*.t) | sort | uniq -d

Read More 8 comments
Comments: 8
+ -

  Comment: Broken link (Score 1) on 2009.08.13 16:10

I believe your 'author best practices' link is supposed to go to Test::XT rather than Test::XS.
Read More 15 comments
Comments: 15
+ -

  Comment: As far as I'm concerned... (Score 1) on 2009.08.12 21:12

the most important advantages of git over other systems I've used (CVS, svn, svk) are
  • it's fast: I can download the complete history of perl in a few minutes and checkout any commit in seconds;
  • it doesn't (ever, in my experience) lose its mind, which all of the others have done for me on several occasions.

I (now) like and use some of the other features, like cheap branches, easy rebasing and convenient publishing on github, but if I were looking for a reason to persuade someone to switch those would be my choice.

Read More 24 comments
Comments: 24
+ -

  Comment: Reading the source suggests... (Score 1) on 2009.08.11 13:01

by mauzo on 2009.08.11 13:01 (#69976)
Attached to: Dear helpful git-using lazyweb
-qq, though I'm not sure exactly where that's supposed to be documented.
Read More 7 comments
Comments: 7
+ -

  Comment: Re:Set locale to C (Score 1) on 2009.07.11 18:50

by mauzo on 2009.07.11 18:50 (#69423)
Attached to: Help needed from Germans and Solaris users
It is a real error, though, not a bug in the tests. If someone uses IPC::Run in a non-C locale it will fail to work correctly: if anything, tests should be added to catch the bug.

Setting the locale to C somewhere appropriate in IPC::Run itself might be a workaround, but I've no idea how the stringification of $! reacts to changing the locale. I would expect it to be quite system-specific: here (FreeBSD) I can't get perl to give me localized error messages at all (I think the translations may simply not exist, though).

This is why it should be checking the numeric value :).

Read More 12 comments
Comments: 12
+ -

  Comment: Re:German error messages (Score 1) on 2009.07.11 18:42

by mauzo on 2009.07.11 18:42 (#69422)
Attached to: Help needed from Germans and Solaris users
Unfortunately you can't rely on $! still having the right value by the time the exception is caught. Really all those croaks in _read &c. should be throwing proper exception objects which catch the (numeric) value of $!. I would want to switch the whole thing to use autodie, but that's quite a major change.
Read More 12 comments
Comments: 12
+ -

  Comment: German error messages (Score 1) on 2009.07.11 13:45

by mauzo on 2009.07.11 13:45 (#69418)
Attached to: Help needed from Germans and Solaris users
Isn't the issue simply this line

(($c < 200) and ($@||'')=~ m/^Resource temporarily/) and redo;

in IPC::Run::IO? It's string-matching against $!, which is pretty stupid. Is 'Ulazno/izlazna greáka' simply (mangled) Croatian for EAGAIN?

Read More 12 comments
Comments: 12
+ -

  Comment: OK, maybe I'm just being stupid... (Score 1) on 2009.07.09 11:26

by mauzo on 2009.07.09 11:26 (#69400)
Attached to: Promises, promises
but how is this different from

sub foo;

(or

*$fq_name = \&$fq_name;

if you want to install them dynamically)?

Read More 4 comments
Comments: 4
+ -

  Comment: Alternative futures? (Score 1) on 2009.06.05 8:55

by mauzo on 2009.06.05 8:55 (#68959)
Attached to: It's Time For Time In Computing

Still, I don't think that quite solves the problem if you assert a fact and your query fails, you probably want to retract that fact.

This feels to me like you want an 'alternative futures' model of time: that is, when you backtrack, you not only go back to a previous 'time' but also arrange things so that when you go 'forward' again you are moving forward on a different timeline that diverges from the first at the point the backtrack went back to. If you change something and don't backtrack, subsequent computations stay on the same timeline so they keep any changes that were made.

Of course, this means that you end up storing every state that has been present in every hypothetical timeline your program has visited, which may be a problem. If there's no way to retrieve values from 'other' timelines, you could garbage-collect them at the point they become inaccessible.

Read More 5 comments
Comments: 5
+ -

  Comment: I think there's a step missing here. (Score 1) on 2009.03.05 7:38

by mauzo on 2009.03.05 7:38 (#67700)
Attached to: Should We Do "Computer Science"?
I don't think the analogy with pure and applied physicists is correct. Working programmers aren't applied physicists: they're builders, or at most architects. Programming isn't a science, it's a trade, and I think what's missing here is some sort of degree (or other more vocational qualification depending on the educational system involved: I'm thinking of the sort of course that would once have been taught at English polytechnics) in Programming or Software Engineering, rather than Computer Science. Ideally the top level of this would lead to some sort of professional certification equivalent to the other branches of engineering (no doubt with the attendant requirement for vast amounts of tedious paperwork, but hey, that is actually the only way to make things work reliably in the end).

The McProgrammers you mention are the equivalent of ordinary builders who know how to build a wall, or maybe a whole house, but don't have the higher-level knowledge of physics and (more importantly) engineering to design a large and complicated structure. There would be little point such a person trying to read a paper written by a physicist (pure or applied) and apply it to their day job: the research needs to be filtered through several layers of 'Engineer' before it can be useful to them.

I suspect the root of the problem here is simply that CS as a discipline is so very young. Most of the physics used in (say) construction is several hundred years old, so we've had time to find out which bits are useful and how they apply to practical problems. In CS we keep trying to take pure research done approximately last week and use it in working programs right now.

Read More 15 comments
Comments: 15