1DBIx::Class::Manual::ReUasdeirngC(o3n)tributed Perl DocuDmBeInxt:a:tCiloanss::Manual::Reading(3)
2
3
4
6 DBIx::Class::Manual::Reading - How to read and write DBIx::Class POD.
7
9 This doc should help users to understand how the examples and
10 documentation found in the DBIx::Class distribution can be interpreted.
11
12 Writers of DBIx::Class POD should also check here to make sure their
13 additions are consistent with the rest of the documentation.
14
16 Methods should be documented in the files which also contain the code
17 for the method, or that file should be hidden from PAUSE completely, in
18 which case the methods are documented in the file which loads it.
19 Methods may also be documented and referred to in files representing
20 the major objects or components on which they can be called.
21
22 For example, DBIx::Class::Relationship documents the methods actually
23 coded in the helper relationship classes like
24 DBIx::Class::Relationship::BelongsTo. The BelongsTo file itself is
25 hidden from PAUSE as it has no documentation. The accessors created by
26 relationships should be mentioned in DBIx::Class::Row, the major object
27 that they will be called on.
28
29 Method documentation
30 · Each method starts with a "head2" statement of its name.
31
32 Just the plain method name, not an example of how to call it, or a
33 link. This is to ensure easy linking to method documentation from
34 other POD.
35
36 · The header is followed by a two-item list. This contains a
37 description of the arguments the method is expected to take, and an
38 indication of what the method returns.
39
40 The first item provides a list of all possible values for the
41 arguments of the method in order, separated by ", ", preceded by
42 the text "Arguments: "
43
44 Example (for the belongs_to relationship):
45
46 =item Arguments: $accessor_name, $related_class, $fk_column|\%cond|\@cond?, \%attr?
47
48 The following possible argument sigils can be shown:
49
50 · $var - A scalar (string or numeric) variable.
51
52 · \%var - A variable containing reference to a hash.
53
54 · \@var - A variable containing a reference to an array.
55
56 · \$var - A variable containing a reference to a scalar variable.
57
58 · %var - A hashref variable (list of key/value pairs) - rarely
59 used in DBIx::Class.
60
61 Reading an argument as a hash variable will consume all
62 subsequent method arguments, use with caution.
63
64 · @var - An array variable (list of values).
65
66 Reading an argument as a array variable will consume all
67 subsequent method arguments, use with caution.
68
69 · ? - Optional, should be placed after the argument type and
70 name.
71
72 ## Correct
73 \%myhashref|\@myarrayref?
74
75 ## Wrong
76 \%myhashref?|\@myarrayref
77
78 Applies to the entire argument.
79
80 Optional arguments can be left out of method calls, unless the
81 caller needs to pass in any of the following arguments. In
82 which case the caller should pass "undef" in place of the
83 missing argument.
84
85 · | - Alternate argument content types.
86
87 At least one of these must be supplied unless the argument is
88 also marked optional.
89
90 The second item starts with the text "Return value:". The remainder
91 of the line is either the text "undefined", a text describing the
92 result of the method, or a variable with a descriptive name.
93
94 ## Good examples
95 =item Return value: undefined
96 =item Return value: A schema object
97 =item Return value: $classname
98
99 ## Bad examples
100 =item Return value: The names
101
102 "undefined" means the method does not deliberately return a value,
103 and the caller should not use or rely on anything it does return.
104 (Perl functions always return something, usually the result of the
105 last code statement, if there is no explicit return statement.)
106
107 · The argument list is followed by a single paragraph describing what
108 the method does.
109
110 · The description paragraph is followed by another list. Each item in
111 the list explains one of the possible argument/type combinations.
112
113 This list may be omitted if the author feels that the variable
114 names are self-explanatory enough to not require it. Use best
115 judgement.
116
117 · The argument list is followed by some examples of how to use the
118 method, using its various types of arguments.
119
120 The examples can also include ways to use the results if
121 applicable. For instance, if the documentation is for a
122 relationship type, the examples can include how to call the
123 resulting relation accessor, how to use the relation name in a
124 search and so on.
125
126 If some of the examples assume default values, these should be
127 shown with and without the actual arguments, with hints about the
128 equivalent calls.
129
130 The example should be followed by one or more paragraphs explaining
131 what it does.
132
133 Examples and explaining paragraphs can be repeated as necessary.
134
136 see DBIx::Class
137
139 You may distribute this code under the same terms as Perl itself.
140
141
142
143perl v5.12.0 2010-05-12 DBIx::Class::Manual::Reading(3)