in reply to Could anyone explain the following Class::MethodMaker Code ?
The last one ( new => 'new') is clear enough. The first one is trickier : scalar is the hash key; let's analyse the content :scalar => [+{ -type => 'File::stat' }, qw/ name /], new => 'new',
the enclosing square braces once again force an anonymous array. Inside there are two elements :[+{ -type => 'File::stat' }, qw/ name /]
, the + force the following curly brace {} to be interpreted as an hash element and not a code block. so that's simply an anonymous hash entry.+{ -type => 'File::stat' }, qw/ name /
It's way better, isn't it ?$VAR1 = { 'scalar' => [ { '-type' => 'File::stat' }, 'name' ], 'new' => 'new' };
|
|---|