Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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 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 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 line 16.".

Replies are listed 'Best First'.
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 (Curate) 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://981982]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2018-06-20 14:12 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (116 votes). Check out past polls.