Heray-Was-Here
Server : Apache
System : Linux vps43555.mylogin.co 3.10.0-1160.53.1.vz7.185.3 #1 SMP Tue Jan 25 12:49:12 MSK 2022 x86_64
User : redsea ( 60651)
PHP Version : 7.4.32
Disable Function : NONE
Directory :  /usr/local/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/bin/yamlpp-events
#!/usr/bin/perl
use strict;
use warnings;

use Encode;
use YAML::PP::Parser;
use YAML::PP::Common;
use Getopt::Long;
Getopt::Long::Configure('bundling');
GetOptions(
    'help|h' => \my $help,
    'module|M=s' => \my $module,
) or usage(1);

usage(0) if $help;

$module ||= 'YAML::PP';
if ($module eq 'YAML::PP') {
    $module = 'YAML::PP::Parser';
}
elsif ($module eq 'YAML::PP::LibYAML') {
    require YAML::PP::LibYAML::Parser;
    $module = 'YAML::PP::LibYAML::Parser';
}

my ($file) = @ARGV;

my $parser = $module->new(
    receiver => sub {
      my ($self, undef, $event) = @_;
      print encode_utf8(YAML::PP::Common::event_to_test_suite($event, { flow => 1 })), "\n";
    },
    $file ? (reader => YAML::PP::Reader::File->new) : (),
);
if ($file) {
    $parser->parse_file($file);
}
else {
    my $yaml;
    $yaml = do { local $/; <STDIN> };
    $yaml = decode_utf8($yaml);
    $parser->parse_string($yaml);
}

sub usage {
    my ($rc) = @_;
    print <<"EOM";
Usage:

    $0 [options] < file
    $0 [options] file

Options:
    --module -M  Module to use for parsing. YAML::PP (default) or YAML::PP::LibYAML
EOM
    exit $rc;
}

Hry