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 ]

+ -

  Comment: Automated translation removes barriers (Score 1) on 2009.10.15 14:42

by cowens on 2009.10.15 14:42 (#70901)
Attached to: now back to work (again?)

The non-English posts look like English posts to me. I use Google Reader and have it setup to use Google Translate on any post that is not already in English. This has led to some interesting surprises for me after reading a post, going to comment on them, and finding the article (and worse the user interface) in a different language.

Read More 3 comments
Comments: 3
+ -

  Comment: Possible fixes for your issues (Score 1) on 2009.10.05 8:35

by cowens on 2009.10.05 8:35 (#70787)
Attached to: Enable/Disable touch pad

I don't know about MacBooks, but my MacBook Pro's iSight works just fine if I load the right driver. See this thread on how to get it to work with Ubuntu: http://ubuntuforums.org/showthread.php?t=225621.

Seeing one CPU is most likely a result of using the wrong kernel. Look for an SMP version of the kernel to take advantage of the second core (the default Ubuntu Kernel works just fine for me).

You may want to look into the options on syndaemon, it can disable the touchpad while you are typing: https://help.ubuntu.com/community/SynapticsTouchpad#Disabling%20the%20Touchpad%2 0Temporarily%20While%20Typing

Read More 6 comments
Comments: 6
+ -

  Comment: Oh, wait it was a rhetorical question wasn't it? (Score 1) on 2009.09.29 10:26

by cowens on 2009.09.29 10:26 (#70689)
Attached to: Writing a Changes File

Because change logs don't scratch an itch for the developer.

Read More 8 comments
Comments: 8
+ -

  Comment: Just a few notes (Score 1) on 2009.08.27 18:18

by cowens on 2009.08.27 18:18 (#70290)
Attached to: local::lib installation walkthrough

* The -z option on tar is not standard. The more appropriate -- for cross-platform purposes -- command is

gzip -dc local-lib-1.004004.tar.gz | tar -xf -

* You should mention that you should only run make install if none of the steps fails. Perhaps phrasing the code as

perl Makefile.PL --bootstrap && make && make test && make install

* .bashrc is only one of the possible places for that code to go (for instance, it is .profile under ksh) and you need different code if you are using csh.

* you have completely ignored Win32

Read More 6 comments
Comments: 6
+ -

  Comment: Just more anecdotal evidence (Score 1) on 2009.08.12 9:38

Before GitHub I mostly lurked. I would grab code out of cvs, svn, etc., compile it, fix anything that went wrong for me, and rarely send a patch back. Doing a proper diff, tracking down the right email address to send it to, writing the email, etc. was too much work and I always assumed that if I had the problem then someone else would also have the problem and would jump through the hoops. Now that I have GitHub I fork projects I am compiling and if I have to make a change it is as easy as git add file, git commit -m "foo", git push, and then hitting GitHub and sending out a pull request.

The great benefit of Git is that I don't have to ask for a commit bit, and my changes are local to me only and the maintainer can decide if my fix is good enough or necessary.

Read More 24 comments
Comments: 24
+ -

  Comment: congrats (Score 1) on 2009.08.09 4:44

by cowens on 2009.08.09 4:44 (#69927)
Attached to: YAPC:EU::2009 Was Truly Magical

Sounds like the best of the possible outcomes.

Read More 10 comments
Comments: 10
+ -

  Comment: Re:Top five things I think are missing from Rakudo (Score 1) on 2009.08.09 2:01

That makes me happy. It would be nice if there were an article about what is planned to be (or not be, if that is shorter) in Rakudo Star. Of course, it is entirely possible there is already a road map on a public site that I have not seen yet, and there is still a lot of time until Spring.

I am not worried about the spec (and therefore the implementations) changing or growing; I am worried about how much of what is currently spec'ed will be implemented by the deadline. A Perl 6 implementation that can't do what the spec says is Perl 6 doesn't seem to be a real release to me. I see it as being promised Perl 5, but having to settle for Perl 4.

Beyond my worries about how much of the current spec will be implemented in Rakudo Star, the only thing that worries me about Rakudo Star is its name. If I understand what I have read about Perl 6, * is whatever, which means it will be the "Rakudo, whatever", release. Not a very inspiring name.

Read More 18 comments
Comments: 18
+ -

  Comment: Top five things I think are missing from Rakudo (Score 1) on 2009.08.09 0:47

The top five things holding me back from using Rakudo for anything but experimental playing with Perl 6 are (in order of imporatance):

1. lack of lazy evaluation
2. s/// is not implemented
3. it cannot be installed ("removing or moving the build tree will cause the binary to stop working")
4. I cannot easily tell what parts of the spec are implemented and which are not
5. The REPL has executes every line in its own scope making lexical variables (and therefore the REPL itself) next to useless.

I may be wrong about some or all of these because I only stop to look at Perl 6 about once a month or so. The next to last one is probably my fault for not looking in the right place.

Read More 18 comments
Comments: 18
+ -

  Comment: MooseX::Declare has a similar problem with pod (Score 1) on 2009.07.22 20:30

by cowens on 2009.07.22 20:30 (#69573)
Attached to: Three things in Perl 6 that aren't so great

MooseX::Declare adds a block style class to Perl 5 and I have been running into the same POD problem.

Read More 16 comments
Comments: 16
+ -

  Comment: Graphemes rather than characters (Score 1) on 2009.07.06 10:21

by cowens on 2009.07.06 10:21 (#69315)
Attached to: Str and Buf -- I think I get it now

Just a quibble, but I believe it is more correct to say a string in Perl 6 is made up of graphemes rather than characters. The two Perl 5 strings "\x{F6}" (LATIN SMALL LETTER O WITH DIAERESIS) (and "\x{6F}\x{308}" (LATIN SMALL LETTER O and COMBINING DIAERESIS) should be the same string in Perl 6 (unless the codes pragma is turned on).

Read More 14 comments
Comments: 14
+ -

  Comment: Re:you could also inline it (Score 1) on 2009.05.26 13:52

by cowens on 2009.05.26 13:52 (#68795)
Attached to: Debugging In List Context

or the slightly less stupid (I don't know why I threw it in an arrayref to start with):

#!/usr/bin/perl

use strict;
use warnings;

my @a = (
                1,
                (map {()} warn "in here\n"),
                2,
                3
);

print map { "$_\n" } @a;

Read More 8 comments
Comments: 8
+ -

  Comment: you could also inline it (Score 1) on 2009.05.26 13:47

by cowens on 2009.05.26 13:47 (#68794)
Attached to: Debugging In List Context

#!/usr/bin/perl

use strict;
use warnings;

my @a = (
                1,
                @{[map {()} warn "in here\n"]},
                2,
                3
);

print map { "$_\n" } @a;

Read More 8 comments
Comments: 8
+ -

  Comment: Re:use peek_our as well (Score 1) on 2009.04.14 13:51

I take it back, since he is using the address of the variable as the key it works fine, and there is the order doesn't matter when you build the hash.

Read More 8 comments
Comments: 8
+ -

  Comment: Re:use peek_our as well (Score 1) on 2009.04.14 13:40

Alright, it is ugly, but it gets the job done. This handles everything but var pragma variables that have never been assigned to (they don't really exist yet). This version also has the benefit of displaying package and lexical variables differently, so you can easily spot the masking effect. Hmm, but I think there might be a bug in the case where you have

{
        our $foo;
        {
                my $foo;
                {
                        our $foo;
                        print dumper(\$foo);
                }
        }
}

But I am not sure anything can be done about that.

#!/usr/bin/perl

use strict;
use warnings;

use PadWalker qw/peek_our peek_my/;
use Scalar::Util 'refaddr';
use Data::Dumper;

use vars qw/$baz $quux/;

$other::package::fork = 0;
our $foo = 1;
our $bar = 2;
$baz = 3;

print "now all are package\n", dumper(
        \$foo,
        \$bar,
        \$baz,
        \$quux,
        \$",
);

{
        my $foo = 4;
        print "\nnow \$foo is masked by a lexical\n", dumper(
                \$foo,
                \$bar,
                \$baz,
                \$quux,
                \$",
        );
}

sub find_package_vars {
        my ($package, $pad_vars) = @_;
        no strict 'refs';
        no warnings;
        foreach my $name (%{$package}) {
                my $pkgname = "${package}$name";
                if ($name =~ /::/) {
                        next if $name =~ /^\*?main::$/;
                        find_package_vars($pkgname, $pad_vars);
                        next;
                }

                my $glob = ${$package}{$name};

                if (defined ${$glob}) {
                        $pad_vars->{ refaddr \${$glob} } = "\$$pkgname";
                }

                #FIXME: there is probably a better way, but I am lazy at the moment
                eval {
                        if (defined @{$glob}) {
                                $pad_vars->{ refaddr \@{$glob} } = $pkgname;
                        }
                };

                eval {
                        if (defined %{$glob}) {
                                $pad_vars->{ refaddr \%{$glob} } = $pkgname;
                        }
                };
        }
}

sub dumper {
        my %pad_vars;
        find_package_vars("main::", \%pad_vars);

        my $lexical = peek_my(1);
        while ( my ( $var, $ref ) = each %$lexical ) {

                # we no longer remove the '$' sigil because we don't want
                # "$foo = \@array" reported as "@foo".
                $var =~ s/^[\@\%]/*/;
                $pad_vars{ refaddr $ref } = $var;
        }
        my @names;
        my $varcount = 1;
        foreach (@_) {
                my $name;
                INNER: foreach ( \$_, $_ ) {
                        no warnings 'uninitialized';
                        $name = $pad_vars{ refaddr $_} and last INNER;
                }
                push @names, $name;
        }

        return Data::Dumper->Dump( \@_, \@names );
}

Read More 8 comments
Comments: 8
+ -

  Comment: Re:use peek_our as well (Score 1) on 2009.04.14 12:31

Well, it handles $main::foo, but not $other::package::foo. You would need to look in %other::package for it. Hmm, there should be some way of finding out what namespaces exist.

Read More 8 comments
Comments: 8