Subject: | select method not selecting other folders besides INBOX |
I found this error in Net-IMAP-Simple-0.102 package. The select method won't select other folders beside INBOX. Here is my diff that got the code to work:
*** Simple.pm Sat Jun 25 03:37:01 2005
--- Simple.pm.fixed Sat Jul 9 14:43:29 2005
***************
*** 201,211 ****
sub select {
my ( $self, $mbox ) = @_;
! $self->{working_box} = $mbox if $mbox;
! $mbox = 'INBOX';
!
! $self->{working_box} ||= $mbox;
if($self->{use_select_cache} && (time - $self->{BOXES}->{ $mbox }->{proc_time}) <= $self->{select_cache_ttl}){
return $self->{BOXES}->{$mbox}->{messages};
--- 201,209 ----
sub select {
my ( $self, $mbox ) = @_;
! $mbox = 'INBOX' unless $mbox;
! $self->{working_box} = $mbox;
if($self->{use_select_cache} && (time - $self->{BOXES}->{ $mbox }->{proc_time}) <= $self->{select_cache_ttl}){
return $self->{BOXES}->{$mbox}->{messages};
The original code statically sets $mbox to INBOX. Later in the code, the folder $mbox is selected.
My modification sets $mbox to INBOX if $mbox isn't defined. The object attribute working_box is then set to the value of $mbox.
Best wishes,
Jonathan B. Glatt
P.S. Thanks for writing this nice package.
*** Simple.pm Sat Jun 25 03:37:01 2005
--- Simple.pm.fixed Sat Jul 9 14:43:29 2005
***************
*** 201,211 ****
sub select {
my ( $self, $mbox ) = @_;
! $self->{working_box} = $mbox if $mbox;
! $mbox = 'INBOX';
!
! $self->{working_box} ||= $mbox;
if($self->{use_select_cache} && (time - $self->{BOXES}->{ $mbox }->{proc_time}) <= $self->{select_cache_ttl}){
return $self->{BOXES}->{$mbox}->{messages};
--- 201,209 ----
sub select {
my ( $self, $mbox ) = @_;
! $mbox = 'INBOX' unless $mbox;
! $self->{working_box} = $mbox;
if($self->{use_select_cache} && (time - $self->{BOXES}->{ $mbox }->{proc_time}) <= $self->{select_cache_ttl}){
return $self->{BOXES}->{$mbox}->{messages};