Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Perlscript
➜ Saving files
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Somec
(8 posts) Bio
|
Date
| Sat 03 Jan 2004 04:42 AM (UTC) |
Message
| Here's my save function:
sub __save {
my ($filename) = $_[0];
unless(open(OUT, ">$filename")) {
output("Cannot open $filename: $!");
return;
}
print OUT $area_name . "\n";
foreach (@area) {
print OUT &__room_save($_) . "\n";
}
close OUT;
return 1;
}
The output function just calls $world->note, and &__room_save saves a room.
I tested it out beforehand through the command line, and it saved the file perfectly. When I try to save when it's running as a PerlScript, everything returns correctly, but nothing is ever written.
I understand that there may be limitations on scripts that make them unable to read/write files... But, is there a way around this without having to open a log file and writing to it (if that will even work at all)?
Does this mean that the script can't read files either? Is there a workaround to reading files? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 03 Jan 2004 06:12 AM (UTC) |
Message
| You are pushing my knowledge of Perlscript here. I believe there are such things as limits on what scripts can do (ala read/write files) and there are also ways of disabling those limits, but I don't know what they are for Perlscript. Maybe browse the Perlscript site. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Somec
(8 posts) Bio
|
Date
| Reply #2 on Sat 03 Jan 2004 07:19 AM (UTC) |
Message
| Woah, I just tried it out again, and it's starting to save now. I haven't rebooted or anything, but maybe closing MUSHClient did it.
Hopefully this'll continue to work... | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
10,912 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top