{"action":"opened","issue":{"url":"https://api.github.com/repos/toddr/IO/issues/11","repository_url":"https://api.github.com/repos/toddr/IO","labels_url":"https://api.github.com/repos/toddr/IO/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/toddr/IO/issues/11/comments","events_url":"https://api.github.com/repos/toddr/IO/issues/11/events","html_url":"https://github.com/toddr/IO/issues/11","id":316064311,"number":11,"title":"Allow ->bind and ->connect with named arguments [rt.cpan.org #57671]","user":{"login":"toddr","id":97892,"avatar_url":"https://avatars3.githubusercontent.com/u/97892?v=4","gravatar_id":"","url":"https://api.github.com/users/toddr","html_url":"https://github.com/toddr","followers_url":"https://api.github.com/users/toddr/followers","following_url":"https://api.github.com/users/toddr/following{/other_user}","gists_url":"https://api.github.com/users/toddr/gists{/gist_id}","starred_url":"https://api.github.com/users/toddr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toddr/subscriptions","organizations_url":"https://api.github.com/users/toddr/orgs","repos_url":"https://api.github.com/users/toddr/repos","events_url":"https://api.github.com/users/toddr/events{/privacy}","received_events_url":"https://api.github.com/users/toddr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-19T22:34:42Z","updated_at":"2018-04-19T22:34:42Z","closed_at":null,"author_association":"OWNER","body":"Migrated from [rt.cpan.org#57671](https://rt.cpan.org/Ticket/Display.html?id=57671) (status was 'new')\n\nRequestors:\n* leonerd-cpan@leonerd.org.uk\n\nFrom leonerd-cpan@leonerd.org.uk on 2010-05-20 17:02:06:\n```\nThere's a disparity in convenience between\n\n use IO::Socket::Packet;\n my $sock = IO::Socket::Packet->new( IfIndex => 5 );\n\nand\n\n use IO::Socket::Packet;\n use Socket::Packet qw( pack_sockaddr_ll ETH_P_ANY );\n my $sock = IO::Socket::Packet->new;\n $sock->bind( pack_sockaddr_ll( ETH_P_ANY, 5, 0, 0, '' ) );\n\nIt would be nice if IO::Socket->bind (and ditto ->connect) could take a\ncollection of named arguments instead of a single packed address.\n\n use IO::Socket::Packet;\n my $sock = IO::Socket::Packet->new;\n $sock->bind( IfIndex => 5 );\n\nI observe that right now it's always an error to pass more than one\nargument to ->bind:\n\nsub bind {\n    @_ == 2 or croak 'usage: $sock->bind(NAME)';\n    ...\n\nThis surely gives way to a really neat implementation:\n\nsub bind {\n    my $sock = shift;\n    my $addr = @_ > 1 ? $sock->pack_bindaddr( @_ ) : shift;\n\n    return bind($sock, $addr) ? $sock\n\t\t\t      : undef;\n}\n\nThen any subclass that wishes to provide a neater implementation of bind\nargs, can provide such a method; e.g.\n\nsub pack_bindaddr\n{\n   shift;\n   my %args = @_;\n   pack_sockaddr_ll( $args{Protocol} || ETH_P_ANY, $args{IfIndex} || 0,\n0, 0, '' );\n}\n\n(with analogous implementation for ->connect)\n\nSuch code could probably be largely lifted from each subclass's\n->configure method anyway.\n\nThis should be easy to implement, as it only adds new behavior which\nright now would be an error; so there ought not be any risk of\nclobbering existing code. Subclasses can implement these packing methods\npiecemeal; we don't have to update every subclass all at once.\n\nIf you'd be happy with such an idea, I'd be quite happy to go about\nactually writing code, tests, updating docs, etc...\n\n-- \n\nPaul Evans\n```\n"}}
{"actor":{"display_login":"toddr"}}