Professional Web Applications Themes

Using Net::FTP for chmod (help needed ASAP) - PERL Beginners

Hi, Much to my surprise, when I run this code, it never returns 0 if it could not carry out the operation. $rc = $f->site("chmod 666 $remoteFile") or die "ftp: Could not change permissions: $!\n"; It seems to return a 2 on success, and a 5 if it could not access the file because of a different owner. My question is, what return code can I rely on? I need to be sure the permissions were set to '666'. Any suggestions? This is a emergency "quick fix". Thanks in advance.... -Jeff __________________________________ Do you Yahoo!? Protect your identity with Yahoo! ...

  1. #1

    Default Using Net::FTP for chmod (help needed ASAP)

    Hi,

    Much to my surprise, when I run this code, it never returns 0 if it could not
    carry out the operation.

    $rc = $f->site("chmod 666 $remoteFile")
    or die "ftp: Could not change permissions: $!\n";

    It seems to return a 2 on success, and a 5 if it could not access the file
    because of a different owner.

    My question is, what return code can I rely on? I need to be sure the
    permissions were set to '666'.

    Any suggestions? This is a emergency "quick fix".

    Thanks in advance....

    -Jeff

    __________________________________
    Do you Yahoo!?
    Protect your identity with Yahoo! Mail AddressGuard
    [url]http://antispam./whatsnewfree[/url]
    Jeff Westman Guest

  2. #2

    Default Re: Using Net::FTP for chmod (help needed ASAP)


    > Hi,
    >
    > Much to my surprise, when I run this code, it never returns 0 if it
    could not
    > carry out the operation.
    >
    > $rc = $f->site("chmod 666 $remoteFile")
    > or die "ftp: Could not change permissions: $!\n";
    >
    > It seems to return a 2 on success, and a 5 if it could not access the file
    > because of a different owner.
    >
    > My question is, what return code can I rely on? I need to be sure the
    > permissions were set to '666'.
    >
    > Any suggestions? This is a emergency "quick fix".
    >
    > Thanks in advance....
    From the docs:

    "Returns most significant digit of the response code."

    The response code is part of the FTP specification, response codes in
    the 200's are successes and responses in the 500's are failures, so it
    should be sufficient to check for a 2 and have that be success, a 5
    makes failure and anything else is undefined. By looking at the 2
    lesser significant digits normally a failure cause can be determined,
    but with 'site' that is system dependent (at least I think).

    HTH,

    [url]http://danconia.org[/url]

    Wiggins D Anconia Guest

  3. #3

    Default Re: Using Net::FTP for chmod (help needed ASAP)

    Wiggins d Anconia <wigginsdanconia.org> wrote:
    >
    >
    > > Hi,
    > >
    > > Much to my surprise, when I run this code, it never returns 0 if it
    > could not
    > > carry out the operation.
    > >
    > > $rc = $f->site("chmod 666 $remoteFile")
    > > or die "ftp: Could not change permissions: $!\n";
    > >
    > > It seems to return a 2 on success, and a 5 if it could not access the
    > file
    > > because of a different owner.
    > >
    > > My question is, what return code can I rely on? I need to be sure the
    > > permissions were set to '666'.
    > >
    > > Any suggestions? This is a emergency "quick fix".
    > >
    > > Thanks in advance....
    >
    > From the docs:
    >
    > "Returns most significant digit of the response code."
    >
    > The response code is part of the FTP specification, response codes in
    > the 200's are successes and responses in the 500's are failures, so it
    > should be sufficient to check for a 2 and have that be success, a 5
    > makes failure and anything else is undefined. By looking at the 2
    > lesser significant digits normally a failure cause can be determined,
    > but with 'site' that is system dependent (at least I think).
    This makes sense (now). Silly me, I thought non-zero was success. Using a
    truncated number from the RFC was definitely a mystery. I wish these
    packages followed a stricter standard.

    This helped tremendously, and I've resorted to using something like

    $perm = substr(sprintf("%s", $f->dir($remoteFile)), 1, 9);

    die "Bad permissions\n" unless ($perm =~ /rw-rw-rw-/);


    Thanks again! =)

    -Jeff


    __________________________________
    Do you Yahoo!?
    Protect your identity with Yahoo! Mail AddressGuard
    [url]http://antispam./whatsnewfree[/url]
    Jeff Westman Guest

  4. #4

    Default Re: Using Net::FTP for chmod (help needed ASAP)

    Jeff Westman wrote:
    >
    > Subject: Using Net::FTP for chmod (help needed ASAP)
    Jeff.

    This isn't a pitstop. It's a place for 'beginners' to learn.

    Rob


    Rob Dixon Guest

Similar Threads

  1. Help needed. Please reply asap.
    By TCC_GirL webforumsuser@macromedia.com in forum Macromedia Freehand
    Replies: 2
    Last Post: February 9th, 07:01 PM
  2. My topic disappeared. urgent reply needed asap.
    By TCC_GirL in forum Macromedia Freehand
    Replies: 3
    Last Post: February 9th, 04:50 PM
  3. good/reliable/but cheap php programmr needed asap
    By sarahandchris in forum PHP Development
    Replies: 4
    Last Post: January 6th, 11:10 AM
  4. some sample code needed..ASAP..
    By gops in forum Mac Programming
    Replies: 10
    Last Post: September 26th, 06:52 AM
  5. Pr0grammer Needed ASAP for News Ticker
    By Strato in forum Macromedia Flash Sitedesign
    Replies: 0
    Last Post: September 16th, 02:04 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139