Re: Can't call soup_cookie_parse() through GIR



On Sat, Dec 3, 2011 at 15:39, Torsten Schoenfeld <kaffeetisch gmx de> wrote:

This is not set it stone yet, though. ÂSo if anyone sees good reasons to
prefer the '->' route, now is the time to present them.

I would say that this is convenient for inheritance. This way the
package names can be avoided by simply using $class or $self and to
let perl dispatch to the right package.

For instance if someone would like to provide a different cookie
implementation and that their code would do inherit from the main
class then the could do:

use lib 'HTTP::Soup::Cookie';

# Avoids the HTTP::Soup::Cookie limitation to parse 1 single cookie per header.
sub parse_multiple {
   my $class = shift;
   my ($raw, $url) = @_;

   return map { $class->parse($_, $url); } get_parts($raw);
}

This way the package name is referred only once, when the inheritance
link is done.
-- 
Emmanuel Rodriguez



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]