Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
IPSocket::getaddress problem
Haze Noc
8/14/2007 10:53:00 PM
Hey guys, I want to test if IPSocket::getaddress('address') is valid
before printing it or anything..
If the user enters an invalid address then the program dies, i tried
rescuing the error but i didn't have much luck, any ideas?
Thanks in advance
--
Posted via
http://www.ruby-...
.
3 Answers
Haze Noc
8/14/2007 11:27:00 PM
0
*BUMP*
Seriously, No-one?
--
Posted via
http://www.ruby-...
.
John Joyce
8/15/2007 12:42:00 AM
0
On Aug 14, 2007, at 5:52 PM, Haze Noc wrote:
> Hey guys, I want to test if IPSocket::getaddress('address') is valid
> before printing it or anything..
>
> If the user enters an invalid address then the program dies, i tried
> rescuing the error but i didn't have much luck, any ideas?
>
> Thanks in advance
> --
> Posted via
http://www.ruby-...
.
>
Try creating a test first.
Using testing facilities in Ruby is exactly for this kind of thing!
Roger Pack
8/15/2007 2:22:00 AM
0
success = false
begin
a = IPSocket::getaddress('their input')
success = true
rescue Exception => detail
# arr! evil address
success = false
end
Haze Noc wrote:
> Hey guys, I want to test if IPSocket::getaddress('address') is valid
> before printing it or anything..
>
> If the user enters an invalid address then the program dies, i tried
> rescuing the error but i didn't have much luck, any ideas?
>
> Thanks in advance
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
IPSocket::getaddress problem
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password