Re: Re: Can't use string ("MODULE") as a HASH ref while "strict refs" in use
M M <[email protected]> Tue, 10 Aug 2004 15:14:13 -0400
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Message-ID | <[email protected]> |
Hi there ! I got a solution from the one of the PerlMonks (http://perlmonks.org/index.pl?node_id=381656). Apparently, the problem is that create() does not return an object, (even though the docs claim it's a constructor). To work around the problem: Mail::Box::Mbox->create($foldername, access => 'rw'); my $folder = Mail::Box::Mbox->new(folder => $foldername); mm. On Tue, 10 Aug 2004 13:53:05 -0400, M M <[email protected]> wrote: > VERSION: > I:\>perl --version > > This is perl, v5.8.4 built for MSWin32-x86-multi-thread > (with 3 registered patches, see perl -V for more detail) > > Copyright 1987-2004, Larry Wall > > Binary build 810 provided by ActiveState Corp. http://www.ActiveState.com > ActiveState is a division of Sophos. > Built Jun 1 2004 11:52:21 > > Mail::Box VERSION: 2.056 (from Mbox.pm) I just installed it this morning. > > Thanks for responding. > > Madhu > > > > > On Tue, 10 Aug 2004 13:45:59 -0400, David A Golden <[email protected]> wrote: > > What version of Perl and what version of Mail::Box are you using? > > > > David > > > > > > > > At 8/10/2004 01:39 PM, M M wrote: > > >Hi there ! > > > > > > > > >I did post this to perlmonks and someone suggested I try this > > >mail-list. I am trying to write a simple program to add some messages > > >to an MBOX. Here is my code: > > >------------------ > > >use strict; use English; use warnings; > > > > > >use Mail::Box::Mbox; > > > > > >my $foldername = 'test.mbox'; > > >my $folder = Mail::Box::Mbox->create($foldername, access => 'rw'); > > > > > >my $msg; > > >my $n =4; > > > > > >while ($n--) { > > > > > >my $msg = Mail::Box::Message->build(From => 'me', data => "Message > > >$n\n only two\nlines\n---\n"); > > > > > > $msg->print; > > >$folder->addMessage( $msg ); > > >} > > > > > >Here is the error I get: > > > > > >Can't use string ("Mail::Box::Mbox") as a HASH ref while "strict refs" > > >+ in use at I:/Perl/site/lib/Mail/Box.pm line 816. > > >--------------------- > > >Thanks ! > > > > > >P.S. I have attached the perl source in case the formatting is screwed up. > > > > > >Thanks ! > > > > >