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 ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Friday December 12, 2003
06:44 PM


[ #16314 ]

I've released Attribute::Context (originally called Sub::Attributes. Amongst other things, I eliminated the Iterator attribute. It wasn't very useful, but I've replaced it with a "Custom" attribute. I'll flesh that out more later as I get better ideas, but for the time being, in list context you get your list and in scalar context you get an object.

sub foo : Custom(My::Class) {
    # do stuff
    return @results;

# get @results
my @stuff = foo(@data);

# get My::Class->new(\@results)
my $thing = foo(@data);

And there is now more robust dealing with void context:

sub foo : First(WARNVOID) {...}

sub thing : Custom( class => 'My::Class', NOVOID => 1 ) {...}

The Custom attribute will probably grow into something like this:

my %specification = (
    class       => 'My::Class',
    constructor => 'build', # defaults to 'new'
    listref     => 0, # form the contructor argument takes
    args        => \@args, additional args passed in before \@results
    WARNVOID    => 1,

sub foo :Custom(%specification) {...}

Of course, there's no point in doing that unless people use it. chromatic's article about open source myths hits the nail on the head when he points out that you're lucky to even hear from people using your software, much less offering suggestions or help.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.