Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Stucked in YAML::Tiny

by ckj (Chaplain)
on Jul 16, 2012 at 07:28 UTC ( #981982=note: print w/ replies, xml ) Need Help??


in reply to Re: Stucked in YAML::Tiny
in thread Stucked in YAML::Tiny

On using LoadFile instead of read, it gives:

"Failed to load YAML document from 'YAML::Tiny' at yaml_test.pl line 7 +"
UPDATE The same code is working fine on unix machine, while on windows it's giving the same error. Not getting exactly what is the reason behind this. I checked Tiny.pm but there also nothing was found. Perl code:
use strict; use warnings; use YAML::Tiny; use Data::Dumper; # Create a YAML file my $yaml = YAML::Tiny->new; # Open the config $yaml = YAML::Tiny->read( 'test.yaml' ); #changing yaml file $yaml->[0]->{'order.create'}->{domain} = 'ckjckcjckj'; # Save the file $yaml->write('test.yaml');
Yaml File:
--- order.create: domain: sdfsdfsdfsdf
The same code works in unix but gives error in windows "Can't call method "write" on unblessed reference at yaml_test.pl line 16.".


Comment on Re^2: Stucked in YAML::Tiny
Select or Download Code
Re^3: Stucked in YAML::Tiny
by moritz (Cardinal) on Jul 16, 2012 at 08:39 UTC
Re^3: Stucked in YAML::Tiny
by aitap (Deacon) on Jul 16, 2012 at 10:14 UTC
    In my code I use use YAML qw{LoadFile}, and it works fine on both Windows and *nix. YAML file example:
    --- version: 0.11 greek: - greek_plain - greek_italic csr: FontStyle: Italic: italic Position: Subscript: sub Superscript: sup gs: - EPS - PDF
    Can you try running perl debugger on your code and using s command after LoadFile call shows up to trace code inside LoadFile?
    Sorry if my advice was wrong.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2014-12-25 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (163 votes), past polls