New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IO::Socket::INET doesn’t report bad PeerPort values #13466
Comments
From @FGasperCreated by @FGasperperl -MIO::Socket::INET -e 'IO::Socket::INET->new( PeerAddr => "google.com", PeerPort => "haha" ) || die "connect failed: [$!]"' The above example doesn�t populate $! as it should with a message about the invalid PeerPort value. Note that the following: ...does produce an "Invalid argument" message in $!. Perl Info
|
From @tonycozOn Wed Dec 11 16:19:59 2013, felipe@felipegasper.com wrote:
The IO modules generally report errors in $@: $ perl -MIO::Socket::INET -e 'IO::Socket::INET->new( PeerAddr => "google.com", PeerPort => "haha" ) || die "connect failed: [$@]"' That isn't very well[1] documented, which may be the bug here. Tony [1] at all? It's demonstrated in an example fo IO::Socket::INET->connect(), but I didn't see anything more explicit |
The RT System itself - Status changed from 'new' to 'open' |
From @leonerdOn Wed, 11 Dec 2013 21:42:45 -0600
Unfortunately you can't put a string in -- leonerd@leonerd.org.uk |
From @FGasperOn 12.12.13 9:17 AM, Paul LeoNerd Evans via RT wrote:
Agh -- duh. Maybe a package global, then, a la DBI? $@ is called $EVAL_ERROR in English.pm, so this pattern: local $EVAL_ERROR; ...would be unfortunate to �enshrine�. Much better, IMO: IO::Socket::INET->new( .. ) or die $IO::Socket::INET::errstr; -FG |
From @leonerdOn Thu, 12 Dec 2013 09:50:21 -0600
Except it isn't IO::Socket::INET's error value, it's IO::Socket's. Or Plus all the existing code -- leonerd@leonerd.org.uk |
From @FGasperOn 12/12/13 9:56 AM, Paul LeoNerd Evans via RT wrote:
Where the error comes from is an implementation detail. The caller This can easily be abstracted. For subclassing: IO::Socket::INET->errstr()
Existing code can stay as-is; just deprecate use of -F |
From @rjbs* Felipe Gasper <felipe@felipegasper.com> [2013-12-12T11:37:32]
What does "deprecate" mean as you use it here? I don't see how this could be usefully changed. The amount of code already If that's he case, what's the point? -- |
From @FGasperOn 12/12/13 8:55 PM, Ricardo Signes via RT wrote:
Maybe �deprecate� isn�t what I really mean. Sorry. My proposals: 1) Create and document IO::Socket::INET->err() and 2) Leave undocumented, but preserve indefinitely, assignments to 3) Document that IO::Socket::INET::new() can overwrite those globals, so In other words, moving forward, callers should stop looking at Basically, IO::Socket::INET errors should not look like they come from The pattern that I propose is familiar from DBI and seems to me to At the *very* minimum, as Tony pointed out in his response initially, -FG |
From zefram@fysh.orgFelipe Gasper wrote:
It's not sensible to propose anything for IO::Socket::INET in isolation. Furthermore, any mechanism based on shared static storage locations just The way an error is signalled should be tied to the construction
Obviously, throwing an exception is inconsistent with the existing API, so -zefram |
From @FGasperOn 13.12.13 2:13 PM, Zefram wrote:
I like this idea much better, yes.
Again, agreed. -FG |
This task could be repurposed as “Add error reporting to IO::Socket::* documentation.” |
Migrated from rt.perl.org#120764 (status was 'open')
Searchable as RT120764$
The text was updated successfully, but these errors were encountered: