From: Ralf Ertzinger Date: Tue, 30 Apr 2013 13:40:50 +0000 (+0200) Subject: Modify readme for plugins X-Git-Url: https://git.camperquake.de/gitweb.cgi?p=videosite.git;a=commitdiff_plain;h=d0ba24f76a247442672ed3d2a3b970374bd5fb8f Modify readme for plugins --- diff --git a/videosite/readme.txt b/videosite/readme.txt index 943e430..697ff42 100644 --- a/videosite/readme.txt +++ b/videosite/readme.txt @@ -143,20 +143,13 @@ declared as follows: sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self->{'_PARAMS'} = {'FOO' => [42, 'This is the FOO parameter, twiddle it to do stuff']}; - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + my $self = $class->SUPER::new( + _PARAMS => {'FOO' => [42, 'This is the FOO parameter, twiddle it to do stuff']}, + @_, + ); + return bless($self, $class); } -b) as seen in the example above, after declaring the parameter hash, call the -method _prepare_parameters() on your class instance. This will convert the -hash into the internally used data structure and prepare it for automatic -loading and saving. - -c) to access one of the parameters, call the _getval() method, giving the name +b) to access one of the parameters, call the _getval() method, giving the name of the parameter as first argument. This will return the current value of that -parameter (either the default value or the user defuned value). +parameter (either the default value or the user defined value).