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 ]

fglock (5723)

  (email not shown publicly)

Journal of fglock (5723)

Friday June 30, 2006
02:09 PM

my first program to use a module in!

[ #30122 ]

I added the first OO test to This is also the first program to use a module written with

    # file: t/10-moose1.t
    use v6-pugs;

    use lib './t', '.';
    use moose1;

    say '1..1';
    say '1 ok # use Moose';

and the module:

    # file: t/
    use v6-pugs;
    class Point;

    has $.x is rw; # instance attributes
    has $.y; # default "is readonly"

    method clear () {
        $.x = 0; # accessible within the class
        $.y = 0;

Very simple, isn't it? The second file was copied from audreyt's slides in YAPC::NA.

The files compile to:

  # generated file: t/
  use Pugs::Runtime::Perl6;
  use strict;
  no warnings 'void';
  use lib( './t', '.' );
  use moose1();
  print '', '1..1';
  print "\n";
  print '', '1 ok # use Moose';
  print "\n";


  # generated file: t/moose1.pmc
  # [... checksum header removed ...]
  use Pugs::Runtime::Perl6;
  use strict;
  no warnings 'void';

  package Point;
  use Moose;
  use Exporter 'import';
  our @EXPORT;
  has 'x' => ( 'is' => 'rw' );
  has 'y' => ();

  sub clear {
        my $self = shift;
                $self->{'x'} = 0;


This is in the development version of - not in CPAN yet.

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.