Skip to content

Commit 0d87762

Browse files
author
Jan Limpens
committed
update claude.md a bit
1 parent b6928cb commit 0d87762

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

CLAUDE.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,21 +175,24 @@ return $value # no semicolon
175175
- methods
176176

177177
### General
178+
- use qw()
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)
178182
- 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+
```
183186
- user reader/writer abstractions
184187
- use roles rather than inheritance, where this is possible
185188

186189
### Example
187190
```perl
188-
use Init qw(:class :signatures :bool);
191+
use Init qw(:class :signatures :bool); # put feature selection in a module
189192
190193
class MyClass; # no {brackets} unless required
191194
192-
use Another::Module;
195+
use Another::Module; # sorted alphabetically
193196
use Other::Module;
194197
195198
ADJUST {
@@ -199,18 +202,18 @@ ADJUST {
199202
field $foo :param=123 :reader;
200203
field $bar :param=true :reader :writer;
201204
202-
method first_method($param, %args) {
205+
method first_method($param, %args) { # I like greedy %args
203206
return $self->second_method()
204-
if $args{condition};
207+
if $args{condition}; # break and ident
205208
my $result = $self->process($arg);
206-
return $result
209+
return $result # no semicolon on tailing returns
207210
}
208211
209212
method second_method() {
210213
my $multi = 2;
211214
my $transform = sub($x) { $x * $multi };
212215
my @items = map { $transform->($_) } @source;
213-
return \@items
216+
return $self->first_method(\@items) # always return, even nothing, avoid returning undef
214217
}
215218
216219
my %hash = (
@@ -220,4 +223,4 @@ my %hash = (
220223
and => 'there' } );
221224
```
222225

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

Comments
 (0)