Visit The New, Modern Unix Linux Community


Perl Uploading Files


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Perl Uploading Files
# 15  
I just can't let this go! We updated Apache this weekend and still have the problem. It just makes me so happy. I looked in /etc/profile and and couldn't find anything about umask. I did locate umask and got this is response
Code:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/auto/POSIX/umask.al
/usr/share/man/man1/umask.1.gz
/usr/share/man/man2/umask.2.gz
/usr/share/man/man3/getumask.3.gz

I checked out the first item and got this
Code:
[root@maverickds POSIX]# cat umask.al
# NOTE: Derived from ../../lib/POSIX.pm.
# Changes made here will be lost when autosplit is run again.
# See AutoSplit.pm.
package POSIX;

#line 581 "../../lib/POSIX.pm (autosplit into ../../lib/auto/POSIX/umask.al)"
sub umask {
    usage "umask(mask)" if @_ != 1;
    CORE::umask($_[0]);
}

# end of POSIX::umask
1;

When I view POSIX.pm, it's a very long script that has an instance of both chmod and umask. Example:
Code:
sub chmod {
    usage "chmod(mode, filename)" if @_ != 2;
    CORE::chmod($_[0], $_[1]);
}
and
sub umask {
    usage "umask(mask)" if @_ != 1;
    CORE::umask($_[0]);
}

I have no clue what the script does, though. I can load it somewhere if that would help. I also looked at AutoSplit.pm at search.cpan.org and it seems to have something to do with the problem I'm having, but I've gotten into a field I've never been before. I don't even know if what I'm looking at is relevant to my problem. Is there a server error log file that I might be able to get some error messages from? The only ones I know of are the site-based error logs.

Thanks
# 16  
in my installation of solaris umask is defined at the bottom of /etc/profile. (this sets it globally for all users)

umask and chmod are built into your default perl installation. well rather the way to use them is built into perl.

the perl modules ie *.pm are written in perl. most of the time if you are looking for a way to use a function in perl use the perldoc utility.

use perldoc to find the manpages for them.

perldoc -f chmod
perldoc -f umask

it will explane how to use them.
then its a matter of how you want to implament it.

like i said in my earlier post i would implament another function when the user uploads a file to a dir.

you need to capture the dir and filename then pass that info to the chmod command.

Code:
     chmod LIST
             Changes the permissions of a list of files.  The
             first element of the list must be the numerical
             mode, which should probably be an octal number, and
             which definitely should not a string of octal
             digits:  0644 is okay, '0644' is not.  Returns the
             number of files successfully changed.  See also
             "oct", if all you have is a string.

                 $cnt = chmod 0755, 'foo', 'bar';
                 chmod 0755, @executables;
                 $mode = '0644'; chmod $mode, 'foo';      # !!! sets mode to
                                                          # --w----r-T
                 $mode = '0644'; chmod oct($mode), 'foo'; # this is better
                 $mode = 0644;   chmod $mode, 'foo';      # this is best

             You can also import the symbolic "S_I*" constants
             from the Fcntl module:

                 use Fcntl ':mode';

                 chmod S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH, @executables;
                 # This is identical to the chmod 0755 of the above example.


Last edited by Optimus_P; 02-24-2004 at 10:29 AM..
# 17  
I didn't realize that's all POSIX.pm was doing. I know how to chmod and umask with perl, I'm just really annoyed by this bug and wanted to figure it out. I've spent too much time on it now, so I'll just change the scripts to chmod manually.

Thanks Optimus_P and Perderabo for all your help on this.

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #901
Difficulty: Easy
Steve Jobs offered Linus Torvalds a job in 2000, on the condition that he stopped development on Linux.
True or False?

10 More Discussions You Might Find Interesting

1. Web Development

Uploading files via php

I used the following code, which I found on the internet to upload files. <!-- The data encoding type, enctype, MUST be specified as below --> <form enctype="multipart/form-data" action="upload2.php" method="POST"> <!-- MAX_FILE_SIZE must precede the file input field --> <input... (2 Replies)
Discussion started by: jgt
2 Replies

2. UNIX for Dummies Questions & Answers

Plowshare Command In Uploading Files

OK i am completely new to this stuff!! let me start from the beginning!!! I Am connected to Whatbox.ca Via SSH!! Then I installed plowshare using their guide perfectly Now They Told Me To refer Plowshare site's Command list for uploading any files to Various... (4 Replies)
Discussion started by: anime12345
4 Replies

3. UNIX and Linux Applications

Need help on uploading Video files on Mediawiki and embed to page

I am working on to uploading Video files on Mediawiki and embed to page but not getting success. I tried plugin like MediaPlayer and HTML5Player but these plugins seems having extension limitation as i need to embed files like .wmv, .mpg etc. I am using mediawiki1.17 and CentOS5.8 x64 bit ... (1 Reply)
Discussion started by: sunnysthakur
1 Replies

4. Shell Programming and Scripting

Perl , uploading empty file.

Hi The below script used to work fine. Suddenly it's uploading empty file. I am very new to perl. Please help me to find out the problem. #!/usr/bin/perl #script: upload.pl use CGI qw/:standard/; print header, start_html('File upload'); print_form(); print_results() if... (2 Replies)
Discussion started by: Anupam_Halder
2 Replies

5. Shell Programming and Scripting

Uploading excel sheet to sharepoint portal using perl

Thourgh Perl scripting, Is it possible to upload excel sheet to sharepoint portal ? If the answer is YES.. Could you please share your thoughts and required CPAN modules or any examples to proceed further? Regards, Giridhar S ---------- Post updated at 04:26 AM ---------- Previous update... (0 Replies)
Discussion started by: giridhar276
0 Replies

6. UNIX for Advanced & Expert Users

Shell Script for uploading files to multiupload.com

Hi Please help me writing a shell script for multiupload. result should look like: $ ./multiupload.sh /tmp/file.avi http://www.multiupload.com/P1R9BZ4X3Q http://i.imgur.com/a2vhH.png There seems to be no official API. (3 Replies)
Discussion started by: slashdotweenie
3 Replies

7. UNIX for Dummies Questions & Answers

Uploading files from Mac to Unix/Linux via ssh

Ok. I am using the Terminal window to ssh into a unix server. I am not sure how to copy a file from my mac onto the unix server. What command do I enter and how do I type the file I want to upload Example. Say my file is named Test1.doc and it is on the usr/me/test/working/ directory and I want... (3 Replies)
Discussion started by: libertyforall
3 Replies

8. Shell Programming and Scripting

to block the files uploading via the port

Hi Folks, I am not good in shell scripting. Please help me with my problem. Is it possible to block the file named "ss.cgi" using the port 25 to upload. (4 Replies)
Discussion started by: gsiva
4 Replies

9. UNIX for Advanced & Expert Users

Uploading files in chronological order

Thanks for your help. (3 Replies)
Discussion started by: circuit.muni
3 Replies

10. UNIX for Dummies Questions & Answers

uploading Zipped files get 553 error

I am trying to upload .zip files to Unix server and get the error 553 qmerev2002.zip: Permission denied, what is my problem?? I am able to load other files and folders fine. (3 Replies)
Discussion started by: CoastGuard1970
3 Replies

Featured Tech Videos