Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Email-Delete CPAN distribution.

Report information
The Basics
Id: 56786
Status: rejected
Priority: 0/
Queue: Email-Delete

People
Owner: Nobody in particular
Requestors: lifefeed [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.001
Fixed in: (no value)



Subject: Email::Delete->delete_message(...) causes an error
Summary Using Email::Delete->delete_message(...) is broken. It can be fixed by checking if the first argument to delete_message is a package name. Details: Normally delete_message is used like this: use Email::Delete qw/delete_message/; delete_message( from => $mailbox, matching => sub { 1; }, ); But if you use it like this: use Email::Delete; Email::Delete->delete_message( from => $mailbox, matching => sub { 1; }, ); Then it causes an error down the line. It's because the delete function looks like: sub delete_message { my %args = @_; In our use case, the first value in @_ is the package name, which is given to %args as a key (which has the value "from"), screwing up the whole order, and producing an uneven hash. I think it can be fixed by adding this one line: sub delete_message { shift if $_[0] eq __PACKAGE__; my %args = @_; (Email-Delete-2.001, Perl 5.8.4, Linux 2.6.9)
It's a function, not a method. Don't call it as a method. Nothing, as far as I can tell, is documenting it as a method. -- rjbs
Subject: Re: [rt.cpan.org #56786] Email::Delete->delete_message(...) causes an error
Date: Wed, 21 Apr 2010 15:06:38 -0400
To: bug-Email-Delete [...] rt.cpan.org
From: Justin McGuire <lifefeed [...] gmail.com>
Okay. But is there a reason why it can't also work as a method? I normally prefer using methods over importing functions, and other people may appreciate having the choice as well. I'd be willing to write the test cases and documentation and such if you don't have the time for it all. On Wed, Apr 21, 2010 at 12:22 PM, Ricardo Signes via RT < bug-Email-Delete@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=56786 > > > It's a function, not a method. Don't call it as a method. Nothing, as far > as I can tell, is > documenting it as a method. > > -- > rjbs >
On 2010-04-21 15:06:53, summerhouse wrote: Show quoted text
> Okay. But is there a reason why it can't also work as a method? I > normally > prefer using methods over importing functions, and other people may > appreciate having the choice as well.
Email::Delete isn't a class. It is just a package. Just use: Email::Delete::delete_message( ... )
Subject: Re: [rt.cpan.org #56786] Email::Delete->delete_message(...) causes an error
Date: Thu, 22 Apr 2010 09:12:16 -0400
To: bug-Email-Delete [...] rt.cpan.org
From: Justin McGuire <lifefeed [...] gmail.com>
That works, thanks. On Wed, Apr 21, 2010 at 3:30 PM, Ricardo Signes via RT < bug-Email-Delete@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=56786 > > > On 2010-04-21 15:06:53, summerhouse wrote:
> > Okay. But is there a reason why it can't also work as a method? I > > normally > > prefer using methods over importing functions, and other people may > > appreciate having the choice as well.
> > Email::Delete isn't a class. It is just a package. > > Just use: > > Email::Delete::delete_message( ... ) >
(re-closing after reply auto-re-opened)