Re: IO::Socket::INET on OSX or TCP stack problem



"SG" == Stuart Gall <stuart@xxxxxxxxx> writes:

SG> On 2009-05-10 19:29:47 +0300, Uri Guttman <uri@xxxxxxxxxxxxxxx> said:

SG> So it must be either a perl/osx thing or there must be something odd
SG> about the TCP packets coming from these modbus devices which is
SG> upsetting OSX.

hard to say from here. i highly doubt it is perl. if you want to verify
this do the same thing in c or another language. or google for this
situation and see if others have seen it.

>> why the begin block? declaring empty vars subs in begin blocks does
>> nothing.

SG> It makes them static.
SG> Is there another way to define a static variable ?

just declaring vars outside a sub makes them static. the issue is more
about scoping than compile vs run time which is what BEGIN controls.

SG> sub OpenSocket($) {
>>
>> why are you using prototypes? they are meant for one thing alone
>> (changing how a sub call is parsed). they are not useful for arg
>> checking or stuff.

SG> I am using perl -w - I dont usually, but while I am trying to figure
SG> out why this script does not work I am.
SG> perl -w complains if you don't use prototypes. Or is there some other
SG> way around that ?

huh?? perl doesn't complain if you don't use prototypes. it will complain if
you use wrong prototypes. don't put any () after the sub names. read
perldoc perlsub for more.

uri

--
Uri Guttman ------ uri@xxxxxxxxxxxxxxx -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
.



Relevant Pages

  • Re: why doesnt this argument list need a comma after the 1st argument?
    ... I'm reading this very interesting book on Perl (Effective Perl Programming ... that the anonymous subroutine does not require the "sub" keyword, ... Prototypes were introduced to allow you to write ... block (without a comma) like this, and treat it as an anon sub. ...
    (comp.lang.perl.misc)
  • Re: Perl File::Copy to Samba share
    ... sub copyFile{ ... You really, really shouldn't use prototypes. ... warn 'Sub moveFile expected 2 arguments but was called with ' ... This article should help explain prototypes in Perl: ...
    (perl.beginners)
  • Re: Function prototype
    ... RB> The args passed to the sub are in the @_ array. ... And how do you propose that the compiler can check that? ... Prototypes are a part of "how Perl works". ...
    (comp.lang.perl.misc)
  • RE: returning hashes, and arrays
    ... :> subroutine named link(). ... :> array interchangeably here. ... : 'Learning Perl'; ... : sub ParseLineForHomeAndVisitors; ...
    (perl.beginners)
  • Re: Shifting Away
    ... are there two armed camps of Perl monks throwing gazillion megawatt ... daily at shift change and shout "When should I use an en dash?" ... become a bit less paranoid now but it's hard to let go of formal params. ... in the argument list and the sub could still change that. ...
    (comp.lang.perl.misc)