NAME
Hades::Macro::YAML - Hades macro helpers for YAML
VERSION
Version 0.01
SYNOPSIS
Quick summary of what the module does:
Hades->run({
eval => q|
macro {
YAML
}
Kosmos {
geras $file :t(Str) :d('path/to/file.yml') {
€yaml_load_file($file);
}
}
|;
});
... generates ...
package Kosmos;
use strict;
use warnings;
use YAML::XS;
our $VERSION = 0.01;
sub new {
my ( $cls, %args ) = ( shift(), scalar @_ == 1 ? %{ $_[0] } : @_ );
my $self = bless {}, $cls;
my %accessors = ();
for my $accessor ( keys %accessors ) {
my $param
= defined $args{$accessor}
? $args{$accessor}
: $accessors{$accessor}->{default};
my $value
= $self->$accessor( $accessors{$accessor}->{builder}
? $accessors{$accessor}->{builder}->( $self, $param )
: $param );
unless ( !$accessors{$accessor}->{required} || defined $value ) {
die "$accessor accessor is required";
}
}
return $self;
}
sub geras {
my ( $self, $file ) = @_;
$file = defined $file ? $file : 'path/to/file.yml';
if ( !defined($file) || ref $file ) {
$file = defined $file ? $file : 'undef';
die qq{Str: invalid value $file for variable \$file in method geras};
}
YAML::XS::LoadFile($file);
}
1;
SUBROUTINES/METHODS
new
Instantiate a new Hades::Macro::YAML object.
Hades::Macro::YAML->new
yaml_load_string
call yaml_load_string method. Expects param $mg to be a Object, param $str to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->yaml_load_string($mg, $str, $param, $list)
_yaml_load_string_YAML
call _yaml_load_string_YAML method. Expects param $mg to be a Object, param $str to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->_yaml_load_string_YAML($mg, $str, $param, $list)
_yaml_load_string_YAML_XS
call _yaml_load_string_YAML_XS method. Expects param $mg to be a Object, param $str to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->_yaml_load_string_YAML_XS($mg, $str, $param, $list)
_yaml_load_string_YAML_PP
call _yaml_load_string_YAML_PP method. Expects param $mg to be a Object, param $str to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->_yaml_load_string_YAML_PP($mg, $str, $param, $list)
yaml_load_file
call yaml_load_file method. Expects param $mg to be a Object, param $file to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->yaml_load_file($mg, $file, $param, $list)
_yaml_load_file_YAML
call _yaml_load_file_YAML method. Expects param $mg to be a Object, param $file to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->_yaml_load_file_YAML($mg, $file, $param, $list)
_yaml_load_file_YAML_XS
call _yaml_load_file_YAML_XS method. Expects param $mg to be a Object, param $file to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->_yaml_load_file_YAML_XS($mg, $file, $param, $list)
_yaml_load_file_YAML_PP
call _yaml_load_file_YAML_PP method. Expects param $mg to be a Object, param $file to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->_yaml_load_file_YAML_PP($mg, $file, $param, $list)
yaml_write_string
call yaml_write_string method. Expects param $mg to be a Object, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->yaml_write_string($mg, $content, $param, $list)
_yaml_write_string_YAML
call _yaml_write_string_YAML method. Expects param $mg to be a Object, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->_yaml_write_string_YAML($mg, $content, $param, $list)
_yaml_write_string_YAML_XS
call _yaml_write_string_YAML_XS method. Expects param $mg to be a Object, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->_yaml_write_string_YAML_XS($mg, $content, $param, $list)
_yaml_write_string_YAML_PP
call _yaml_write_string_YAML_PP method. Expects param $mg to be a Object, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->_yaml_write_string_YAML_PP($mg, $content, $param, $list)
yaml_write_file
call yaml_write_file method. Expects param $mg to be a Object, param $file to be a Str, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->yaml_write_file($mg, $file, $content, $param, $list)
_yaml_write_file_YAML
call _yaml_write_file_YAML method. Expects param $mg to be a Object, param $file to be a Str, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->_yaml_write_file_YAML($mg, $file, $content, $param, $list)
_yaml_write_file_YAML_XS
call _yaml_write_file_YAML_XS method. Expects param $mg to be a Object, param $file to be a Str, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->_yaml_write_file_YAML_XS($mg, $file, $content, $param, $list)
_yaml_write_file_YAML_PP
call _yaml_write_file_YAML_PP method. Expects param $mg to be a Object, param $file to be a Str, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
$obj->_yaml_write_file_YAML_PP($mg, $file, $content, $param, $list)
ACCESSORS
macro
get or set macro.
$obj->macro;
$obj->macro($value);
AUTHOR
LNATION, <email at lnation.org>
BUGS
Please report any bugs or feature requests to bug-hades::macro::yaml at rt.cpan.org
, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hades-Macro-YAML. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Hades::Macro::YAML
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
This software is Copyright (c) 2020 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 707:
Non-ASCII character seen before =encoding in '€yaml_load_file($file);'. Assuming UTF-8