You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+14-11Lines changed: 14 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -175,21 +175,24 @@ return $value # no semicolon
175
175
- methods
176
176
177
177
### General
178
+
- useqw()
179
+
- NEVER align vertically.
180
+
- Avoid multiple commands on a line. as a general rule, use on ; per line olny.
181
+
- fix `@{$bla}` (and similar) to `$bla->@*` (and so on)
178
182
- make use of fat comma, where it makes sense
179
-
180
-
```perl
181
-
$self->apply(username => $email);
182
-
```
183
+
```perl
184
+
$self->apply(username => $email);
185
+
```
183
186
- user reader/writer abstractions
184
187
- use roles rather than inheritance, where this is possible
185
188
186
189
### Example
187
190
```perl
188
-
use Init qw(:class :signatures :bool);
191
+
use Init qw(:class :signatures :bool); # put feature selection in a module
189
192
190
193
class MyClass; # no {brackets} unless required
191
194
192
-
use Another::Module;
195
+
use Another::Module; # sorted alphabetically
193
196
use Other::Module;
194
197
195
198
ADJUST {
@@ -199,18 +202,18 @@ ADJUST {
199
202
field $foo :param=123 :reader;
200
203
field $bar :param=true :reader :writer;
201
204
202
-
method first_method($param, %args) {
205
+
method first_method($param, %args) { # I like greedy %args
203
206
return $self->second_method()
204
-
if $args{condition};
207
+
if $args{condition}; # break and ident
205
208
my $result = $self->process($arg);
206
-
return $result
209
+
return $result # no semicolon on tailing returns
207
210
}
208
211
209
212
method second_method() {
210
213
my $multi = 2;
211
214
my $transform = sub($x) { $x * $multi };
212
215
my @items = map { $transform->($_) } @source;
213
-
return \@items
216
+
return $self->first_method(\@items) # always return, even nothing, avoid returning undef
214
217
}
215
218
216
219
my %hash = (
@@ -220,4 +223,4 @@ my %hash = (
220
223
and => 'there' } );
221
224
```
222
225
223
-
don't be overly chatty or explain too much, don't jump ahead, but go one step at a time, unless told otherwise. don't execute db queries unless allowed.
226
+
don't be overly chatty or explain too much, don't jump ahead, but go one step at a time, unless told otherwise. don't execute db queries unless allowed. in test setting, you may.
0 commit comments