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

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.
  • You could nearly call that Class::Inner and have it work like Java's inner classes :)

    Which IMO might be a useful thing. Inner classes definitely have their uses - maybe more so in Java.

    • I was thinking of this more as a testing tool so that I could generate fixtures on the fly and embed them in tests:

      my $instance   = Class::Dummy->new(\%interface);
      my @islands    = @yaml_strings;
      my $serialized = Bermuda::Test->serialize($instance, @islands);

      # a bunch of tests

      A persistent problem with test suites is having fixtures embedded in files and the poor programmer has to pop between several files to see them. That also means that a change to one fixture possibly means

      • Sorry - being terse today :)

        I realised what it was for but it occurred to me that it might sometimes be useful outside of tests.

        • Maybe I should rename it then? It really does seem like a useful testing tool (it's already making my life easier), but perhaps others could use it. Does Class::Temp sound like a good name? It would be very useful when you find yourself passing around hashrefs but you hate locked hashes.

          • I think Class::Inner is a similar but different thing that you can release once you get all the other interesting things you're working on done :)
    • And along the lines of what I said earlier, here's my first test case with it:


      use strict;
      use warnings;

      use lib 'lib', 't/lib';
      use Test::Most 'no_plan'; # tests => 1;
      use Test::XML;
      use Bermuda::Test;
      use Bermuda::XML;
      use Class::Dummy;

      my $dummy = Class::Dummy->new(
          package => 'Some::Class',
          methods => {
              name => 'Victoria',
              email => sub {
                  my $self = shift;

  • There's Class::Generate, which looks pretty weird to me. I use (wrote) Package::Generator, which has no method sugar. You can use Class::MOP, too, as seen here: []