Kato Atsushi
ktats****@users*****
2007年 7月 14日 (土) 10:29:57 JST
Index: docs/modules/DBIx-Class-0.07006/lib/DBIx/Class/Manual/Component.pod diff -u /dev/null docs/modules/DBIx-Class-0.07006/lib/DBIx/Class/Manual/Component.pod:1.1 --- /dev/null Sat Jul 14 10:29:57 2007 +++ docs/modules/DBIx-Class-0.07006/lib/DBIx/Class/Manual/Component.pod Sat Jul 14 10:29:57 2007 @@ -0,0 +1,253 @@ +=head1 NAME + +DBIx::Class::Manual::Component - DBIx::Class ã³ã³ãã¼ãã³ããéçºãã + +=head1 ã³ã³ãã¼ãã³ãã¨ã¯ä½ã + +A component is a module that can be added in to your DBIx::Class +classes to provide extra functionality. A good example is the PK::Auto +component which automatically retrieves primary keys that the database +itself creates, after the insert has happened. + +DBIx::Classã®ã¯ã©ã¹ã«ä»å çãªæ©è½ãæä¾ããããã«è¿½å ããã¢ã¸ã¥ã¼ã«ã®ãã¨ã§ãã +好ä¾ã¨ãã¦ã¯ãPK::Autoã³ã³ãã¼ãã³ããããã¾ããPK::Autoã¯ãinsertã®å¾ã«ã +ãã¼ã¿ãã¼ã¹èªèº«ããä½ã£ããã©ã¤ããªãã¼ãåãåºãã¾ãã + +=head1 使ãæ¹ + +Components are loaded using the load_components() method within your +DBIx::Class classes. + +ã³ã³ãã¼ãã³ãã¯ãèªåã®DBIx::Class ã¯ã©ã¹ã®ä¸ã«ã load_components() +ã¡ã½ããã使ã£ã¦ããã¼ããã¾ãã + + package My::Thing; + use base qw( DBIx::Class ); + __PACKAGE__->load_components(qw/ PK::Auto Core /); + +Generally you do not want to specify the full package name +of a component, instead take off the DBIx::Class:: part of +it and just include the rest. If you do want to load a +component outside of the normal namespace you can do so +by prepending the component name with a +. + +ããã¦ããã³ã³ãã¼ãã³ãã®å®å ¨ãªããã±ã¼ã¸åãæå®ãããã¯ãªãã§ãããããã +ãã®ä»£ããã«ãDBIx::Class:: ã®é¨åãå¤ãã¦ãæ®ãã®é¨åã ããå«ãã¾ãã +é常ã®åå空é以å¤ã®ã³ã³ãã¼ãã³ãããã¼ãããããªãã +ã³ã³ãã¼ãã³ãåã®åã« + ãä»ãã¦ãã ããã + + __PACKAGE__->load_components(qw/ +My::Component /); + +Once a component is loaded all of it's methods, or otherwise, +that it provides will be available in your class. + +ã³ã³ãã¼ãã³ãããã¼ããããã¨ãå ¨ã¦ã®ã³ã³ãã¼ãã³ããæä¾ãã +ã¡ã½ãããèªåã®ã¯ã©ã¹ã§æå¹ã«ãªãã¾ãã + +The order in which is you load the components may be +very important, depending on the component. The general +rule of thumb is to first load extra components and then +load core ones last. If you are not sure, then read the +docs for the components you are using and see if they +mention anything about the order in which you should load +them. + +ã³ã³ãã¼ãã³ãããã¼ãããé çªã¯é常ã«éè¦ã§ããã³ã³ãã¼ãã³ãã«ä¾åãã¾ãã +ä¸è¬çãªçµé¨ã§ã¯ãã¾ãä»å çãªã³ã³ãã¼ãã³ãããã¼ãããããããã +ã³ã¢ãªã³ã³ãã¼ãã³ããæå¾ã«ãã¼ããã¾ããããããããªããã°ã +使ã£ã¦ããã³ã³ãã¼ãã³ãã®ããã¥ã¡ã³ããèªã¿ã +ãã¼ããã¹ãé çªã«ã¤ãã¦ä½ãæ¸ããã¦ããããè¦ã¦ãã ããã + +=head1 ã³ã³ãã¼ãã³ããä½ã + +Making your own component is very easy. + +èªåèªèº«ã®ã³ã³ãã¼ãã³ããä½ãã®ã¯ã¨ã¦ãç°¡åã§ãã + + package DBIx::Class::MyComp; + use base qw(DBIx::Class); + # Create methods, accessors, load other components, etc. + 1; + +When a component is loaded it is included in the calling +class' inheritance chain using L<Class::C3>. As well as +providing custom utility methods, a component may also +override methods provided by other core components, like +L<DBIx::Class::Row> and others. For example, you +could override the insert and delete methods. + +ã³ã³ãã¼ãã³ãããã¼ããããã¨ãå¼ã³åºãã¦ããã¯ã©ã¹ã®ã +L<Class::C3>ã使ã£ããç¶æ¿ãã§ã¼ã³ã«å«ã¾ãã¾ãã +ã«ã¹ã¿ã ã¦ã¼ãã£ãªãã£ã¡ã½ãããæä¾ããã®ã¨åæ§ã«ã +ã³ã³ãã¼ãã³ãããä»ã®ã³ã¢ã³ã³ãã¼ãã³ãã§æä¾ããã¦ãã +ã¡ã½ãããä¸æ¸ãããããããã¾ãããL<DBIx::Class::Row>ã +ãã®ä»ã®ã³ã³ãã¼ãã³ãã®ããã«ã +ä¾ãã°ãinsert 㨠delete ã¡ã½ããããªã¼ãã¼ã©ã¤ãã§ãã¾ãã + + sub insert { + my $self = shift; + # Do stuff with $self, like set default values. + return $self->next::method( @_ ); + } + + sub delete { + my $self = shift; + # Do stuff with $self. + return $self->next::method( @_ ); + } + +Now, the order that a component is loaded is very important. Components +that are loaded first are the first ones in the inheritance stack. So, if +you override insert() but the DBIx::Class::Row component is loaded first +then your insert() will never be called, since the DBIx::Class::Row insert() +will be called first. If you are unsure as to why a given method is not +being called try printing out the Class::C3 inheritance stack. + +ãããªãã¨ãã³ã³ãã¼ãã³ãããã¼ãããé çªã¯ã¨ã¦ãéè¦ã§ãã +æåã«ãã¼ããããã³ã³ãã¼ãã³ãã¯ãç¶æ¿ã¹ã¿ãã¯ã®æåã®ãã®ã§ãããã®ããã +insert() ããªã¼ãã¼ã©ã¤ãããã¨ãã¦ãDBIx::Class::Rowã³ã³ãã¼ãã³ããæåã« +ãã¼ããããã¨ãèªåã®insert()ã¯ã決ãã¦å¼ã°ãã¾ãããDBIx::Class::Row insert() +ãæåã«å¼ã°ãã¦ãã¾ãã¾ããããããã¡ã½ãããå¼ã°ããªããããããããªããã°ã +Class::C3 ã®ç¶æ¿ã¹ã¿ãã¯ãåºåãã¦ã¿ã¦ãã ããã + + print join ', ' => Class::C3::calculateMRO('YourClass::Name'); + +Check out the L<Class::C3> docs for more information about inheritance. + +ç¶æ¿ã«ã¤ãã¦ãã詳ããã¯ãL<Class::C3>ã®ããã¥ã¡ã³ãããã§ãã¯ãã¦ãã ããã + +=head1 åå¨ããã³ã³ãã¼ãã³ã + +=head2 ä»å çãªãã® + +These components provide extra functionality beyond +basic functionality that you can't live without. + +ä¸è¨ã®ã³ã³ãã¼ãã³ãã¯åºæ¬çãªæ©è½ãè¶ããã +ããç¡ãã§ã¯çãã¦ãããªããããªãä»å çãªæ©è½ãæä¾ãã¾ãã + +L<DBIx::Class::CDBICompat> - Class::DBI Compatibility layer. + +L<DBIx::Class::CDBICompat> - Class::DBI äºæã¬ã¤ã¤ã + +L<DBIx::Class::FormTools> - Build forms with multiple interconnected objects. + +L<DBIx::Class::FormTools> - è¤æ°ã®é¢é£ãããªãã¸ã§ã¯ãã§ãã©ã¼ã ãä½ãã + +L<DBIx::Class::HTMLWidget> - Like FromForm but with DBIx::Class and HTML::Widget. + +L<DBIx::Class::HTMLWidget> - FromFormã¨ä¼¼ã¦ãã¾ãããDBIx::Class ã¨HTML::Widgetã + +L<DBIx::Class::Ordered> - Modify the position of objects in an ordered list. + +L<DBIx::Class::Ordered> - æ´åããããªã¹ãå ã®ãªãã¸ã§ã¯ãã®ä½ç½®ãä¿®æ£ããã + +L<DBIx::Class::PK::Auto> - Retrieve automatically created primary keys upon insert. + +L<DBIx::Class::PK::Auto> - insert ã§ãèªåçã«ä½ããããã©ã¤ããªãã¼ãåå¾ããã + +L<DBIx::Class::QueriesTime> - Display the amount of time it takes to run queries. + +L<DBIx::Class::QueriesTime> - ã¯ã¨ãªãå®è¡ããã®ã«ããã£ãæéã表示ããã + +L<DBIx::Class::RandomStringColumns> - Declare virtual columns that return random strings. + +L<DBIx::Class::RandomStringColumns> - ã©ã³ãã ãªæååãè¿ãä»®æ³ã«ã©ã ã宣è¨ããã + +L<DBIx::Class::UTF8Columns> - Force UTF8 (Unicode) flag on columns. + +L<DBIx::Class::UTF8Columns> - ã«ã©ã ã«UTF8 (Unicode) flagãå¼·å¶ããã + +L<DBIx::Class::UUIDColumns> - Implicit UUID columns. + +L<DBIx::Class::UUIDColumns> - Implicit UUID columns. + +L<DBIx::Class::WebForm> - CRUD methods. + +L<DBIx::Class::WebForm> - CRUD ã¡ã½ããã + +=head2 å®é¨ç + +These components are under development, there interfaces may +change, they may not work, etc. So, use them if you want, but +be warned. + +ä¸è¨ã®ã³ã³ãã¼ãã³ãã¯éçºä¸ã§ããã¤ã³ã¿ã¼ãã§ã¼ã¹ã¯ä»£ããããããã¾ãããã +åããªãã£ããããããããã¾ããããæã¿ãªã使ã£ã¦ãã ããã +ãã ãã注æãã¦ãã ããã + +L<DBIx::Class::Serialize> - Hooks for Storable freeze/thaw. + +L<DBIx::Class::Serialize> - Storable freeze/thawã®ããã¯ã + +L<DBIx::Class::Serialize::Storable> - Hooks for Storable freeze/thaw. + +L<DBIx::Class::Serialize::Storable> - Storable freeze/thawã®ããã¯ã + +L<DBIx::Class::Validation> - Validate all data before submitting to your database. + +L<DBIx::Class::Validation> - ãã¼ã¿ãã¼ã¹ã«å ¥ããåã«å ¨ã¦ã®ãã¼ã¿ãæ£ããã確èªããã + +=head2 ã³ã¢ + +These are the components that all, or nearly all, people will use +without even knowing it. These components provide most of +DBIx::Class' functionality. + +ä¸è¨ã®ã³ã³ãã¼ãã³ãã¯å ¨ã¦ã®ãã»ã¨ãã©å ¨ã¦ã®ã人ããããç¥ããªãã¦ã使ãã§ãããã +ä¸è¨ã®ã³ã³ãã¼ãã³ãã¯DBIx::Classã®æ©è½ã®ã»ã¨ãã©ãæä¾ãã¾ãã + +L<DBIx::Class::AccessorGroup> - Lets you build groups of accessors. + +L<DBIx::Class::AccessorGroup> - ã¢ã¯ã»ãµã®ã°ã«ã¼ãä½ãã¾ãã + +L<DBIx::Class::Core> - Loads various components that "most people" would want. + +L<DBIx::Class::Core> - "ã»ã¨ãã©ã®äºº"ã欲ããæ§ã ãªã³ã³ãã¼ãã³ãããã¼ããã¾ãã + +L<DBIx::Class::DB> - Non-recommended classdata schema component. + +L<DBIx::Class::DB> - éæ¨å¥¨ã®ã¯ã©ã¹ãã¼ã¿ã¹ãã¼ãã³ã³ãã¼ãã³ãã + +L<DBIx::Class::InflateColumn> - Automatically create objects from column data. + +L<DBIx::Class::InflateColumn> - ã«ã©ã ãã¼ã¿ããèªåçã«ãªãã¸ã§ã¯ããä½ãã + +L<DBIx::Class::PK> - This class contains methods for handling primary keys and methods depending on them. + +L<DBIx::Class::PK> - ãã®ã¯ã©ã¹ã¯ãã©ã¤ããªãã¼ãæ±ãã¡ã½ããã¨ããã«ä¾åããã¡ã½ãããå«ã¿ã¾ãã + +L<DBIx::Class::Relationship> - Inter-table relationships. + +L<DBIx::Class::Relationship> - ãã¼ãã«éã®ãªã¬ã¼ã·ã§ã³ã·ããã + +L<DBIx::Class::ResultSourceProxy::Table> - Provides a classdata table object and method proxies. + +L<DBIx::Class::ResultSourceProxy::Table> - ã¯ã©ã¹ãã¼ã¿ãã¼ãã«ãªãã¸ã§ã¯ãã¨ã¡ã½ãããããã·ãæä¾ãã¾ãã + +L<DBIx::Class::Row> - Basic row methods. + +L<DBIx::Class::Row> - åºæ¬çãªåã®ã¡ã½ããã + +=head1 SEE ALSO + +L<DBIx::Class::Manual::Cookbook> + +=head1 AUTHOR + +Aran Clary Deltac <bluef****@cpan*****> + + +=head1 翻訳ã«ã¤ã㦠+ +翻訳è ï¼å è¤æ¦ (ktat.****@gmail*****) + +Perlããã¥ã¡ã³ãæ¥æ¬èªè¨³ Project ã«ã¦ã +Perlã¢ã¸ã¥ã¼ã«ãããã¥ã¡ã³ãã®ç¿»è¨³ãè¡ã£ã¦ããã¾ãã + + http://perldocjp.sourceforge.jp/ + http://sourceforge.jp/projects/perldocjp/ + http://www.freeml.com/perldocjp/ + http://www.perldoc.jp + +=cut