The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Config::Apple::Profile::Payload::Tie::Dict - Tying class for dictionaries of things.

DESCRIPTION

This class is used to store a dictionary (a dict) of things. Exactly what things are being stored is specified at the time the tie is made.

There are several payload types that contain dicts of things. For example, if you have a Wi-Fi network that uses WPA- or WPA2-Enterprise, then some form of EAP will be used, and the EAP parameters are stored in a dictionary.

This class is used by payload classes to represent a dictionary.

"CLASS" METHODS

tie %hash, 'Config::Apple::Profile::Payload::Tie::Dict', $validator

When this class is tied to an hash, TIEHASH will be called, with the class name as the first argument.

$validator is a reference to a function that will be able to validate values that are stored in the dict. The validator will be passed the value as the only parameter, and an untained value is expected as the return value. If undef is returned by the validator, then the value was invalid, and the store attempt will fail.

It is suggested that the functions from Config::Apple::Profile::Payload::Types::Validation be used.

If $validator is not a valid coderef then an exception will be thrown.

FETCH

Works as one would expect with a Perl hash. Returns the entry matching the specified key.

STORE

Works almost as one would expect with a Perl hash. Stores a value at the specified key. The value will only be stored if it is valid; otherwise an exception will be thrown. undef is not a valid value to store.

delete

Works as one would expect with a Perl hash. Deletes the specified key from the hash.

clear

Works as one would expect with a Perl hash. Deletes all keys from the hash.

exists

Works as expected for a Perl hash. Returns true if the specified key exists in the hash.

FIRSTKEY

Used as part of keys() and each(). Works as expected for a Perl hash. Returns the first key in the hash.

NEXTKEY

Used as part of keys() and each(). Works as expected for a Perl hash. Returns the next key in the hash.

scalar

Works as expected, returning the number of keys in the hash.

ACKNOWLEDGEMENTS

Refer to Config::Apple::Profile for acknowledgements.

AUTHOR

A. Karl Kornel, <karl at kornel.us>

COPYRIGHT AND LICENSE

Copyright © 2014 A. Karl Kornel.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.