| 1 | package Blosxom::Plugin::DataSection; | ||
| 2 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use Data::Section::Simple; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 3 | my @exports = qw( get_data_section merge_data_section_into ); | |
| 7 | |||
| 8 | 3 | ▶ | sub init { |
|
Subroutine
init: called CC=2 SCAR=6.9
Pod
undocumented
| |||
| 9 | 3 | my ( $class, $caller ) = @_; | |
| 10 | 3 | $caller->add_attribute( data_section => \&_build_data_section ); | |
| 11 | 3 | $caller->add_method( $_ => \&{$_} ) for @exports; | |
| 12 | 3 | return; | |
| 13 | } | ||
| 14 | |||
| 15 | 1 | ▶ | sub _build_data_section { |
|
Subroutine
_build_data_section: called CC=1 SCAR=0.0
| |||
| 16 | 1 | Data::Section::Simple->new($_[0])->get_data_section; | |
| 17 | } | ||
| 18 | |||
| 19 | 1 | ▶ | sub get_data_section { $_[0]->data_section->{$_[1]} } |
|
Subroutine
get_data_section: called CC=1 SCAR=0.0
Pod
documented
| |||
| 20 | |||
| 21 | 1 | ▶ | sub merge_data_section_into { |
|
Subroutine
merge_data_section_into: called CC=2 SCAR=6.9
Pod
documented
| |||
| 22 | 1 | my ( $pkg, $merge_into ) = @_; | |
| 23 | 1 | my $data_section = $pkg->data_section; | |
| 24 | 1 | for my $name ( keys %{$data_section} ) { | |
| 25 | 1 | my ( $chunk, $flavour ) = $name =~ /(.*)\.([^.]*)/; | |
| 26 | 1 | $merge_into->{ $flavour }{ $chunk } = $data_section->{ $name }; | |
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | 3 | 1; | |
| 31 | |||
| 32 | __END__ | ||