[riscosweb] Re: Creating a blog in perl

  • From: Mik Towse <mik.towse@xxxxxxxxx>
  • To: riscosweb@xxxxxxxxxxxxx
  • Date: Sun, 18 Oct 2009 15:30:25 +0100

In article <4ADB2420.10601@xxxxxxxxxxxxxxxx> Mark Syder  wrote:
> Not strictly RISC OS related, but it's been quiet here lately and I 
> think we should allow questions to be a little more general just to keep 
> the group alive.
I agree!

> I've been trying to create a blog-creation program in perl but can't 
> open a file for writing. The script is in the cgi-bin directory and the 
> blog in the blog directory. The first thing the script does is copy the 
> old blog to blogyyyymmdd, which works. I have then tried to open a new 
> file with:
> 
> open(BLOGFILE, ">../blog/newblog.txt") || Error('open', 'file');
I assume you have a line something like...

        local *BLOGFILE;

> but it didn't work, so I tried with:
> 
> my $newfile="../blog/newblog.txt";
> open(BLOGFILE, ">$newfile") || Error('open', 'file');
> 
> which also didn't work.
But what actually happens? Or doesn't!

Could it be that after the copy, the pointer is still pointing to the old
file & won't allow you to access it?

After the copy, do you need the original to be empty? If so, have you tried
deleting it before you open it as a new file?

> I considered permissions (but thought inadequate permissions would have 
> prevented the copy from working) and changed the blog directory to 
> universal write permissions (just as an experiment - I changed it back 
> afterwards). Still no joy.
> 
> Anyone any ideas?
There are a few such progs 'out there'. If they are written in PERL you may
be able to look at their code.

-- 
Mik Towse * mik.towse@xxxxxxxxx * http://www.xemik.co.uk/
My writers' site can be found at: http://www.lexis.org.uk

xemik.net - cost effective web hosting : http://xemik.net

Does history record any case where a majority was right?

Other related posts: