The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Chart::GGPlot::Params - Collection of key-value pairs used in Chart::GGPlot

VERSION

version 0.002003

DESCRIPTION

This class provides a duck typing interface similar as Data::Frame::Autobox::HashRef, and adds a mechanism to its derived classes to allow customize aliasing of hash keys by overriding the transform_key classmethod.

CLASS METHODS

transform_key

    transform_key($key)

Derived classes can override this classmethod to have their own way of renaming the keys.

METHODS

length

    length()

Returns the count of keys.

exists

    exists($key)

Tests if a key exists.

keys

    keys()

Return an array ref of keys.

names

    names()

This is an alias of the keys() method.

values

    values()

Return an array ref of values.

isempty

    isempty()

Return a boolean value if length is 0.

delete

    delete($key)

Delete a key.

set

    set($key, $value)

Associate a value with a key and return the value.

at

    at($key)

Get associated value of the given key.

flatten

    flatten()

Returns an array.

hslice

    hslice($keys)

slice

    slice($keys)

This is an alias of hslice.

kv

    kv()

Return a list of a value with a key and return the value.

merge

    merge($other, $skip_undef=false)

Returns a new object with right precedence shallow merging. If $skip_undef is true, kv with undef value in $other would be skipped.

    my $merged = $params->merge($other);

defaults

    defaults($other)

Using data from $other as defaults. If $other is undef, returns a clone of $self.

rename

    rename($href_or_coderef)

Returns a new object.

    my $p2 = $p1->rename( { $from_key => $to_key, ... } );
    my $p3 = $p1->rename( sub { my ($old_key) = @_; ... return $new_key; } );

as_hashref

    as_hashref()

Returns a hashref.

copy

    copy()

clone

    clone()

This is same as the copy() method.

SEE ALSO

Data::Frame::Autobox::HashRef, Chart::GGPlot::Aes

AUTHOR

Stephan Loyd <sloyd@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019-2023 by Stephan Loyd.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.