87 |
my $sub_nr = 0; |
my $sub_nr = 0; |
88 |
my $email_body; |
my $email_body; |
89 |
|
|
90 |
|
my $home_dir=$ENV{'HOME'}; |
91 |
|
$home_dir = '/tmp' if (! -w $home_dir); |
92 |
|
|
93 |
if ($email) { |
if ($email) { |
94 |
# It will use (and require) Tie::File only if --email=foo@bar.com |
# It will use (and require) Tie::File only if --email=foo@bar.com |
95 |
# arguement is used! |
# arguement is used! |
96 |
use Tie::File; |
use Tie::File; |
97 |
tie @subjects, 'Tie::File', "$basedir/subjects.txt" || xlog("CONFIG","Can't find $basedir/subjects.txt... using default (only one)"); |
tie @subjects, 'Tie::File', "$basedir/subjects.txt" || xlog("CONFIG","Can't find $basedir/subjects.txt... using default (only one)"); |
98 |
chdir; # this will change directory to HOME |
chdir; # this will change directory to HOME |
99 |
if (open(SN,".psinib.subject")) { |
if (open(SN,"$home_dir/.psinib.subject")) { |
100 |
$sub_nr = <SN>; |
$sub_nr = <SN>; |
101 |
chomp($sub_nr); |
chomp($sub_nr); |
102 |
close(SN); |
close(SN); |
108 |
} |
} |
109 |
$sub_nr = 0 if (! $subjects[$sub_nr]); |
$sub_nr = 0 if (! $subjects[$sub_nr]); |
110 |
|
|
111 |
if (open(SN,"> .psinib.subject")) { |
if (open(SN,"> $home_dir/.psinib.subject")) { |
112 |
print SN "$sub_nr\n"; |
print SN "$sub_nr\n"; |
113 |
close (SN); |
close (SN); |
114 |
} else { |
} else { |
115 |
xlog("CONFIG","Can't open .psinib.subject -- I can't cycle subjects..."); |
xlog("CONFIG","Can't open $home_dir/.psinib.subject -- I can't cycle subjects..."); |
116 |
}; |
}; |
117 |
} |
} |
118 |
|
|