Help with perl please

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • archael
    Registered User
    • Jun 2003
    • 51

    #1

    Help with perl please

    I've built a script that does a bunch of stuff but more importantly overwrites a .pl file.
    It gets overwritten properly online and when i download it, i see all the contents as they are supposed to be. So that is not the problem.

    My problem is after it has been overwritten, i need to download it and reupload it so it can be run from another script that rebuilds.

    It seems to me that the problem is that it gets overwritten in another mode than ascii because only reuploading as ascii fixes it.

    If you have any ideas, it would be much appreciated. Perhaps a piece of code to add to my script so it overwrites as ascii and can be run right away.

    Thanks
  • sexdwarf
    Confirmed User
    • Jan 2005
    • 196

    #2
    hrmmm that doesn't really make any sence, are you always opening the file after the download? if if so with what program?
    ICQ me for any programming projects - Agency quality work for non-agency prices
    ICQ 337 028 441

    Comment

    • archael
      Registered User
      • Jun 2003
      • 51

      #3
      nope, only 1 i opened, the other 3 i used for testing, i just downloaded and reuploaded. While doing so, i rebuilt in between to see if it worked and its only after upload that it does..

      Comment

      • archael
        Registered User
        • Jun 2003
        • 51

        #4
        bump..
        really need help with this if anyone knows anything.

        Thanks

        Comment

        • colpanic
          Confirmed User
          • May 2004
          • 1007

          #5
          Is this on a unix box?

          How are you downloading/uploading it?
          I like ducks.

          Comment

          • MrJackMeHoff
            Confirmed User
            • Mar 2004
            • 4569

            #6
            it could be your file extention.. Many shitty ftp progs will auto dl in binary based on the extention. Have you tried forcing the ascii dl? Does it look ok if you do?

            Comment

            • archael
              Registered User
              • Jun 2003
              • 51

              #7
              Basically, the problem seems to be that a script cannot be run with `` signs if it was last edited by another script. The method of upload is correct because reuploading does solve the problem, all permissions also stay okay so thats no the problem either. Im starting to think if it might be a method of protection on the server itself. Not let a script run if last edited by another script...

              Comment

              • Odie
                Confirmed User
                • Apr 2003
                • 7040

                #8
                promote soucash and u won't have any problems!!
                Odie
                [email protected]
                Are you Mobile????
                MMACanada
                ICQ # 166208354


                See Who I Am At AdultWhosWho.com!

                Comment

                • mht
                  Confirmed User
                  • Mar 2003
                  • 194

                  #9
                  More likely to be a permissions problem...

                  Also is it a script that does anything? If not consider making it a .txt file
                  Last edited by mht; 02-10-2005, 03:45 AM.
                  http://www.pattayafree.com/

                  Comment

                  • archael
                    Registered User
                    • Jun 2003
                    • 51

                    #10
                    all the .pl's are separate perl codes to retrieve mysql info to display galleries since i have a bunch of categories. My build.cgi script is supposed to open and run that code then put the retrieved galleries themselves into an array, not just the original code. Which is why i use ``. All permissions stay at 777 even after the code has been edited. I've spoken to dozens of people up to now and everyone is as puzzled as me. There just doesn't seem to be any explanation to this. It's not like i can have errors log point me in the right direction, there are no errors. Just that something prevents the sql retrieval scripts to run if last edited by another script.

                    Comment

                    • Fuckin Bill
                      Confirmed User
                      • Feb 2003
                      • 1020

                      #11
                      It's impossible to say anything without seeing the code. You could be escaping characters incorrectly, could be opening files in binary mode rather than in a text mode. Could just have missed a ";" somewhere.

                      Or it could just plainly be that you're trying to do something that can't be done in perl. Nobody is going to be able to guess at what's wrong without being able to see the actual code.

                      Comment

                      • archael
                        Registered User
                        • Jun 2003
                        • 51

                        #12
                        $count = 1;
                        find(\&edits, $dir);
                        sub edits() {
                        if ( $File::Find::name =~ /\.pl$/ ){
                        @$count = `$path/core/perl/categories/$_`;
                        $newfile = $_;
                        $newfile =~ s/\.pl$/\.html/;
                        $template2 = $template;
                        $template2 =~ s/$galleries/@$count/;
                        open(PAGE,">$path2/search/$newfile");
                        print PAGE $template2;
                        close(PAGE);
                        print "<div align=center><font face=verdana size=1>$newfile has been rebuilt ($count/227)</font></div>";
                        $count++;
                        }
                        }

                        That is the part of the code that is important. There is no syntax error. But i thought binary and ascii were only upload methods. If you have any other clues on that to open file in non binary mode(which is what i think is already happening) please let me know.

                        Comment

                        • Fuckin Bill
                          Confirmed User
                          • Feb 2003
                          • 1020

                          #13
                          $template2 = $template;
                          $template2 =~ s/$galleries/@$count/;
                          open(PAGE,">$path2/search/$newfile");

                          I think your problem is in there. Not positive because I don't know what's happening in the code around it. Try this... Run the script and let it break, then download the new file that's created instead of uploading your new one like you're doing. What's in the file that the server is creating when you download it?

                          Comment

                          • Tom_PM
                            Porn Meister
                            • Feb 2005
                            • 16443

                            #14
                            open(PAGE,">$path2/search/$newfile") or die "Error: $!";

                            See what the error is maybe?
                            43-922-863 Shut up and play your guitar.

                            Comment

                            • Tom_PM
                              Porn Meister
                              • Feb 2005
                              • 16443

                              #15
                              And yeah, if it's Unix flavor you shouldnt have to fiddle with binmode.
                              43-922-863 Shut up and play your guitar.

                              Comment

                              • Tom_PM
                                Porn Meister
                                • Feb 2005
                                • 16443

                                #16
                                Maybe it's a permissions issue and you just dont know it.

                                $oldumask=umask(000);
                                open(PAGE,">$path2/search/$newfile");
                                print PAGE $template2;
                                close(PAGE);
                                umask($oldumask);
                                43-922-863 Shut up and play your guitar.

                                Comment

                                • archael
                                  Registered User
                                  • Jun 2003
                                  • 51

                                  #17
                                  no errors happen in the script, even using die. Also tested chmod'ing it and fails to work as well.

                                  Comment

                                  Working...