Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: write_file to_json in Dancer app

by GertMT (Friar)
on Feb 05, 2014 at 11:06 UTC ( #1073546=note: print w/replies, xml ) Need Help??


in reply to Re^2: write_file to_json in Dancer app
in thread write_file to_json in Dancer app

updating the code between the comment lines to the code I mention below makes that the data is been written to a 'json' file. Not very clever code yet as the data gets overwritten every time you run the script but that is a separate issue.
#-------v this does work --------# my $filename = "testme.json"; my $json = -e $filename ? read_file $filename : '{}'; my $data = from_json $json; $data = \@photos; write_file $filename, to_json($data);

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2021-10-15 21:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (69 votes). Check out past polls.

    Notices?