Urgent! I Can't write data via agi!

Ok, after playing around wtih sqlite i’ve moved onto a few other ways to read/write the data im using with agi, only problem is no matter what means I use i’ve found that perl cannot open a file and write to it, even using open, i’ve been using the example below for testing, the open statment fails BUT using touch seems to work.

#!/usr/bin/perl

open(OUT,">/etc/asterisk/test.file");
print OUT "weeee\n";
close(OUT);
`touch /etc/asterisk/bob.file`;

Help!

You may need to clarify the problem a bit. Is Asterisk running as root? How do you know it’s the open statement that failed? Have you tested the script from an escaped shell? I ran an almost identical AGI (Asterisk as root) and it was successful.

[quote=“valley”]You may need to clarify the problem a bit. Is Asterisk running as root?
[/quote]

Dear lord no, it has it’s own user, all the files in question are owned by that user and i’ve set permisisons on them to 777 for now,

[quote=“valley”]
How do you know it’s the open statement that failed? Have you tested the script from an escaped shell? I ran an almost identical AGI (Asterisk as root) and it was successful.[/quote]

The open statment should create the file and place the string “weee” in it, it does not, any attempt to gain write access to any file using any perl related means fails, the sqlite drive can read but not write, i can open files and read from them and again, not write but external pre-compiled commands will happily write to files (which is what the “touch” test is for), also if i call a perl script from within the agi it also fails but again if i run the script from the command line it works perfectly ad both the asterisk user and root.

For now i’ve found a usable workaround, I’m using DBI::Proxy and DBI::ProxyServer to access the SQLite database but id quite like to use the SQLite database directly (though the DBI::ProxyServer method is quite light weight).