Embedix::ECD::Util - miscellaneous stuff


Embedix-ECD documentation Contained in the Embedix-ECD distribution.

Index


Code Index:

NAME

Top

Embedix::ECD::Util - miscellaneous stuff

SYNOPSIS

Top

import interesting stuff into your namespace

    use Embedix::ECD::Util qw(indent %default @attribute_order)

DESCRIPTION

Top

In this module are things that didn't quite fit anywhere else. I hope to keep the contents of this module to a minimum.

COPYRIGHT

Top

AUTHOR

Top

John BEPPU <beppu@lineo.com>


Embedix-ECD documentation Contained in the Embedix-ECD distribution.

package Embedix::ECD::Util;

use Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(indent unindent_and_aggregate %default @attribute_order);

#_______________________________________
sub indent {
    my $n  = shift() - 1;
    my $sw = shift;
    if ($n  < 0) { $n  = 0 }
    if ($sw < 0) { $sw = 0 }
    return " " x ($n * $sw);
}

#_______________________________________
sub unindent_and_aggregate {
    my $s;
    $s = shift;
    $s =~ s/\s*$//; # the beginning is already trimmed
    return [ 
        map { s/^\s*//; s/\s*$//; $_ } 
        grep { $_ !~ /^\s*#/ }
        split ("\n", $s) 
    ];
}

# misc configuration
#_______________________________________
%Embedix::ECD::Util::default = (
    shiftwidth => 2,
    indent     => 0,
);

# write attributes in this order
#_______________________________________
@Embedix::ECD::Util::attribute_order = qw(
    help
    prompt
    license

    specpatch
    srpm
    build_vars

    type
    default_value
    value
    range
    choicelist
    if

    static_size
    min_dynamic_size
    storage_size
    startup_time

    conflicts
    provides
    requires
    requiresexpr
    keeplist
    trideps
);

1;

__END__