From: Justin Guenther Date: Fri, 24 Mar 2006 07:16:39 +0000 (+0000) Subject: changed formatting for arguments/return values in method docs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=27f01d1f4fc106e0d27a13c6f6c9d5fa131e9447;p=dbsrgits%2FDBIx-Class-Historic.git changed formatting for arguments/return values in method docs --- diff --git a/lib/DBIx/Class/AccessorGroup.pm b/lib/DBIx/Class/AccessorGroup.pm index b8079fc..9ef0a51 100644 --- a/lib/DBIx/Class/AccessorGroup.pm +++ b/lib/DBIx/Class/AccessorGroup.pm @@ -20,9 +20,15 @@ getters and setters. =head2 mk_group_accessors -Creates a set of accessors in a given group. +=over 4 + +=item Arguments: $group, @fieldspec + +Returns: none + +=back -=head3 Arguments: $group, @fieldspec +Creates a set of accessors in a given group. $group is the name of the accessor group for the generated accessors; they will call get_$group($field) on get and set_$group($field, $value) on set. @@ -31,8 +37,6 @@ will call get_$group($field) on get and set_$group($field, $value) on set. this is used as both field and accessor name, if a listref it is expected to be of the form [ $accessor, $field ]. -=head3 Return value: none - =cut sub mk_group_accessors { @@ -80,14 +84,18 @@ sub mk_group_accessors { =head2 mk_group_ro_accessors +=over 4 + +=item Arguments: $group, @fieldspec + +Returns: none + +=back + Creates a set of read only accessors in a given group. Identical to but accessors will throw an error if passed a value rather than setting the value. -=head3 Arguments: $group, @fieldspec - -=head3 Return value: none - =cut sub mk_group_ro_accessors { @@ -98,14 +106,18 @@ sub mk_group_ro_accessors { =head2 mk_group_wo_accessors +=over 4 + +=item Arguments: $group, @fieldspec + +Returns: none + +=back + Creates a set of write only accessors in a given group. Identical to but accessors will throw an error if not passed a value rather than getting the value. -=head3 Arguments: $group, @fieldspec - -=head3 Return value: none - =cut sub mk_group_wo_accessors { @@ -116,12 +128,16 @@ sub mk_group_wo_accessors { =head2 make_group_accessor -Returns a single accessor in a given group; called by mk_group_accessors -for each entry in @fieldspec. +=over 4 + +=item Arguments: $group, $field -=head3 Arguments: $group, $field +Returns: $sub (\CODE) -=head3 Return value: $sub (\CODE) +=back + +Returns a single accessor in a given group; called by mk_group_accessors +for each entry in @fieldspec. =cut @@ -146,12 +162,16 @@ sub make_group_accessor { =head2 make_group_ro_accessor -Returns a single read-only accessor in a given group; called by -mk_group_ro_accessors for each entry in @fieldspec. +=over 4 + +=item Arguments: $group, $field -=head3 Arguments: $group, $field +Returns: $sub (\CODE) -=head3 Return value: $sub (\CODE) +=back + +Returns a single read-only accessor in a given group; called by +mk_group_ro_accessors for each entry in @fieldspec. =cut @@ -176,12 +196,16 @@ sub make_group_ro_accessor { =head2 make_group_wo_accessor -Returns a single write-only accessor in a given group; called by -mk_group_wo_accessors for each entry in @fieldspec. +=over 4 + +=item Arguments: $group, $field + +Returns: $sub (\CODE) -=head3 Arguments: $group, $field +=back -=head3 Return value: $sub (\CODE) +Returns a single write-only accessor in a given group; called by +mk_group_wo_accessors for each entry in @fieldspec. =cut @@ -206,12 +230,16 @@ sub make_group_wo_accessor { =head2 get_simple -Simple getter for hash-based objects which returns the value for the field -name passed as an argument. +=over 4 -=head3 Arguments: $field +=item Arguments: $field -=head3 Return value: $value +Returns: $value + +=back + +Simple getter for hash-based objects which returns the value for the field +name passed as an argument. =cut @@ -222,12 +250,16 @@ sub get_simple { =head2 set_simple -Simple setter for hash-based objects which sets and then returns the value -for the field name passed as an argument. +=over 4 + +=item Arguments: $field, $new_value -=head3 Arguments: $field, $new_value +Returns: $new_value -=head3 Return value: $new_value +=back + +Simple setter for hash-based objects which sets and then returns the value +for the field name passed as an argument. =cut @@ -238,14 +270,18 @@ sub set_simple { =head2 get_component_class +=over 4 + +=item Arguments: $name + +Returns: $component_class + +=back + Returns the class name for a component; returns an object key if called on an object, or attempts to return classdata referenced by _$name if called on a class. -=head3 Arguments: $name - -=head3 Return value: $component_class - =cut sub get_component_class { @@ -260,14 +296,18 @@ sub get_component_class { =head2 set_component_class +=over 4 + +=item Arguments: $name, $new_component_class + +Returns: $new_component_class + +=back + Sets a component class name; attempts to require the class before setting but does not error if unable to do so. Sets an object key of the given name if called or an object or classdata called _$name if called on a class. -=head3 Arguments: $name, $new_component_class - -=head3 Return value: $new_component_class - =cut sub set_component_class { diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm index 343c0d0..9ea8cff 100644 --- a/lib/DBIx/Class/Relationship/Base.pm +++ b/lib/DBIx/Class/Relationship/Base.pm @@ -21,7 +21,11 @@ methods, for predefined ones, look in L. =head2 add_relationship -=head3 Arguments: ('relname', 'Foreign::Class', $cond, $attrs) +=over 4 + +=item Arguments: ('relname', 'Foreign::Class', $cond, $attrs) + +=back __PACKAGE__->add_relationship('relname', 'Foreign::Class', $cond, $attrs); @@ -62,9 +66,10 @@ command immediately before C. An arrayref containing a list of accessors in the foreign class to create in the main class. If, for example, you do the following: - MyDB::Schema::CD->might_have(liner_notes => 'MyDB::Schema::LinerNotes', undef, { - proxy => [ qw/notes/ ], - }); + MyDB::Schema::CD->might_have(liner_notes => 'MyDB::Schema::LinerNotes', + undef, { + proxy => [ qw/notes/ ], + }); Then, assuming MyDB::Schema::LinerNotes has an accessor named notes, you can do: @@ -85,7 +90,11 @@ created, which calls C for the relationship. =head2 register_relationship -=head3 Arguments: ($relname, $rel_info) +=over 4 + +=item Arguments: ($relname, $rel_info) + +=back Registers a relationship on the class. This is called internally by L to set up Accessors and Proxies. @@ -94,11 +103,20 @@ L to set up Accessors and Proxies. sub register_relationship { } -=head2 related_resultset($name) +=head2 related_resultset + +=over 4 + +=item Arguments: ($relationship_name) + +=item Returns: $related_resultset + +=back - $rs = $obj->related_resultset('related_table'); + $rs = $cd->related_resultset('artist'); -Returns a L for the relationship named $name. +Returns a L for the relationship named +$relationship_name. =cut @@ -160,7 +178,7 @@ sub search_related { Returns the count of all the items in the related resultset, restricted by the current item or where conditions. Can be called on a -L or a +L or a L object. =cut @@ -175,9 +193,9 @@ sub count_related { my $new_obj = $obj->new_related('relname', \%col_data); Create a new item of the related foreign class. If called on a -L object, it will magically -set any primary key values into foreign key columns for you. The newly -created item will not be saved into your storage until you call C +L object, it will magically set any +primary key values into foreign key columns for you. The newly created item +will not be saved into your storage until you call L on it. =cut @@ -210,7 +228,7 @@ sub create_related { my $found_item = $obj->find_related('relname', @pri_vals | \%pri_vals); Attempt to find a related object using its primary key or unique constraints. -See C in L for details. +See L for details. =cut @@ -224,8 +242,8 @@ sub find_related { my $new_obj = $obj->find_or_create_related('relname', \%col_data); -Find or create an item of a related class. See C in -L for details. +Find or create an item of a related class. See +L for details. =cut @@ -243,8 +261,8 @@ related object. This is used to associate previously separate objects, for example, to set the correct author for a book, find the Author object, then call set_from_related on the book. -The columns are only set in the local copy of the object, call C to set -them in the storage. +The columns are only set in the local copy of the object, call L to +set them in the storage. =cut @@ -271,8 +289,8 @@ sub set_from_related { $book->update_from_related('author', $author_obj); -As C, but the changes are immediately updated onto your -storage. +The same as L, but the changes are immediately updated +in storage. =cut diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 461a837..093a456 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -53,7 +53,11 @@ In the examples below, the following table classes are used: =head2 new -=head3 Arguments: ($source, \%$attrs) +=over 4 + +=item Arguments: ($source, \%$attrs) + +=back The resultset constructor. Takes a source object (usually a L) and an attribute hash (see @@ -232,7 +236,11 @@ sub search_literal { =head2 find -=head3 Arguments: (@colvalues) | (\%cols, \%attrs?) +=over 4 + +=item Arguments: (@colvalues) | (\%cols, \%attrs?) + +=back Finds a row based on its primary key or unique constraint. For example: @@ -368,7 +376,11 @@ sub search_like { =head2 slice -=head3 Arguments: ($first, $last) +=over 4 + +=item Arguments: ($first, $last) + +=back Returns a subset of elements from the resultset. @@ -633,7 +645,11 @@ sub first { =head2 update -=head3 Arguments: (\%values) +=over 4 + +=item Arguments: (\%values) + +=back Sets the specified columns in the resultset to the supplied values. @@ -644,12 +660,17 @@ sub update { $self->throw_exception("Values for update must be a hash") unless ref $values eq 'HASH'; return $self->result_source->storage->update( - $self->result_source->from, $values, $self->{cond}); + $self->result_source->from, $values, $self->{cond} + ); } =head2 update_all -=head3 Arguments: (\%values) +=over 4 + +=item Arguments: (\%values) + +=back Fetches all objects and updates them one at a time. Note that C will run cascade triggers while L will not. @@ -705,9 +726,11 @@ sub delete { $del->{$1} = $self->{cond}{$key}; } } + } else { $self->throw_exception( - "Can't delete on resultset with condition unless hash or array"); + "Can't delete on resultset with condition unless hash or array" + ); } $self->result_source->storage->delete($self->result_source->from, $del); @@ -746,7 +769,11 @@ sub pager { =head2 page -=head3 Arguments: ($page_num) +=over 4 + +=item Arguments: ($page_num) + +=back Returns a new resultset for the specified page. @@ -761,7 +788,11 @@ sub page { =head2 new_result -=head3 Arguments: (\%vals) +=over 4 + +=item Arguments: (\%vals) + +=back Creates a result in the resultset's result class. @@ -786,7 +817,11 @@ sub new_result { =head2 create -=head3 Arguments: (\%vals) +=over 4 + +=item Arguments: (\%vals) + +=back Inserts a record into the resultset and returns the object. @@ -803,7 +838,11 @@ sub create { =head2 find_or_create -=head3 Arguments: (\%vals, \%attrs?) +=over 4 + +=item Arguments: (\%vals, \%attrs?) + +=back $class->find_or_create({ key => $val, ... }); @@ -993,6 +1032,8 @@ sub throw_exception { =head1 ATTRIBUTES +XXX: FIXME: Attributes docs need clearing up + The resultset takes various attributes that modify its behavior. Here's an overview of them: @@ -1004,7 +1045,11 @@ descending order on the column `year'. =head2 columns -=head3 Arguments: (arrayref) +=over 4 + +=item Arguments: (\@columns) + +=back Shortcut to request a particular set of columns to be retrieved. Adds C onto the start of any column without a C<.> in it and sets C, usually when C