Subject: | Modification of non-creatable array value attempted, subscript -1 at /usr/lib64/perl5/site_perl/5.8.8/Net/IMAP/Client.pm line 808. |
Date: | Fri, 16 Jul 2010 15:30:11 -0700 |
To: | bug-Net-IMAP-Client [...] rt.cpan.org |
From: | Hawk ExploreTalent <hawkexploretalent [...] gmail.com> |
Y'all,
I'm using this library correctly, and occasionally I get this fatal error:
Modification of non-creatable array value attempted, subscript -1 at
/usr/lib64/perl5/site_perl/5.8.8/Net/IMAP/Client.pm line 808, <GEN109> line
12.
It takes the 'timeout' value to occur. Let me explain...
First, I open a connection to the source mail server, login, select a
folder, etc. All good.
Next, I open a connection to the target mail server, login (same
username/password), select the same folder... all good. No problems thus
far.
Next, I loop through all messages in the source mail server and append()
them to the target mail server. Actually, I have a check in here which
compares headers, and if they are different, then it appends the new
messages. This is to prevent writing the same emails over and over again to
the target server. All good.
During this loop, I'll occasionally get to a point where my script stops.
After waiting the 'timeout' time period (90 seconds, or 120 seconds, or
whatever I have it set to), then I'll get the fatal error above. The line
808 is:
push @{$lineparts->[-1]}, $res;
in _tell_imap. If I wrap this line in an eval to trap the fatal error and
issue it as a warning, I seem to be in an infinite loop. My script waits
for the value of timeout, then issues the error, then waits, then errors...
over and over again.
The worst part about this is that, for some email accounts, the error never
happens. But for the one I'm on now, I can reproduce the error every time.
What is a good solution to this fatal error?
-Hawk