Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a5fbf5a8

Von Sven Schöling vor mehr als 10 Jahren hinzugefügt

  • ID a5fbf5a8724d46bfcf0fb944d8b44185a8fb3f71
  • Vorgänger 45f6e6ce
  • Nachfolger d59c9877

ActsAsList: use Parameter zum Konfigurieren benutzen

Unterschiede anzeigen:

SL/DB/Helper/ActsAsList.pm
14 14
  my ($class, @params)   = @_;
15 15
  my $importing = caller();
16 16

  
17
  configure_acts_as_list($importing, @params);
18

  
17 19
  $importing->before_save(  sub { SL::DB::Helper::ActsAsList::set_position(@_)    });
18 20
  $importing->before_delete(sub { SL::DB::Helper::ActsAsList::remove_position(@_) });
19 21

  
20
  # Use 'goto' so that Exporter knows which module to import into via
21
  # 'caller()'.
22
  goto &Exporter::import;
22
  # Don't 'goto' to Exporters import, it would try to parse @params
23
  __PACKAGE__->export_to_level(1, $class, @EXPORT);
23 24
}
24 25

  
25 26
#
......
322 323
=head1 SYNOPSIS
323 324

  
324 325
  package SL::DB::SomeObject;
325
  use SL::DB::Helper::ActsAsList;
326
  use SL::DB::Helper::ActsAsList [ PARAMS ];
326 327

  
327 328
  package SL::Controller::SomeController;
328 329
  ...
......
347 348
When the object is deleted all positions greater than the object's old
348 349
position are decreased by one.
349 350

  
350
The column name to use can be configured via L<configure_acts_as_list>.
351
C<PARAMS> will be given to L<configure_acts_as_list> and can be used to
352
set the column name.
351 353

  
352 354
=head1 CLASS FUNCTIONS
353 355

  
......
355 357

  
356 358
=item C<configure_acts_as_list %params>
357 359

  
358
Configures the mixin's behaviour. C<%params> can contain the following
359
values:
360
Configures the mixin's behaviour. Will get called automatically with the
361
include parameters. C<%params> can contain the following values:
360 362

  
361 363
=over 2
362 364

  

Auch abrufbar als: Unified diff