Gossamer Forum
Home : Products : Others : Fileman :

.pl file curruption

Quote Reply
.pl file curruption
When I edit a .pl file in fileman I save it and it gets currupted. I get the following (or similar) error when I try to run said file. I understand that there is a problem with &command; commands not saving properly from what I have read in other fileman posts. If this is the case is there a way to fix that? I need to be able to work on the site from behind a proxy that does not allow FTP access. Any help would be great,

Thanks,

Jason

Error including libraries: (Maybe you didn't strip carriage returns after a network transfer?)

Make sure they exist, permissions are set properly, and paths are set correctly.
Quote Reply
Re: .pl file curruption In reply to
Hi Jason:

What is happening is that when you uploaded files from Windows machine to a Linux/UNIX machine, you have uploaded it in binary mode. You should upload it in ASCII mode.

Cheers
Sun
Quote Reply
Re: .pl file curruption In reply to
I know that could happen, but as far as I know you can't specify fileman to save in either ascii or binary mode.
Quote Reply
Re: .pl file curruption In reply to
Hi Jason:

Error including libraries: (Maybe you didn't strip carriage returns after a network transfer?)

Well, what is happening is not that you have uploaded the files through Fileman in ASCII or binary mode. What I am saying is that you have uploaded the FileMan program in binary mode. The difference is that in one case I am talking about uploading through FileMan and the other one is uploading the FileMan program. I am referring to the latter. Say when you are ftping the FileMan program to the server you should ftp it in ASCII mode to your server. I know this sounds confusing. I learned it the hard way too.

Cheers
Sun
Quote Reply
Re: .pl file curruption In reply to
I don't think you understand. The Fileman program works just fine. I can edit my HTML, SHTML, TXT etc files. But when I go back to edit them later they have the carriage returns in them. This is fine for the above mentioned file types, but for my .pl files this causes problems. Perl cannot interpret them. I then have to DL the files, run a search on the carrage return character and replace it with a space. I then reupload the .pl file and it works. Same thing with .cgi files and a few others.
Quote Reply
Re: .pl file curruption In reply to
Hi Jason:

Ok I see what you are saying now. Sorry for the misunderstanding. Can you try this: spot the line that contains the following in sub upload

binmode (OUTFILE);

comment this out and try to upload your pl files again and check that there are no carriage returns. I want to warn you that this is not a solution. This is just so that I know for sure where the problem is. Once I received your reply and ascertained what the problem is, I will think of a solution.

Cheers
Sun
Quote Reply
Re: .pl file curruption In reply to
Ok, I rem'd the above line in fileman.cgi.
I then edited one member_html.pl (no one but me and my beta tester knows how to get to it). I saved that file useing Fileman and got the following when I tried to run that script:
CGI ERROR
==========================================
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: (Maybe you didn't strip carriage returns after a network transfer?)

Script Location : db.cgi
Perl Version : 5.00404
Setup File : members.cfg

Form Variables
-------------------------------------------
db : members

Environment Variables
-------------------------------------------
DOCUMENT_ROOT : /www/weirdity
GATEWAY_INTERFACE : CGI/1.1
HTTP_ACCEPT : application/ms-bpc, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_ACCEPT_LANGUAGE: en-us
HTTP_CONNECTION : Keep-Alive
HTTP_HOST : www.weirdity.com
HTTP_REFERER : http://www.weirdity.com/dir.html
HTTP_USER_AGENT : Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
PATH : /usr/local/bin:/usr/bin:/bin
QUERY_STRING : db=members
REMOTE_ADDR : 206.103.56.51
REMOTE_PORT : 1178
REQUEST_METHOD : GET
SCRIPT_FILENAME : /www/weirdity/cgi-bin/dbman/db.cgi
SCRIPT_NAME : /cgi-bin/dbman/db.cgi
SERVER_ADMIN : webmaster@weirdity.com
SERVER_NAME : www.weirdity.com
SERVER_PORT : 80
SERVER_PROTOCOL : HTTP/1.1
SERVER_SOFTWARE : Apache/1.3.4 (Unix) FrontPage/4.0.4.3 PHP/3.0.7

I then D'L the file with CuteFTP and edit it with EditPlus. At the end of every line is a box representing a <CR> I do a search on that box and replace it with a <space> and all is good again after I upload it with anything including Fileman. I need to be able to edit the files without DLing and ULing though. This is after all the use of this program. About 75-85% of my site is .pl files so this is very important.

Jason

Quote Reply
Re: .pl file curruption In reply to
To fix this problem, after
$data =~ s,</TEXT-AREA,</TEXTAREA,ig;

insert
$data =~ s/\r//g;

That should solve your problem.

Quote Reply
Re: .pl file curruption In reply to
If you use fileman to edit your files, be aware that fileman saves the file in BINARY. CGI files will not work in BINARY. Therefore, you must get rid of the hidden characters that are placed in the script. Jos van Ras has told us that if you want to edit cgi scripts with fileman, you need to scroll down the script to find the line:
# Begin Write Text File Procedure:

# Add these lines to that sub:
# Fix textarea tags.
$data =~ s,</TEXTAREA,</TEXTAREA,ig;
$data =~ s/(\r|\035)//gi;
# This is for removing the hidden ^Z char

this should sort it out!

We the willing,
Led by the unknowing,
Do the impossible,
For the ungrateful.

Niall