in reply to Re^2: Problem with creating Files (maybe)
in thread Problem with creating Files

I was thinking of such solution, but I simply do not know where to put that path of code.

put it in createButtons, the part that prints links, we're talking about createButtons, right?

if none of the files exist yet , causing createButtons to be mostly fakeLink, just run the program twice  DoIt(); DoIt(); on first run, lots of the links will be wrong, but on the second run, the links will be right

I hope this code won't confuse you.

The code isn't confusing :) but seems to be missing JSON

Replies are listed 'Best First'.
Re^4: Problem with creating Files (maybe)
by David92 (Sexton) on Jul 25, 2014 at 10:17 UTC
    I cannot use JSON as we do not have web server. Everything has to be done locally. JSON-P unfourtanetly didnt work also, so I went for the HASH filling option.

    if nothing else, I got too confused in everything. How sould the part if exist look like?

    I understand why it needs a second run as in the first run, the first HTML's will always say that file does not exist, but later on, it will.

    Sorry for my stupidness, but if you tell me what should I write, it'll save me.

     if(-e $filename){ print ....} else { ..?}

    That's how I would do it. Can you please corect me?

      Sorry for my stupidness, but if you tell me what should I write, it'll save me.

      Write more subs , debug small subs, write more subs ... easier to trace ... like this

      Once you get more of these you're realize you probably want to have createButtons return a string or array of strings so fillFile instead of using  createButtons( $outfile, $filename ); would use  print $outfile createButtons( $filename );