I made some test with the script "test.pl" attached. This script, with OWNet.pm 2.9p0, returns values as the owserver is up&running, even it isn't.
Applying this patch the test scripts get correct values. I'm not absolutely sure this patch is the best way to solve, but these are my 2 cents :) Giulio! 2013/6/17 Giulio Carabetta <giulio.carabe...@gmail.com> > I was cleaning up my script, before making it public, and I'm reminded of a > possible bug in the OWNet.pm perl library. > > Reading the man I thought I understand that calling: > > my $ owserver = OWNet->new ("localhost:4303"); > > while the server is not active, the expected behavior would be that $ > owserver is undefined. > > But it seems that this does not happen ever. > > For now I have found a little workaround: > > my $ owserver = OWNet-> new ("localhost: 4304"); > print $ owserver-> dir ("/"); > if (defined ($ owserver-> {SOCK})) { > print "ERROR"; > } > > Only after a bus access (I tested dir) I can check the SOCK definition. > > If it is as expected, I'll promote the workaround as "normal check", > otherwise I'll try to dig in the lib :) > > Thanks! > > Giulio >
test.pl
Description: Binary data
OWNet.pm.patch
Description: Binary data
------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev
_______________________________________________ Owfs-developers mailing list Owfs-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/owfs-developers