From: Dave Rolsky Date: Tue, 2 Sep 2008 22:06:00 +0000 (+0000) Subject: Cut out some extending junk which is better covered in the recipes. X-Git-Tag: 0.57~27 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6f894f3032860d1336c599b7ab1a82b7c803d3ca;p=gitmo%2FMoose.git Cut out some extending junk which is better covered in the recipes. Add a link to the soon-to-be-written Moose::Intro --- diff --git a/lib/Moose.pm b/lib/Moose.pm index fb40886..fbd885e 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -322,20 +322,23 @@ Moose is an extension of the Perl 5 object system. The main goal of Moose is to make Perl 5 Object Oriented programming easier, more consistent and less tedious. With Moose you can to think -more about what you want to do and less about the mechanics of OOP. +more about what you want to do and less about the mechanics of OOP. -Additionally, Moose is built on top of L, which is a -metaclass system for Perl 5. This means that Moose not only makes -building normal Perl 5 objects better, but it provides the power of -metaclass programming as well. +Additionally, Moose is built on top of L, which is a +metaclass system for Perl 5. This means that Moose not only makes +building normal Perl 5 objects better, but it provides the power of +metaclass programming as well. =head2 New to Moose? -If you're new to Moose, the best place to start is the -L. The recipes on Moose basics will get you up to -speed with many of Moose's features quickly. Once you have an idea of -what Moose can do, you can use the API documentation to get more -detail on features which interest you. +If you're new to Moose, the best place to start is the L +docs, followed by the L. The intro will show you what +Moose is, and how it makes Perl 5 OO better. + +The cookbook recipes on Moose basics will get you up to speed with +many of Moose's features quickly. Once you have an idea of what Moose +can do, you can use the API documentation to get more detail on +features which interest you. =head2 Moose Extensions @@ -810,45 +813,10 @@ to work. Here is an example: =head1 EXTENDING AND EMBEDDING MOOSE Moose also offers some options for extending or embedding it into your -own framework. There are several things you might want to do as part -of such a framework. First, you probably want to export Moose's sugar -functions (C, C, etc) for users of the -framework. Second, you may want to provide additional sugar of your -own. Third, you may want to provide your own object base class instead -of L, and/or your own metaclass class instead of -L. - -The exporting needs can be asily satisfied by using -L, which is what C itself uses for -exporting. L lets you "export like Moose". - -If you define an C method in a module that uses -L, then this method will be called I -C's own C. This gives you a chance to provide an -alternate object base class or metaclass class. - -Here is a simple example: - - package MyFramework; - - use strict; - use warnings; - - use Moose (); # no need to get Moose's exports - use Moose::Exporter; - - Moose::Exporter->setup_import_methods( also => 'Moose' ); - - sub init_meta { - shift; - return Moose->init_meta( @_, base_class => 'MyFramework::Base' ); - } - -In this example, any class that includes C will get -all of C's sugar functions, and will have their superclass -set to C. - -Additionally, that class can include C to unimport +own framework. To learn more about extending Moose, we recommend +checking out the "Extending" recipes in the L, +starting with L, which provides +an overview of all the different ways you might extend Moose. =head2 B<< Moose->init_meta(for_class => $class, base_class => $baseclass, metaclass => $metaclass) >>