Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: What's the best way to use Any YAML (not YAML::Any)

by kcott (Archbishop)
on Mar 15, 2014 at 05:46 UTC ( [id://1078423]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    BEGIN {
        my @yaml_classes = qw{YAML::XS YAML::Syck YAML::Tiny YAML};
        first { eval "use $_; 1" } @yaml_classes
            or die "Unable to load any of these YAML classes: @yaml_classe
    +s";
    }
    
  2. or download this
    Unable to load any of these YAML classes: YAML::XS YAML::Syck YAML::Ti
    +ny YAML at ...
    BEGIN failed--compilation aborted at ...
    
  3. or download this
    my $yaml_class;
    BEGIN {
    ...
            or die "Unable to load any of these YAML classes: @yaml_classe
    +s";
    }
    print $yaml_class;
    
  4. or download this
    BEGIN {
        # YAML classes to attempt to load (in order of preference)
    ...
            or die "Unable to load any of these YAML classes: @yaml_classe
    +s",
                    " (using import list: @yaml_imports)";
    }
    
  5. or download this
    BEGIN {
        my @yaml_classes = qw{YAML::XS YAML::Syck YAML::Tiny YAML};
    ...
        my %yaml_exports = map { $_ => 1 } @{$yaml_class . "::EXPORT"};
        $yaml_exports{$_} or die "$yaml_class doesn't export '$_'" for @ya
    +ml_funcs;
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1078423]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-25 11:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found