Re: saving geometry to disk on window resize
- From: Joe Smith <jes martnet com>
- To: gtk-perl-list gnome org
- Subject: Re: saving geometry to disk on window resize
- Date: Fri, 12 Mar 2004 14:23:45 -0500
muppet wrote:
this works for me...
# load from disk if it exists.
if (-f 'saved') {
eval join "", `cat saved`;
}
I know it's only an example, but that probably ought to have a warning
label. You hope that the contents of 'saved' never looks like:
system('rm -rf $HOME')
Ok, we all know that. Eval'ing stuff in a file is a cliche-level gotcha.
Is there a simple way to save/restore stuff like this in a relatively
safe way, without a lot of hassle? Here's a shot at just printing the
data and reading it back:
# load from disk if it exists.
if (-f 'saved') {
my @pos = split(/\s+/, `head -1 saved`, 8);
# probably should sanity check @pos before we do this ,,,
%$pos = @pos;
}
...
print OUT "@{[%$pos]}\n";
That's not too bad - anyone have something better?
Examples really shouldn't include unexploded ordinance.
<Joe
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]