<html><head></head><body><div class="ydp44b4e73eyahoo-style-wrap" style="font-family:times new roman, new york, times, serif;font-size:13px;"><div><div dir="ltr" data-setdir="false"><div><div class="ydp9e053380o_h ydp9e053380D_F ydp9e053380em_0 ydp9e053380E_fq7 ydp9e053380ek_BB" data-test-id="address-info"><div class="ydp9e053380D_F ydp9e053380en_0" dir="ltr" data-setdir="false">Hi Folks again.</div><div class="ydp9e053380D_F ydp9e053380en_0" dir="ltr" data-setdir="false"><br></div><div class="ydp9e053380D_F ydp9e053380en_0" dir="ltr" data-setdir="false">I got two answers. Following both solved my problem:</div><div class="ydp9e053380D_F ydp9e053380en_0" dir="ltr" data-setdir="false"><ul><li>Ah Pook pointed out that I should "use YAML::XM", not a naked YAML.</li><li>Dave Cross pointed out that I should be calling LoadFile(), not Load.</li></ul></div><div class="ydp9e053380d_6FIA ydp9e053380i_6FIA ydp9e053380D_F ydp9e053380eo_HB" dir="ltr" data-setdir="false"><span data-test-id="email-pill" class="ydp9e053380D_F ydp9e053380rtlI_dz_sSg"><div dir="ltr" data-setdir="false">The first time I used both, I got this error:</div><div dir="ltr" data-setdir="false"><span>bad tag found for hash: 'tag:clarkevans.com,2002:invoice'</span><br></div><div dir="ltr" data-setdir="false"><span><br></span></div><div dir="ltr" data-setdir="false"><span>That's from the first line in the book's example:<br><span><span style="color: rgb(38, 40, 42); font-family: courier new, courier, monaco, monospace, sans-serif;">--- !<tag:clarkevans.com,2002:invoice></span></span><br></span></div></span></div></div></div>When I commented that out it loaded without a problem. So why is it in the example? For anyone who has that short book (84 pages), it is section 2.5, example 2.27. </div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">But the bottom line for me is that now I'm able to look at the resulting hash. Which will doubtless raise more questions but I'll jump off that bridge when I come to it.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Thanks both and all.</div><div><br></div><div class="ydp44b4e73esignature"><div id="ydp20820ceeyui_3_16_0_ym19_1_1494605358144_25877" style="background-color:rgb(255, 255, 255);font-family:serif;font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif" size="1"><div>+----- Jacob Salomon -- jakesalomon@yahoo.com -------------------------+</div><div>| The first lesson of economics is scarcity: there is never enough of |</div><div>| anything to fully satisfy all those who want it. The first lesson of |</div><div>| politics is to disregard the first lesson of economics. |</div><div>+------------------------------ Thomas Sowell (Is Reality Optional?) --+</div></font></div></div></div>
<div><br></div><div><br></div>
</div><div id="ydpbac800b3yahoo_quoted_8767786514" class="ydpbac800b3yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Wednesday, August 4, 2021, 03:57:31 PM EDT, Jacob Salomon <jakesalomon@yahoo.com> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div id="ydpbac800b3yiv9342162863"><div><div class="ydpbac800b3yiv9342162863ydpa24c9b90yahoo-style-wrap" style="font-family:times new roman, new york, times, serif;font-size:13px;"><div dir="ltr"><div><div>Hi Folks (capitalized! ;-)<br></div></div></div><div dir="ltr"><br></div><div dir="ltr">I'm a member of the ny.pm group, with Jim Keenan. (Just for some identification)</div><div dir="ltr"><br></div><div dir="ltr">In my most recent contract, the team leader (call him Steve) implemented a lot of great stuff using YAML files as a sort of registry for the applications. So now I have the time to play with that stuff and try my own hand at it. I'm using this book as a starting point:</div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px;"><div class="ydpbac800b3yiv9342162863ydpa24c9b90yahoo-style-wrap" style="font-family:times new roman, new york, times, serif;font-size:13px;"><div dir="ltr"><div><div>YAML Ain’t Markup Language (YAML™)</div></div></div></div><div class="ydpbac800b3yiv9342162863ydpa24c9b90yahoo-style-wrap" style="font-family:times new roman, new york, times, serif;font-size:13px;"><div dir="ltr"><div><div>Version 1.2</div></div></div></div><div class="ydpbac800b3yiv9342162863ydpa24c9b90yahoo-style-wrap" style="font-family:times new roman, new york, times, serif;font-size:13px;"><div dir="ltr"><div><div>3rd Edition, Patched at 2009-10-01</div></div></div></div></blockquote><div class="ydpbac800b3yiv9342162863ydpa24c9b90yahoo-style-wrap"><div dir="ltr" style="font-size:13px;font-family:times new roman, new york, times, serif;"><br></div><div dir="ltr" style="font-size:13px;font-family:times new roman, new york, times, serif;">Here's the YAML code I copy/pasted from one of the examples in the book:</div><div dir="ltr" style="font-size:13px;font-family:times new roman, new york, times, serif;">--------------------------------------</div><div dir="ltr"><div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 1 --- !<tag:clarkevans.com,2002:invoice></font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 2 invoice: 34843</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 3 date : 2001-01-23</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 4 bill-to: &id001</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 5 given : Chris</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 6 family : Dumars</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 7 address:</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 8 lines: |</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 9 458 Walkman Dr.</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 10 Suite #292</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 11 city : Royal Oak</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 12 state : MI</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 13 postal : 48046</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 14 ship-to: *id001</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 15 product:</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 16 - sku : BL394D</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 17 quantity : 4</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 18 description : Basketball</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 19 price : 450.00</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 20 - sku : BL4438H</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 21 quantity : 1</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 22 description : Super Hoop</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 23 price : 2392.00</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 24 tax : 251.42</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 25 total: 4443.52</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 26 comments:</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 27 Late afternoon is best.</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 28 Backup contact is Nancy</font></div><div style="font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif"> 29 Billsmer @ 338-4338.</font></div><div style="font-size:13px;font-family:times new roman, new york, times, serif;">--------------------------------------<br></div><div style="font-size:13px;font-family:times new roman, new york, times, serif;" dir="ltr">(I've tried to paste that in Courier font so that the indents stay consistent.)</div><div style="font-size:13px;font-family:times new roman, new york, times, serif;" dir="ltr"><br></div><div style="font-size:13px;font-family:times new roman, new york, times, serif;" dir="ltr">Here is my Perl code:</div><div style="font-size:13px;font-family:times new roman, new york, times, serif;" dir="ltr">----------------------------------------</div><div dir="ltr"><div style="font-size:13px;"><div><font face="courier new, courier, monaco, monospace, sans-serif"> 1 #!/usr/bin/perl -w -d</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif"> 2 # practice1.pl - My first practice yaml code</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif"> 3 #</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif"> 4 use strict;</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif"> 5 use YAML;</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif"> 6 use Data::Dumper;</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif"> 7</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif"> 8 my $yamfile = "./invoice.yaml"; # Play with this one firs</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif"> 9 my $yamlref = Load($yamfile);</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif">10</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif">11 1 == 1; # Just a breakpoint</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif">12 exit 0;</font></div></div><div style="font-size:13px;font-family:times new roman, new york, times, serif;" dir="ltr"><div><div dir="ltr" style="color:rgb(0, 0, 0);font-family:times new roman, new york, times, serif;">----------------------------------------</div><div><br></div><div> (Again, I pasted that in Courier font. But Yahoo mail is not always cooperative.)<br></div></div></div><div style="font-size:13px;font-family:times new roman, new york, times, serif;" dir="ltr"><br></div><div style="font-size:13px;font-family:times new roman, new york, times, serif;" dir="ltr">And what happens when I issue that load call?</div><div dir="ltr"><div><div dir="ltr" style="font-size:13px;font-family:times new roman, new york, times, serif;color:rgb(0, 0, 0);">----------------------------------------</div><div dir="ltr"><div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="1">main::(./practice1.pl:9): my $yamlref = Load($yamfile);</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="1"> DB<1> n</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="1">YAML Error: Expected separator '---'</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="1"> Code: YAML_PARSE_ERR_NO_SEPARATOR</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="1"> Line: 1</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="1"> Document: 2</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="1"> at /usr/share/perl5/YAML/Loader.pm line 78.</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="1"> at /usr/share/perl5/YAML/Mo.pm line 16.</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="1"> YAML::Mo::__ANON__[/usr/share/perl5/YAML/Mo.pm:17](YAML::Loader=HASH(0x1485c30), "YAML_PARSE_ERR_NO_SEPARATOR")</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="1"> called at /usr/share/perl5/YAML/Loader.pm line 78</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="1"> YAML::Loader::_parse(YAML::Loader=HASH(0x1485c30)) called at /usr/share/perl5/YAML/Loader.pm line 24</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="1"> YAML::Loader::load(YAML::Loader=HASH(0x1485c30), "./invoice.yaml") called at /usr/share/perl5/YAML.pm line 33</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="1"> YAML::Load("./invoice.yaml") called at ./practice1.pl line 9</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="1">Debugged program terminated. Use q to quit or R to restart,</font></div><div style="font-size:13px;font-family:times new roman, new york, times, serif;">----------------------------------------<br></div></div></div></div></div><div style="font-size:13px;font-family:times new roman, new york, times, serif;" dir="ltr"><div><div dir="ltr">My searches have turned up lots of similar problems but no solution I could easily grok. Can someone please point out what I'm doing wrong in the Yaml? I may have pasted something incorrectly but the --- separator is there at the top.</div><div dir="ltr"><br></div><div dir="ltr">BTW I have tried:</div><div dir="ltr"><ul dir="ltr"><li>Moving that <tag> to another line</li><li>Commenting out that <tag> altogether</li><li>Adding --- separator at the bottom of the YAML file</li><li>Adding ... there instead of the ---</li></ul><div dir="ltr">None of these fixed the <span><span style="color:rgb(0, 0, 0);font-family:courier new, courier, monaco, monospace, sans-serif;font-size:x-small;">"YAML_PARSE_ERR_NO_SEPARATOR"</span></span> error.</div></div><div dir="ltr"><br></div><div dir="ltr" style="color:rgb(0, 0, 0);font-family:times new roman, new york, times, serif;"><div></div></div></div></div><div style="font-size:13px;font-family:times new roman, new york, times, serif;" dir="ltr">I may post this on Perlmonks as well (I see it is addressed there) but I don't yet want to advertise my incompetence that widely. :-))</div><div style="font-size:13px;font-family:times new roman, new york, times, serif;" dir="ltr"><br></div><div style="font-size:13px;font-family:times new roman, new york, times, serif;" dir="ltr">Thanks much for any help here.</div></div><div style="font-size:13px;font-family:times new roman, new york, times, serif;"><br></div></div></div><div class="ydpbac800b3yiv9342162863ydpa24c9b90signature" style="font-size:13px;font-family:times new roman, new york, times, serif;"><div id="ydpbac800b3yiv9342162863ydp20820ceeyui_3_16_0_ym19_1_1494605358144_25877" style="background-color:rgb(255, 255, 255);font-family:serif;font-size:13px;"><font face="courier new, courier, monaco, monospace, sans-serif" size="1"><div>+----- Jacob Salomon --------------------------------------------------+</div><div>| The first lesson of economics is scarcity: there is never enough of |</div><div>| anything to fully satisfy all those who want it. The first lesson of |</div><div>| politics is to disregard the first lesson of economics. |</div><div>+------------------------------ Thomas Sowell (Is Reality Optional?) --+</div></font></div></div></div></div></div></div>
</div>
</div></body></html>