![]() |
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 |
hrmmm that doesn't really make any sence, are you always opening the file after the download? if if so with what program?
|
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..
|
bump..
really need help with this if anyone knows anything. Thanks |
Is this on a unix box?
How are you downloading/uploading it? |
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?
|
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...
|
promote soucash and u won't have any problems!!
|
More likely to be a permissions problem...
Also is it a script that does anything? If not consider making it a .txt file |
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.
|
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. |
$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. |
$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? |
open(PAGE,">$path2/search/$newfile") or die "Error: $!";
See what the error is maybe? |
And yeah, if it's Unix flavor you shouldnt have to fiddle with binmode.
|
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); |
no errors happen in the script, even using die. Also tested chmod'ing it and fails to work as well.
|
All times are GMT -7. The time now is 02:37 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123