Sha256: d6eb19e0290da2ae11fd716184276a870d84863a9a7812483d658d87f6b6fe17

Contents?: true

Size: 1.49 KB

Versions: 2

Compression:

Stored size: 1.49 KB

Contents

use strict;
use warnings;
package YAML::PP::Perl;

our $VERSION = 'v0.38.0'; # VERSION

use base 'Exporter';
use base 'YAML::PP';
our @EXPORT_OK = qw/ Load Dump LoadFile DumpFile /;

use YAML::PP;
use YAML::PP::Schema::Perl;

sub new {
    my ($class, %args) = @_;
    $args{schema} ||= [qw/ Core Perl /];
    $class->SUPER::new(%args);
}

sub Load {
    my ($yaml) = @_;
    __PACKAGE__->new->load_string($yaml);
}

sub LoadFile {
    my ($file) = @_;
    __PACKAGE__->new->load_file($file);
}

sub Dump {
    my (@data) = @_;
    __PACKAGE__->new->dump_string(@data);
}

sub DumpFile {
    my ($file, @data) = @_;
    __PACKAGE__->new->dump_file($file, @data);
}

1;

__END__

=pod

=encoding utf-8

=head1 NAME

YAML::PP::Perl - Convenience module for loading and dumping Perl objects

=head1 SYNOPSIS

    use YAML::PP::Perl;
    my @docs = YAML::PP::Perl->new->load_string($yaml);
    my @docs = YAML::PP::Perl::Load($yaml);

    # same as
    use YAML::PP;
    my $yp = YAML::PP->new( schema => [qw/ Core Perl /] );
    my @docs = $yp->load_string($yaml);

=head1 DESCRIPTION

This is just for convenience. It will create a YAML::PP object using the
default schema (C<Core>) and the L<YAML::PP::Schema::Perl> schema.

See L<YAML::PP::Schema::Perl> for documentation.

=head1 METHODS

=over

=item Load, Dump, LoadFile, DumpFile

These work like the functions in L<YAML::PP>, just adding the C<Perl> schema.

=item new

Constructor, works like in L<YAML::PP>, just adds the C<Perl> schema to the
list of arguments.

=back

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.5.10 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/YAML/PP/Perl.pm
javonet-ruby-sdk-2.5.10 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/deps/lib/perl5/YAML/PP/Perl.pm