[24815] in Perl-Users-Digest
Perl-Users Digest, Issue: 6968 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 7 03:06:13 2004
Date: Tue, 7 Sep 2004 00:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 7 Sep 2004 Volume: 10 Number: 6968
Today's topics:
Re: Can't write to a text file through CGI-Perl (Kishore)
Re: Desparate, tired programmer -- bug in perl5.6.1/apa <noreply@gunnar.cc>
Re: Dynamic hash names <ebohlman@omsdev.com>
GD.pm make test failed, help please? <bopew2000@yahoo.com>
Help with POD in Win98 (activeperl) <warewolfe@hotmail.com>
Re: Help with POD in Win98 (activeperl) <mritty@gmail.com>
Network Scanner (Chad Brown)
Re: Network Scanner <uri@stemsystems.com>
Problem using some delimiters in s///x <parv_@yahooWhereElse.com>
Re: Problem using some delimiters in s///x <uri@stemsystems.com>
Re: Problem using some delimiters in s///x <parv_@yahooWhereElse.com>
Re: Problem using some delimiters in s///x <uri@stemsystems.com>
Trouble with permissions when creating files (Kishore)
Re: Trouble with permissions when creating files <invalid-email@rochester.rr.com>
Re: Trouble with permissions when creating files <noreply@gunnar.cc>
Re: Trouble with permissions when creating files <nospam@bigpond.com>
Re: two's compliment? <bigal187@invalid.rx.eastcoasttfc.com>
Re: Xah Lee's Unixism <my.spamtrap@verizon.net>
Re: Xah Lee's Unixism <firstname@lastname.pr1v.n0>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 6 Sep 2004 19:02:29 -0700
From: krishnakishore.r.challa.lzi1@statefarm.com (Kishore)
Subject: Re: Can't write to a text file through CGI-Perl
Message-Id: <e1c7fb54.0409061802.1c8b6fa2@posting.google.com>
jgilber@yahoo.com wrote in message news:<cgvj05$g0a@odah37.prod.google.com>...
> "When I run from shell, I login as root"
>
> There's your answer. root has permission to write to any directory.
> I doubt that the owner of the http process has the same permissions
> unless (forbid) you're running as root.
>
> Change ownership of the log directory to the same user as is running
> the webserver.
Yes.. that was the problem..
Those directories were created when I logged in as root.. and so the
http did not have the authority to write into those directories..
Thanks a lot.
------------------------------
Date: Tue, 07 Sep 2004 03:02:06 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Desparate, tired programmer -- bug in perl5.6.1/apache1.3.31 ?
Message-Id: <2q4g25FrekmhU1@uni-berlin.de>
Ryan Saunders wrote:
> Gunnar Hjalmarsson wrote:
>> Can it be that PHP is configured to run in "Safe Mode"?
>
> Perhaps...but PHP is able to write the file just fine...why/how
> would "safe mode" cause a program invoked via system() to otherwise
> run correctly but be unable to open a file for writing? That seems
> like more sophistication than system() should be able to pull
> off...
Well, it was just a thought, and it would make sense only if the PHP
script and the CGI script have different owners.
Think the discussion has drifted off-topic. :)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 7 Sep 2004 03:09:40 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: Dynamic hash names
Message-Id: <Xns955CE24D7EF9Aebohlmanomsdevcom@130.133.1.4>
"yusufdestina" <joericochuyt@msn.com> wrote in
news:6f561533c37fde0a80d70239c2f5981d@localhost.talkaboutprogramming.com:
> Tnx a lot m8, I'm going to buy some books :)
Before you do that, make sure you've familiarized yourself with Perl's
built-in documentation (perldoc perldoc will get you started). There's an
awful lot you can learn there without having to spend any money at all, and
once you know it you'll be in a better position to decide which, if any,
books are worth spending your money on (hmm, maybe Stinginess should be the
fourth of the Perl Virtues).
------------------------------
Date: Tue, 07 Sep 2004 01:09:18 GMT
From: "bopew2000" <bopew2000@yahoo.com>
Subject: GD.pm make test failed, help please?
Message-Id: <2T7%c.101853$A8.1617@edtnps89>
Hi guys,
I am trying to install GD.pm 2.15 on a Fedora 2 box. The make went fine, but
I got this when I do make test.
Any help please? Thanks!
# make test TEST_VERBOSE=1
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(1, 'blib/lib', 'blib/arch')" t/*.t
t/GD..........1..10
ok 1
not ok 2
not ok 3
not ok 4
not ok 5
not ok 6
not ok 7
ok 8 # Skip, FreeType changes too frequently to be testable
ok 9 # Skip, no XPM support
not ok 10
FAILED tests 2-7, 10
Failed 7/10 tests, 30.00% okay (less 2 skipped tests: 1 okay,
10.00%)
t/Polyline....1..1
# Running under perl version 5.008003 for linux
# Current time local: Mon Sep 6 17:59:25 2004
# Current time GMT: Tue Sep 7 00:59:25 2004
# Using Test.pm version 1.24
ok 1
ok
Failed Test Stat Wstat Total Fail Failed List of Failed
----------------------------------------------------------------------------
---
t/GD.t 10 7 70.00% 2-7 10
2 subtests skipped.
Failed 1/2 test scripts, 50.00% okay. 7/11 subtests failed, 36.36% okay.
make: *** [test_dynamic] Error 255
------------------------------
Date: Tue, 07 Sep 2004 01:41:30 GMT
From: "Harris" <warewolfe@hotmail.com>
Subject: Help with POD in Win98 (activeperl)
Message-Id: <el8%c.22708$N77.1015054@news.xtra.co.nz>
I'm trying to use the POD translators to convert my comments into
either a text file or a html page. I've used the commandline calls
"pod2text test.pl | more" "pod2text test.pl > test.txt" as well as the
pod2html translator. (all from Programming Perl 3rd Ed)
All I get is a printout to the screen, the test.txt or test.html is
created but with nothing inside. Even piping the output to more or /p
doesn't do anything.
------------------------------
Date: Mon, 06 Sep 2004 22:00:39 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Help with POD in Win98 (activeperl)
Message-Id: <chj4oc$ces$1@misc-cct.server.rpi.edu>
Harris wrote:
> I'm trying to use the POD translators to convert my comments into
> either a text file or a html page. I've used the commandline calls
> "pod2text test.pl | more" "pod2text test.pl > test.txt" as well as the
> pod2html translator. (all from Programming Perl 3rd Ed)
> All I get is a printout to the screen, the test.txt or test.html is
> created but with nothing inside. Even piping the output to more or /p
> doesn't do anything.
Did you try the syntax specified by both
perldoc pod2text
and
pod2text -h
?
They say that the output file should be specified on the command line,
right after the input file...
Let us know the results of that command, please.
Paul Lalli
------------------------------
Date: 6 Sep 2004 20:58:09 -0700
From: chad@wononline.net (Chad Brown)
Subject: Network Scanner
Message-Id: <ea150da0.0409061958.21dbb6fa@posting.google.com>
I put together a script for scaning a network. Features are DNS
resolution, selective port scan, scanning of multiple addresses at one
time, and ping sweep. Ports can be customized depending on what is
being sought on a network. If anyone decides to add more ideas to this
please send me a copy. Im very interested in input. (:
http://onager.guild.net/~vrai/
chad@wononline.net
#!/usr/bin/perl
#usage--> netsweep 20.0.0.1
use Socket;
use Net::Ping;
@ports = (21,22,23,80,110,119,1080,8080);
$Max_Processes = 20;
$Target_IP = $ARGV[0];
#---Startup
if ( $Target_IP eq "" ) {
die "need target ip...\n";
}
@Target_IP_Sep = IP_Seperate($Target_IP);
$TA = @Target_IP_Sep[0];
$TB = @Target_IP_Sep[1];
$TC = @Target_IP_Sep[2];
$Start_Addy = $TA.".".$TB.".".$TC.".0";
$End_Addy = $TA.".".$TB.".".$TC.".255";
$Current_Long = Dot2Long_IP($Start_Addy);
$End_Long = Dot2Long_IP($End_Addy);
#---Main workload control routines
$stp = 0;
$npids = 0;
while () {
#forker
FORK: {
if ($pid=fork) {
#return $pids;
}
elsif (defined $pid) {
Connect_IP(Long2Dot_IP($Current_Long));
}
elsif ($! == EAGAIN) {
sleep 3;
redo FORK;
}
else {
die "cant fork!\n";
}
}
#fork control
$npids++;
if($npids>=$Max_Processes){
$wait_ret=wait();
if($wait_ret>0){
$npids--;
}
}
#iterate to next IP
$Current_Long++;
#look for end IP
if ($Current_Long eq $End_Long+1) {
sleep(2);
exit(0);
};
}
#---Sub Functions
sub Dot2Long_IP {
return unpack('N', inet_aton(shift));
}
sub Long2Dot_IP {
return inet_ntoa(pack('N', shift));
}
sub IP_Seperate {
my ($IP_Address) = @_ ;
@IP_SepArr = split(/\./,$IP_Address);
return @IP_SepArr;
}
sub Connect_IP($IP_Addy){
my ($tghost) = @_ ;
$connect_list = "";
$connect_list = $tghost;
#getting host name
$host_ipaddr = inet_aton($tghost);
$host_name = gethostbyaddr($host_ipaddr, AF_INET);
if ($host_name eq "") {
$host_name = "NR";
}
$connect_list = $connect_list." $host_name";
#pinging target
$p = Net::Ping->new("icmp");
if ($p->ping($tghost)) {
$connect_list = $connect_list." TG_A"; #for returns
}
else {
$connect_list = $connect_list." TG_N"; #for negatives
}
$p->close();
#start scan on ports
foreach $port (@ports) {
$AF_INET=2;
$SOCK_STREAM=1;
$sockaddr='S n a4 x8';
($name,$aliases,$proto)=getprotobyname('tcp');
($name,$aliases,$type,$len,$thataddr)=gethostbyname($tghost);
$this=pack($sockaddr,$AF_INET,0,$thisaddr);
$that=pack($sockaddr,$AF_INET,$port,$thataddr);
die "unknown host $tghost\n" if($thataddr eq "");
socket(S,$AF_INET,$SOCK_STREAM,$proto) or die $!;
bind(S,$this) or die $!;
if(connect(S,$that)) {
$connect_list = $connect_list." ".$port;
close(S)
}
else {
close(S);
}
}
print "$connect_list\n";
$connect_list = "";
exit();
}
------------------------------
Date: Tue, 07 Sep 2004 04:04:20 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Network Scanner
Message-Id: <x7k6v6sp2m.fsf@mail.sysarch.com>
>>>>> "CB" == Chad Brown <chad@wononline.net> writes:
CB> I put together a script for scaning a network. Features are DNS
CB> resolution, selective port scan, scanning of multiple addresses at one
CB> time, and ping sweep. Ports can be customized depending on what is
CB> being sought on a network. If anyone decides to add more ideas to this
CB> please send me a copy. Im very interested in input. (:
CB> http://onager.guild.net/~vrai/
CB> chad@wononline.net
CB> #!/usr/bin/perl
CB> #usage--> netsweep 20.0.0.1
CB> use Socket;
CB> use Net::Ping;
no strict or warnings. fix that first and then i will comment on the
rest.
<snip of unstrict/unwarned code>
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Mon, 06 Sep 2004 23:59:07 -0500
From: parv <parv_@yahooWhereElse.com>
Subject: Problem using some delimiters in s///x
Message-Id: <slrncjqg4o.5if.parv_@localhost.holy.cow>
I am using Perl 5.8.5 in which there seems to be problem w/ some
delimiters in s///. If not_ok* subs are uncommented (or equivalent
statements are used elsewhere), perl quits w/ the following error
message...
Substitution replacement not terminated at \
<file name> line <line number>.
Below is small test program...
# 'polka' should be transformed to 'PeeOLCa' if not_ok* subs & their
# usage are not commented
#
use warnings;
use strict;
my $p = 'polka';
ok_bra();
ok_par();
#not_ok_ex();
#not_ok_com();
print $p;
sub ok_bra { $p =~ s{k} /C/x; }
sub ok_par { $p =~ s(p) /Pee/x; }
#sub not_ok_ex { $p =~ s!o! /O/x; }
#sub not_ok_com { $p =~ s,l, /L/x; }
Perl version...
Summary of my perl5 (revision 5 version 8 subversion 5) configuration:
Platform:
osname=freebsd, osvers=4.9-release-p11, archname=i386-freebsd-64int
uname='freebsd moo.holy.cow 4.9-release-p11 freebsd 4.9-release-p11 #4: thu jul 1 23:37:18 edt 2004 root@moo.holy.cow:miscsrc-4.9sysbovine i386 '
config_args='-sde -Dprefix=/misc/local -Darchlib=/misc/local/lib/perl5/5.8.5/mach -Dprivlib=/misc/local/lib/perl5/5.8.5 -Dman3dir=/misc/local/lib/perl5/5.8.5/perl/man/man3 -Dman1dir=/misc/local/man/man1 -Dsitearch=/misc/local/lib/perl5/site_perl/5.8.5/mach -Dsitelib=/misc/local/lib/perl5/site_perl/5.8.5 -Dscriptdir=/misc/local/bin -Dsiteman3dir=/misc/local/lib/perl5/5.8.5/man/man3 -Dsiteman1dir=/misc/local/man/man1 -DDEBUGGING -Ui_malloc -Ui_iconv -Uinstallusrbinperl -Dcc=cc -Doptimize=-O -pipe -g -march=pentiumpro -Duseshrplib -Dccflags=-DAPPLLIB_EXP="/misc/local/lib/perl5/5.8.5/BSDPAN" -Ud_dosuid -Di_gdbm -Dusethreads=n -Dusemymalloc=y -Duse64bitint'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=undef uselongdouble=undef
usemymalloc=y, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-DAPPLLIB_EXP="/misc/local/lib/perl5/5.8.5/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include',
optimize='-O -pipe -g -march=pentiumpro',
cppflags='-DAPPLLIB_EXP="/misc/local/lib/perl5/5.8.5/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include'
ccversion='', gccversion='2.95.4 20020320 [FreeBSD]', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags ='-Wl,-E -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lgdbm -lm -lcrypt -lutil -lc
perllibs=-lm -lcrypt -lutil -lc
libc=, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -Wl,-R/misc/local/lib/perl5/5.8.5/mach/CORE'
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING USE_64_BIT_INT USE_LARGE_FILES
Built under freebsd
Compiled at Aug 14 2004 20:35:57
%ENV:
PERL5LIB=".:/home/parv/comp/perl/dist-test/modules"
@INC:
.
/home/parv/comp/perl/dist-test/modules/i386-freebsd-64int
/home/parv/comp/perl/dist-test/modules
/misc/local/lib/perl5/site_perl/5.8.5/mach
/misc/local/lib/perl5/site_perl/5.8.5
/misc/local/lib/perl5/site_perl/5.005
/misc/local/lib/perl5/site_perl
/misc/local/lib/perl5/5.8.5/BSDPAN
/misc/local/lib/perl5/5.8.5/mach
/misc/local/lib/perl5/5.8.5
.
- parv
--
As nice it is to receive personal mail, too much sweetness causes
tooth decay. Unless you have burning desire to contact me, do not do
away w/ WhereElse in the address for private communication.
------------------------------
Date: Tue, 07 Sep 2004 05:14:54 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Problem using some delimiters in s///x
Message-Id: <x78ybmslt0.fsf@mail.sysarch.com>
>>>>> "p" == parv <parv_@yahooWhereElse.com> writes:
p> I am using Perl 5.8.5 in which there seems to be problem w/ some
p> delimiters in s///. If not_ok* subs are uncommented (or equivalent
p> statements are used elsewhere), perl quits w/ the following error
p> message...
p> sub ok_bra { $p =~ s{k} /C/x; }
p> sub ok_par { $p =~ s(p) /Pee/x; }
p> #sub not_ok_ex { $p =~ s!o! /O/x; }
p> #sub not_ok_com { $p =~ s,l, /L/x; }
from perlop s///:
If the PATTERN is delimited by bracketing quotes, the
REPLACEMENT has its own pair of quotes, which may or may not be
bracketing quotes, e.g., "s(foo)(bar)" or "s<foo>/bar/".
in the first two cases you start with paired delimiters so you can use
any kind of delimiter for the replacement part. in the latter two cases
you start with a non-paired delimiter so you must use 3 of them as with
s///. the /x has nothing to do with this (other than you must escape the
closing delimiter EVEN in comments when under /x). and the sub stuff has
nothing to do with this either. you could have had shown the s///
operations all by themselves and gotten the same errors
and the paired (called bracketing in the docs) delimiters are obviously
{}, [], () and <>.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Tue, 07 Sep 2004 00:32:29 -0500
From: parv <parv_@yahooWhereElse.com>
Subject: Re: Problem using some delimiters in s///x
Message-Id: <slrncjqi3a.6lm.parv_@localhost.holy.cow>
in message <x78ybmslt0.fsf@mail.sysarch.com>,
wrote Uri Guttman ...
>>>>>> "p" == parv <parv_@yahooWhereElse.com> writes:
>
> p> If not_ok* subs are uncommented (or equivalent
> p> statements are used elsewhere), perl quits w/ the following error
> p> message...
>
> p> sub ok_bra { $p =~ s{k} /C/x; }
> p> sub ok_par { $p =~ s(p) /Pee/x; }
>
> p> #sub not_ok_ex { $p =~ s!o! /O/x; }
> p> #sub not_ok_com { $p =~ s,l, /L/x; }
>
> from perlop s///:
>
> If the PATTERN is delimited by bracketing quotes, the
> REPLACEMENT has its own pair of quotes, which may or may not be
> bracketing quotes, e.g., "s(foo)(bar)" or "s<foo>/bar/".
>
> in the first two cases you start with paired delimiters so you can
> use any kind of delimiter for the replacement part. in the latter
> two cases you start with a non-paired delimiter so you must use 3
> of them as with s///.
I do not consider the quoted perlop portion to be clear enough; i
will have to remember that.
Sorry for the noise generation.
> the /x has nothing to do with this
Well, that is how i discovered this non-problem. Otherwise, there
would have been three [!,].
> the sub stuff has nothing to do with this either. you could have
> had shown the s/// operations all by themselves and gotten the
> same errors
I know; i had already noted that in OP in the very first paragraph.
Thanks for clarifying the issue.
- parv
--
As nice it is to receive personal mail, too much sweetness causes
tooth decay. Unless you have burning desire to contact me, do not do
away w/ WhereElse in the address for private communication.
------------------------------
Date: Tue, 07 Sep 2004 05:44:56 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Problem using some delimiters in s///x
Message-Id: <x7zn42r5ui.fsf@mail.sysarch.com>
>>>>> "p" == parv <parv_@yahooWhereElse.com> writes:
p> in message <x78ybmslt0.fsf@mail.sysarch.com>,
p> wrote Uri Guttman ...
>> If the PATTERN is delimited by bracketing quotes, the
>> REPLACEMENT has its own pair of quotes, which may or may not be
>> bracketing quotes, e.g., "s(foo)(bar)" or "s<foo>/bar/".
p> I do not consider the quoted perlop portion to be clear enough; i
p> will have to remember that.
it seems clear to me. the pattern part delimiters determines what can be
the delimiters of the replacement part. your failing cases didn't have
paired delims so they must use that delim to close the s///.
and i don't recommend using odd (!,#) delims for s/// and m///. like
damian conway i prefer paired delims with / can't (shouldn't) be
used. his choice is {} and i generally use them now.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 6 Sep 2004 19:12:16 -0700
From: krishnakishore.r.challa.lzi1@statefarm.com (Kishore)
Subject: Trouble with permissions when creating files
Message-Id: <e1c7fb54.0409061812.6247d555@posting.google.com>
Hi..
I am having trouble with permissions when creating files throught the
perl program.
When I run the perl program through http, it creates files with
permissions 0600.. but if I run the same program through shell, the
files are created with 0644 permission.
I am not sure if this is the correct group to request help from.
here is the code I am using..
use Fcntl ':flock'; # import LOCK_* constants
open(LOG, ">>$LOG_FILE") or die "Cannot open logfile '$LOG_FILE' for
writing: $!";
flock(LOG, LOCK_EX);
seek(LOG, 0, 2);
print LOG "this is the line \n";
flock(LOG, LOCK_UN);
close(LOG);
Thanks in advance for your help.
Kishore.
------------------------------
Date: Tue, 07 Sep 2004 02:55:48 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: Trouble with permissions when creating files
Message-Id: <413D2332.8080107@rochester.rr.com>
Kishore wrote:
> Hi..
>
> I am having trouble with permissions when creating files throught the
> perl program.
>
> When I run the perl program through http, it creates files with
> permissions 0600.. but if I run the same program through shell, the
> files are created with 0644 permission.
>
> I am not sure if this is the correct group to request help from.
...
> Kishore.
You need to read up on CGI and the specifics of how your web server runs
CGI scripts. This problem has nothing to do with Perl, in the sense
that if your CGI script were written in C, Fortran, Befunge, or any
other language, you would have the same problem. You might consider
asking in a CGI newsgroup, but you really really should read up first.
Hint: When your web server runs your script, it is running as a
different user, with different priviledges and default permissions.
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Tue, 07 Sep 2004 04:53:07 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Trouble with permissions when creating files
Message-Id: <2q4mleFqcn36U1@uni-berlin.de>
Kishore wrote:
> I am having trouble with permissions when creating files throught the
> perl program.
>
> When I run the perl program through http, it creates files with
> permissions 0600.. but if I run the same program through shell, the
> files are created with 0644 permission.
Set umask to 022 before opening the file.
> use Fcntl ':flock'; # import LOCK_* constants
> open(LOG, ">>$LOG_FILE") or die "Cannot open logfile '$LOG_FILE' for
> writing: $!";
> flock(LOG, LOCK_EX);
> seek(LOG, 0, 2);
AFAIK, using seek that way is redundant when you append to a file
using '>>'.
> print LOG "this is the line \n";
> flock(LOG, LOCK_UN);
That's also redundant. The file gets unlocked when you close the
filehandle.
> close(LOG);
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Tue, 07 Sep 2004 13:12:21 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Trouble with permissions when creating files
Message-Id: <2q4n6dFrj1vuU2@uni-berlin.de>
Kishore wrote:
> Hi..
>
> I am having trouble with permissions when creating files throught the
> perl program.
>
> When I run the perl program through http, it creates files with
> permissions 0600.. but if I run the same program through shell, the
> files are created with 0644 permission.
>
> I am not sure if this is the correct group to request help from.
If you are using Apache then you could be running under a cgi wrapper. This
sets userid & permissions to "sane" values before running the Perl script
as cgi. Setting the umask may solve the problem.
See http://httpd.apache.org/docs/suexec.html
gtoomey
------------------------------
Date: Mon, 6 Sep 2004 19:26:31 -0700
From: "187" <bigal187@invalid.rx.eastcoasttfc.com>
Subject: Re: two's compliment?
Message-Id: <2q4kfeFrmjplU1@uni-berlin.de>
Joe Smith wrote:
> 187 wrote:
>
> Thank you for your reply. I udnerstand how it became overloaded, but
>> then why does this happen?
>>
>> print ~-31, "\n", ~30
>>
>> Output:
>>
>> 30
>> 4294967265
>>
>> Why does the 2nd statement not return -31? Is it Perl not wanting to
>> return a signed number? This seems rather incorrect, mathimatically.
>
> In the first one, a signed 32-bit integer is treated as an unsigned
> 32-bit number, complemented, and displayed as an unsigned 32-bit
> number. In the second one, a positive signed 32-bit integer is
> already in
> the unsigned form, complemented, and displayed as an unsigned 32-bit
> number. Both are consistent in converting the input argument to
> a set of 32 bits and returning a set of 32 bits.
Thank you, but why then do most calculators with a Not (TI's, like my
86) / Complement function return -31 for Not 30 ?
This difference is what really baking my noodle here! :-)
------------------------------
Date: Tue, 07 Sep 2004 00:44:03 -0400
From: Roland Hutchinson <my.spamtrap@verizon.net>
Subject: Re: Xah Lee's Unixism
Message-Id: <2q4skjFrb6p1U1@uni-berlin.de>
In article <Pine.LNX.4.61.0409062355010.20478@ppepc56.ph.gla.ac.uk> on
Monday 06 September 2004 18:55, Alan J. Flavell wrote:
> On Tue, 7 Sep 2004, John Thingstad wrote:
>
>> It was the realization of www (CERN) that spawned the movement toward the
>> Internet.
>
> Eh?
A simple case of cart/horse inversion, methinks.
--
Roland Hutchinson Will play viola da gamba for food.
NB mail to my.spamtrap [at] verizon.net is heavily filtered to
remove spam. If your message looks like spam I may not see it.
------------------------------
Date: Tue, 07 Sep 2004 07:00:23 GMT
From: Morten Reistad <firstname@lastname.pr1v.n0>
Subject: Re: Xah Lee's Unixism
Message-Id: <t7mjhc.ubd.ln@via.reistad.priv.no>
In article <opsdxecgt8pqzri1@mjolner.upc.no>,
John Thingstad <john.thingstad@chello.no> wrote:
>On Mon, 6 Sep 2004 18:56:33 +0200, Morten Reistad
><firstname@lastname.pr1v.n0> wrote:
>
>> In article <413c5b9c$0$19705$61fed72c@news.rcn.com>,
>> <jmfbahciv@aol.com> wrote:
>> TCP/IP was launched in 1982, and the Internet (or the Arpanet, rather)
>> converted Jan 1st 1983; with final NCP service turned off everywhere
>> by mid march 1983.
>>
>> Tops20 has an IP package; but it was pretty rudimentary in version 4,
>> and not quite complete even by those standards even in version 7.
>>
>> .. mrr
>>
>>
>
>Internet was discovered long before this.
>(In 1965 a research project, by the Rand cooperation, for a network that
>could survive a nuclear attack. Sponsored by DARPA.
Since I am on a roll with timelines; just one off the top of my head :
Project start : 1964
First link : 1969
Transatlantic : 1972 (to Britain and Norway)
Congested : 1976
TCP/IP : 1983 (the effort started 1979) (sort of a 2.0 version)
First ISP : 1983 (uunet, EUnet followed next year)
Nework Separation : 1983 (milnet broke out)
Large-scale design: 1987 (NSFnet, but still only T3/T1's)
Fully commercial : 1991 (WIth the "CIX War")
Web launced : 1992
Web got momentum : 1994
Dotcom bubble : 1999 (but it provided enough bandwith for the first time)
Dotcom burst : 2001
>These is the real creators of the Internet technology. Not Unix hackers.)
>It was the realization of www (CERN) that spawned the movement toward the
>Internet.
>So the year in question is about 1987.
In 1987 the Internet wasn't even commercial. You had to apply to get in.
We fought a bitter fight to break this open in 1990-1991.
It was official policy of governements to stay with ITU (then CCITT)
protocols and OSI/whatever until the web was well deployed. This even
goes for the US government.
-- mrr
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 6968
***************************************