in reply to Re: Perl Safety
in thread Perl Safety

I do have to say, I have had to laugh at this thread a little... I've been working with perl off and on the last seven (gosh maybe more...) years and have always enjoyed it... my current employer wanted me to implement some code in perl (I argued for java or c pretty hard... but hey sometimes money talks ;)... anyway I was hoping more somebody would come in with a nice solution and say "here is some neat trick... try this :)"

Instead I've gotten professional help ;)... which is cool, but I'm a *lowly* contractor here *and* too young... hrmmm... so I can't really get in and play the political games to actually fix the problem correctly... I've bugged the guy a few times to help him fix some things, but he's a little put off by having some 'green' punk kid teach him anything. If anything I think it bothers him more that I've been programming longer than him... and more than likely getting paid more. :(

Be that as it may, are there *any* tricks I can pull off to protect myself. I know I could localize variables and all that fun stuff, but I'm more afraid he'll go off and create new variables and such and walk all over my code. It has happened a few times to me and unfortunately talking to his manager hasn't helped any because he is basically given free reign to do whatever he wants.

So can I do something weird like localize main:: or somehow seperate his memory space from mine without his code knowing about it? I really don't care to spend the time to re-write any of his code, especially since I don't want to be walking on any toes.

I've already ran into enough problems now that I am trying to get him to fix anyway... so this isn't highest on my priority list to get him to fix... I'd rather get him focusing any time he can give me to *not* crashing out on me and killing my programs that use his code.

Oh well... I guess this thread has become more 'off topic' than what *I* expected at least :)... guess I'll have to see what I can do on my end to get this engineer to help me out :).

Replies are listed 'Best First'.
RE: RE: Re: Perl Safety
by Adam (Vicar) on Aug 25, 2000 at 23:39 UTC
    Use package as a buffer.
    Write a package of wrappers around his functions, and then only export those functions from the wrapper. There is no way for a module's code to run over yours if you don't import it into your package. Most of us (well, me anyway) use the main package without bothering to name it. Java doesn't let you get away with this, but since you argued for using Java, maybe you should adopt this habit. Then don't import anything into your named package that you didn't write.

    Does this make sense or is my blood sugar too low?

      Well... I am getting at his module via:
      use Package Package::get_data();
      yet mysteriously in my code after I call Package::get_data() all of a sudden I have variables $x, $y, $z that are defined... now I would have expected theses variables to be Package::x Package::y Package::z, but there they are. I asked the engineer about this and he said that there wasn't any other way to pass multiple variables back through a return... when I suggested a hash he was particularly receptive to the idea...
        untested psuedo-code
        use strict; # To make sure you use the right package names. package My_Wrapper; sub My_get_data { local $x, $y, $z; # I had 'my', but [tilly] is right. # Thats why I said, "I think." here. get_data( @_ ); return ( $x, $y, $z ); } package My_main my ( $x, $y, $z ) = My_Wrapper::My_get_data;
        That's a stab in the dark. I'm tired and I don't feel like taking the time to construct your situation for testing. But I think that is the direction to go. My_Wrapper will collect ugly globals, but they shouldn't propogate to My_main.
RE: RE: Re: Perl Safety and Humanware / Political Warfare
by Anonymous Monk on Aug 26, 2000 at 01:11 UTC
    Instead I've gotten professional help ;)... which is cool, 
    but I'm a *lowly* contractor here *and* too
    young... hrmmm... so I can't really get in and play the 
    political games to actually fix the problem correctly...
    I've bugged the guy a few times to help him fix some 
    things, but he's a little put off by having some 'green'
    punk kid teach him anything. If anything I think it 
    bothers him more that I've been programming longer than
    him... and more than likely getting paid more. :(
    
    
    ###########
    
    This is precisely the culture that I work so hard to avoid,
    yet landing there seems to be unavoidable.  
    
    If you have a valid point ( and it looks like you do based
    on your description of the problem ), then I suggest you
    become an evil, manipulative bastard by asking the following
    question:
    
    "What am I missing?"
    
    This insidious little question is extremely confrontational
    because it forces them to explain to YOU exactly how their
    way will work.  Their explanation will not make sense, so
    be sure to ask it in the presence of at least 1 ally.  If
    they dodge, repeat the question.
    
    If they dodge, repeat the question.
    
    If they dodge, repeat the question.
    
    If they dodge, repeat the question.
    
    If they dodge again, say "Excuse me, but I really do not
    understand what you are doing here.  Can you please help
    me understand what you are trying to do and how I can
    succeed with your code?"
    
    If they don't help you, then that is a refusal to help
    a coworker whose work depends upon their success.  At that
    point, maybe some sort of third party intervention shall 
    be required.  Be sure to present it as in the context of
    how you do not understand what the other person is doing and
    they are refusing to work with you to solve the problem.
    
    Also, be prepared to leave if your company is extremely sick
    culturally.  They will not like this.  Having allies 
    present is extremely important.  This is a CYA for your
    presentation to HR...if 3 people complain to HR, it will 
    probably be believed.  If 4 people complain to HR, it shall
    be believed and action will be taken.
    
    ##########
    
    On a lighter note:
    
    while ( $dodge ) {
    
       print "What am I missing?\n";
    
    } # while
    
    --moo
    
RE: RE: Re: Perl Safety and Humanware / Political Warfare
by Anonymous Monk on Aug 26, 2000 at 01:10 UTC
    Instead I've gotten professional help ;)... which is cool, but I'm a *lowly* contractor here *and* too young... hrmmm... so I can't really get in and play the political games to actually fix the problem correctly... I've bugged the guy a few times to help him fix some things, but he's a little put off by having some 'green' punk kid teach him anything. If anything I think it bothers him more that I've been programming longer than him... and more than likely getting paid more. :( ########### This is precisely the culture that I work so hard to avoid, yet landing there seems to be unavoidable. If you have a valid point ( and it looks like you do based on your description of the problem ), then I suggest you become an evil, manipulative bastard by asking the following question: "What am I missing?" This insidious little question is extremely confrontational because it forces them to explain to YOU exactly how their way will work. Their explanation will not make sense, so be sure to ask it in the presence of at least 1 ally. If they dodge, repeat the question. If they dodge, repeat the question. If they dodge, repeat the question. If they dodge, repeat the question. If they dodge again, say "Excuse me, but I really do not understand what you are doing here. Can you please help me understand what you are trying to do and how I can succeed with your code?" If they don't help you, then that is a refusal to help a coworker whose work depends upon their success. At that point, maybe some sort of third party intervention shall be required. Be sure to present it as in the context of how you do not understand what the other person is doing and they are refusing to work with you to solve the problem. Also, be prepared to leave if your company is extremely sick culturally. They will not like this. Having allies present is extremely important. This is a CYA for your presentation to HR...if 3 people complain to HR, it will probably be believed. If 4 people complain to HR, it shall be believed and action will be taken. ########## On a lighter note: while ( $dodge ) { print "What am I missing?\n"; } # while --moo