shop-et Posted June 28, 2003 Posted June 28, 2003 I have been trying for two days now to get a particular script to run on the server. According to myself, a system admin of six years, another befriended system administrator, and Activestate Perl 5.8.0 (build 806), the script is flawless and should be working. However, the server doesn't seem to think so. I think an upgrade of the server's perl binaries is in order. I understand only very few people would be capable of this, so I would like someone of authority to take this into consideration. If anyone else has had an problems with this, I would like to hear about those too. I have already submitted a help ticket for this and am hoping for the best. Thank you, one and all. Quote
TCH-Andy Posted June 28, 2003 Posted June 28, 2003 shop-et, On the sites I maintain, I haven't had a problem. Wht are you trying to do, and what is the error that you get with the script? Andy Quote
shop-et Posted June 29, 2003 Author Posted June 29, 2003 That is the thing that confuses me. It doesn't give an error. It simply skips a part of the script for some reason. According to both Activestate Perl 5.6.1 (build 635) and Perl 5.8.0 (build 806) on my machine, the script should be running perfectly. However, the interpreter on the server, which I'm told is Activestate 5.6.1, insists something is amiss. For some reason, the server simply skips over a piece of the script. Both myself and another system admin have concluded that, by all reasonable lengths of logic, the accursed thing should already be working and both Perl interpreters on my machine concur. I honestly have no idea why this god forsaken thing refuses to work. As for what I am trying to do, the function that is being ignored for some reason (already tried variable renaming in case of reserved words) simply scans through two arrays and splices out the matches from one of them. The coding is so simple it's almost painful. If you have ever heard of this happening before or have any ideas, please, do tell. Thanks again. Quote
TCH-Andy Posted June 29, 2003 Posted June 29, 2003 Hi, Other than in my own programming, where to be honest it has usually turned out to be a coding error on my part, it isn't something I've come across. If the code really is that simple, are you happy to post the offending area? Alternatively if you PM me I'll have a quick look. Andy Quote
shop-et Posted June 29, 2003 Author Posted June 29, 2003 This is the code that's being inconsistant: #----------------- foreach $Exclusions (@Exclusions) { $scnt = -1; foreach $keywords (@keywords) { $scnt += 1; if ($Exclusions eq $keywords) { $Excluded = '<font face=arial size=2 color=blue><i>Excluded Common Words: |</i></font><br>'; $List .= $keywords; $List .= ' '; splice(@keywords,$scnt,1); $Ifex = 1; } } } if ($Ifex == 1) { $Excluded =~ s/\|/$List/; } #----------------- # # Here's the code for the print: # #----------------- <br> <center> <font face=arial size=2><i>$final</i></font><br> @Exclusions<br> $List<br> $Excluded<br> <hr width=30%> <br> #----------------- I apologize because I know this code won't show up well on a post. Also, Perl isn't my native tongue, so my scripting absolutely reeks of c/c++, but it should still be working. Here is the output on my box (with both Perl 5.6.1 and 5.8.0): Here is the output on the server: And I am absolutely sure it is the same file. I have been told that the server is running Perl 5.6.1, which is the same as one of the versions I have tested it with on my machine. I have rewritten it to do the same thing four or five different ways and every time is the same result. I am by no means a newb, but I must admit that this is a stumper. Any ideas? Thanks again. Quote
TCH-Andy Posted June 29, 2003 Posted June 29, 2003 Hi, c/c++ style I can cope with - myself I go back to being a FORTRAN programmer if I don't watch it I also prefer PHP to Perl, but each to their own I've had a quick look, and don't see any major problem. My only potential issue is that you have a loop defined on the length of the array @keywords. Within that loop you modify the array by removing elements. I'm not certain how Perl handles that, but to me it gives rise to a potential problem. Andy Quote
shop-et Posted June 29, 2003 Author Posted June 29, 2003 That would only cause a complication if you were removing multiple elements in a single loop. That is why the @keywords foreach loop is nested within the other. If you were removing two or more elements, then Perl wouldn't reset the foreach counter and would skip one each time. The way I have things arranged, skipping one doesn't matter. If an element that should be excluded is doubled and one is missed, that would be filtered out later in the script. If it were something that simple, then it shouldn't have worked at all, however it did on my end, just not on the server. This inconsistancy is what is throwing me for a loop. Thank you for the effort and feel free to add any more input if something else occurs to you. Oblecte. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.