home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / lib / perl5 / ouse.pm < prev    next >
Encoding:
Perl POD Document  |  2010-03-12  |  1.9 KB  |  82 lines

  1. package ouse;
  2.  
  3. use Mouse::Util; # enables strict and warnings
  4.  
  5.  
  6. my $package = 'Class';
  7. sub import {
  8.     $package = $_[1] || 'Class';
  9.     if ($package =~ /^\+/) {
  10.         $package =~ s/^\+//;
  11.         Mouse::Util::load_class($package);
  12.     }
  13. }
  14. use Filter::Simple sub { s/^/package $package;\nuse Mouse;\nuse Mouse::Util::TypeConstraints;\n/; };
  15.  
  16. 1;
  17. __END__
  18.  
  19. =head1 NAME
  20.  
  21. ouse - syntactic sugar to make Mouse one-liners easier
  22.  
  23. =head1 SYNOPSIS
  24.  
  25.   # create a Mouse class on the fly ...
  26.   perl -Mouse=Foo -e 'has bar => ( is=>q[ro], default => q[baz] ); print Foo->new->bar' # prints baz
  27.  
  28.   # loads an existing class (Mouse or non-Mouse)
  29.   # and re-"opens" the package definition to make
  30.   # debugging/introspection easier
  31.   perl -Mouse=+My::Class -e 'print join ", " => __PACKAGE__->meta->get_method_list' 
  32.  
  33. =head1 DESCRIPTION
  34.  
  35. F<ouse.pm> is a simple source filter that adds C<package $name; use Mouse;> 
  36. to the beginning of your script and was entirely created because typing 
  37. perl C<< -e'package Foo; use Mouse; ...' >> was annoying me... especially after
  38. getting used to having C<-Moose> for Moose.
  39.  
  40. =head1 INTERFACE 
  41.  
  42. C<ouse> provides exactly one method and it is automatically called by perl:
  43.  
  44. =over 4
  45.  
  46. =item C<< oose->import() >>>
  47.  
  48. Pass a package name to import to be used by the source filter.
  49.  
  50. =back
  51.  
  52. =head1 DEPENDENCIES
  53.  
  54. You will need L<Filter::Simple> and eventually L<Mouse>
  55.  
  56. =head1 INCOMPATIBILITIES
  57.  
  58. None reported. But it is a source filter and might have issues there.
  59.  
  60. =head1 SEE ALSO
  61.  
  62. L<oose> for C<< perl -Moose -e '...' >>
  63.  
  64. =head1 AUTHOR
  65.  
  66. For all intents and purposes, blame:
  67.  
  68. Chris Prather  C<< <perigrin@cpan.org> >>
  69.  
  70. ...who wrote oose.pm, which was adapted for use by Mouse by:
  71.  
  72. Ricardo SIGNES C<< <rjbs@cpan.org> >>
  73.  
  74. =head1 COPYRIGHT AND LICENSE
  75.  
  76. Copyright 2008 Shawn M Moore.
  77.  
  78. This program is free software; you can redistribute it and/or modify it
  79. under the same terms as Perl itself.
  80.  
  81. =cut
  82.