Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by kcott (Bishop)
on Mar 15, 2014 at 05:46 UTC ( #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? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2022-05-20 17:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (75 votes). Check out past polls.

    Notices?