[16088] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3500 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 28 11:05:28 2000

Date: Wed, 28 Jun 2000 08:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <962204712-v9-i3500@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 28 Jun 2000     Volume: 9 Number: 3500

Today's topics:
        Calling object functions <tboberek@ccs.neu.edu>
    Re: Cant get perl cgi result (directly..) <thomastk@my-deja.com>
    Re: Convert value to numeric (Tad McClellan)
    Re: Defining regular expression char class (jason)
    Re: Defining regular expression char class (jason)
        dereferencing question <naidenm@americasm01.nt.com>
    Re: dereferencing question (Tad McClellan)
    Re: dereferencing question <stephen.kloder@gtri.gatech.edu>
    Re: dereferencing question <naidenm@americasm01.nt.com>
    Re: different behaviour when running from web and comma (Tad McClellan)
    Re: file input (Tad McClellan)
    Re: Golf problem (Andrew Johnson)
    Re: Help with 'If' condition - newbie <mike@shupp.com>
    Re: Help With Reg Exp. (jason)
    Re: How to access all the files in a dir including its  (Tad McClellan)
    Re: how to count number of line in a file ? <bill.kemp@wire2.com>
    Re: How to maniputlate windows' filenames with perl? (jason)
    Re: Image::Magick installation failed <randy@theoryx5.uwinnipeg.ca>
    Re: LWP::UserAgent blocking problem <ke77le@my-deja.com>
    Re: perl 5.6: bug with -0777 slurping? ()
    Re: Perl/cgi newbie questions <sariq@texas.net>
    Re: Permissions -is 750  full read write access? (Tad McClellan)
    Re: Permissions -is 750 full read write access? turnere@cc.wwu.edu
    Re: Permissions -is 750 full read write access? <pap@NOTHEREsotonians.org.uk>
    Re: Permissions -is 750 full read write access? <pap@NOTHEREsotonians.org.uk>
    Re: Permissions -is 750 full read write access? <sariq@texas.net>
        regex and hashes <chris@inta.net.uk>
    Re: regex and hashes <tony_curtis32@yahoo.com>
    Re: Rookie's question turnere@cc.wwu.edu
    Re: sending SMS <news@fido.workone.com>
    Re: Telnet.pm module <thomastk@my-deja.com>
    Re: V4 vs V5 sourcing problem <care227@attglobal.net>
    Re: V4 vs V5 sourcing problem <care227@attglobal.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 28 Jun 2000 10:20:50 -0400
From: "Thomas J. Boberek" <tboberek@ccs.neu.edu>
Subject: Calling object functions
Message-Id: <Pine.OSF.4.21.0006280953451.1440-100000@boron.ccs.neu.edu>

I'm not exactly sure if this is the right group, but hopefully someone
here can help me with this.

I have a perl program that uses packages and objects extensively, and I've
run into a problem calling functions with variables.  This doesn't work
for me:

$thisDevice = new deviceObject;
$section = 'lccc';
$test = $thisDevice->$section;

What this is supposed to do is return the value of the $lccc variable in
the deviceObject.  This is the function:

sub lccc {
	return $lccc;
}

I have a number of functions like this, and wish to cycle through them,
which is why I use a variable to hold the function name that I wish to
execute.  I get a syntax error everytime I run this, right at the
$section.  So, I was wondering if there was any way to do this, or is it
just impossible?

I'm using perl 5.005_03.

Thanks in advance for any help/suggestions.

-T.J.

--
T.J. Boberek				"Illinois Nazis?  I HATE Illinois  
tboberek@ccs.neu.edu			 Nazis."



------------------------------

Date: Wed, 28 Jun 2000 14:50:17 GMT
From: thoma <thomastk@my-deja.com>
Subject: Re: Cant get perl cgi result (directly..)
Message-Id: <8jd3b2$bqd$1@nnrp1.deja.com>

Add the following line in the beginning of Perl script:

$| = 1;

In article <8jc7g0$ne6$1@nnrp1.deja.com>,
  omtslug@my-deja.com wrote:
> Hi! I'm stuck with my perl cgi script which creates a
> bash file (variabel setup and source of other scripts) and
> then executing it.
> I don't get my html response until the script finishes which
> might be up to 1 hour..
> I've made stdout unbuffered but it still doesn't work.
> I also got the suggestion to close stdout which then delivers
> the browser output directly but I don't get any logging from
> my executed script to it's logfile.
>
> I don't know if this is a perl or apache problem and I can't
> get this to work.
> All tips appreciated.
>
> Running Apache 1.3.12 on NT4, perl 5.004_02.
>
> BR
>  Stefan
>
> ps. You get the same result just doing a sleep instead
> of the exec. ds
>
> Here's some code:
> #------------------------------------------------------------
> #!/usr/bin/Perl -w
> $forminfo = <STDIN>;
> $formpure = $forminfo;
> $forminfo =~ s/&/\n/g;
>
> [snip] here I get some vars from the form
>
> ($a,$a,$a,$mday,$mon,$a,$a,$a,$a) = localtime;
> $buildfile="bs_".sprintf("%02d%02d%d", $mon+1, $mday, time);
>
> select(STDERR); $| = 1;
> select(STDOUT); $| = 1;
>
> print "Content-type: text/html \n\n";
> print "<html><head>";
> print "<title>Build Confirm</title>";
> print "</head>";
> print "<body bgcolor=lightblue>";
> print "Thank you! Your input has been processed and the kit<br>";
> print "build is started. Your build id is: ".$buildfile;
> print "<p>Links to your setup file and log file:<br>";
> print "<a href=/buildset/".$buildfile.".sh>".$buildfile.".sh<br>";
> print "<a href=/buildset/".$buildfile.".log>".$buildfile.".log</p>";
> print "</body></html>";
> print "\n\n";
> print "\015\012";              #nothing helps...
>
> [snip] Here I generate the bash shell file (buildfile.sh)
>
> # force the server to deliver the content.........
> #close(STDOUT); #close(STDERR);      # this kills my buildfile.sh
> output below!!
>
> exec "/Cygnus/cygwin-b20/H-i586-
> cygwin32/bin/bash.exe ".$buildsetupdir."/".$buildfile.".sh
> > ".$buildsetupdir."/".$buildfile.".log 2>&1";
>
> exit(0);
> #------------------------------------------------------
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Wed, 28 Jun 2000 08:14:42 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Convert value to numeric
Message-Id: <slrn8ljr1i.1ib.tadmc@magna.metronet.com>

On Wed, 28 Jun 2000 10:53:42 +0100, William Ball <wball@wweb.co.uk> wrote:

>This has got to be dead simple!  I'm pretty new to PERL, 


We can tell (because nobody calls it "PERL").

"Perl" is used to refer to the language proper.

"perl" is used to refer to the implementation of the language
(the interpreter).

"PERL" is not used.


>It
>'should' contain just a number (maybe with a decimal point)
                         ^^^^^^
                         ^^^^^^

>Ideally all I want is
>$NumericValue = functionIdontknowthenameof($InputValue);
>or similar.


You are expected to check the Perl FAQ *before* posting
to the Perl newsgroup:

   perldoc -q number

   "How do I determine whether a scalar is a number/whole/integer/float?"


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Wed, 28 Jun 2000 14:37:49 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Defining regular expression char class
Message-Id: <MPG.13c4aaf85cb77d39989759@news>

netunl@my-deja.com writes ..
>I want to define a character class that only contains
>chars like ()\{}.><....
>I tried to do it like this, but it doesn't work:
>$chars=~s/[\W[^\s]]/TEST/g; # no word and no whitespace

\S (as in capital 's') is the inverse of \s .. hopefully that solves 
your problem (as long as you don't try [\W\S] - don't forget that those 
terms are ORed)

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: Wed, 28 Jun 2000 14:42:59 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Defining regular expression char class
Message-Id: <MPG.13c4ac33d9b3172998975a@news>

jason writes ..
>netunl@my-deja.com writes ..
>>I want to define a character class that only contains
>>chars like ()\{}.><....
>>I tried to do it like this, but it doesn't work:
>>$chars=~s/[\W[^\s]]/TEST/g; # no word and no whitespace
>
>\S (as in capital 's') is the inverse of \s .. hopefully that solves 
>your problem (as long as you don't try [\W\S] - don't forget that those 
>terms are ORed)

actually - that's not as clear on re-reading as it was on writing

a) you can't nest character classes

b) [\W] is equivalent to [^\w]

c) terms within a character class are ORed .. so [\W\S] is very 
different from [^\w\s]

hopefully that helps

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: Wed, 28 Jun 2000 10:07:57 -0400
From: "Markachev, Naiden [SKY:4Y21:EXCH]" <naidenm@americasm01.nt.com>
Subject: dereferencing question
Message-Id: <395A06BD.1654ECAF@americasm01.nt.com>

I have the following data structure 

$entry <--- hashref 

$entry ={

	key1 => [
		
		 [
			val1, 
			val2
		 ], 
		 [
			val3, 
			val4	
		 ],
		 [
			val5,
			val6
		]
		
	key2 => [
		  [
			val7, 

etc... 

In short I can access the elements in $entry's anonymous arrays like
this 
$entry->{'key1'}[0][1]  and this will give me val2. 

My question is how can I get the size of the outermost anon array [eg..
in the example the size of the outermost is 3 and the inermost is 2]
I tried a couple of variations using # but non of them worked for me. 


Thanks, 
Naiden


------------------------------

Date: Wed, 28 Jun 2000 09:40:56 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: dereferencing question
Message-Id: <slrn8lk038.1on.tadmc@magna.metronet.com>

On Wed, 28 Jun 2000 10:07:57 -0400, Markachev, Naiden [SKY:4Y21:EXCH] <naidenm@americasm01.nt.com> wrote:
>I have the following data structure 
>
>$entry <--- hashref 
>
>$entry ={
>
>	key1 => [
>		
>		 [
>			val1, 
>			val2
>		 ], 
>		 [
>			val3, 
>			val4	
>		 ],
>		 [
>			val5,
>			val6
>		]
>		
>	key2 => [
>		  [
>			val7, 
>
>etc... 
>
>$entry->{'key1'}[0][1]  and this will give me val2. 
>
>My question is how can I get the size of the outermost anon array [eg..
>in the example the size of the outermost is 3 and the inermost is 2]


   my $size = @{$entry->{key1}};


>I tried a couple of variations using # but non of them worked for me. 


The rule is: wherever you would put the name of the array, you
             can instead put a block returning a reference to
             an array.

So with a normal array:

   my $size = @array;
               ^^^^^

You can replace 'array' with '{$entry->{key1}}'.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Wed, 28 Jun 2000 10:39:08 -0400
From: Stephen Kloder <stephen.kloder@gtri.gatech.edu>
Subject: Re: dereferencing question
Message-Id: <395A0E0A.37D2381D@gtri.gatech.edu>

"Markachev, Naiden [SKY:4Y21:EXCH]" wrote:

> My question is how can I get the size of the outermost anon array [eg..
> in the example the size of the outermost is 3 and the inermost is 2]
> I tried a couple of variations using # but non of them worked for me.

$#array returns the last index, not the array size.  @array in scalar
context returns the size.

I recommend something like scalar @{$entry->{key1}} for the outer array and
(similarly) scalar @{$entry->{key1}[$i]} for the $i'th inner array.




------------------------------

Date: Wed, 28 Jun 2000 10:48:21 -0400
From: "Markachev, Naiden [SKY:4Y21:EXCH]" <naidenm@americasm01.nt.com>
Subject: Re: dereferencing question
Message-Id: <395A1035.4D5B57CA@americasm01.nt.com>

Thanks Tad, 

I guess I needed to stop and think about the problem for a little bit
longer insted of posting right away. :)
So I did $#{$entry->{'key1'}[0]} and it works.. [somehow I was very
determined to do it with #.. ] 

Naiden 


> 
>    my $size = @{$entry->{key1}};
> 
> >I tried a couple of variations using # but non of them worked for me.
> 
> The rule is: wherever you would put the name of the array, you
>              can instead put a block returning a reference to
>              an array.
> 
> So with a normal array:
> 
>    my $size = @array;
>                ^^^^^
> 
> You can replace 'array' with '{$entry->{key1}}'.
> 
> --
>     Tad McClellan                          SGML Consulting
>     tadmc@metronet.com                     Perl programming
>     Fort Worth, Texas

-- 
"Witty quotes mean nothing" -- Voltaire


------------------------------

Date: Wed, 28 Jun 2000 08:18:58 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: different behaviour when running from web and command line
Message-Id: <slrn8ljr9i.1ib.tadmc@magna.metronet.com>

On 28 Jun 2000 18:16:02 +1000, Shao Zhang <shao@linux.cia.com.au> wrote:

>	I have wrote a simple perl script that basically does a query from a
>	website, however, it only works when run from command line, not
>	from the web...


Perl FAQ, part 9:

   "My CGI script runs from the command line but not the browser.
    (500 Server Error)"


>	Here is the code:
>
>print "<h3>looking up aunic for $domain ...</h3>\n";


Where do you output the headers?


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Wed, 28 Jun 2000 08:04:55 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: file input
Message-Id: <slrn8ljqf7.1ib.tadmc@magna.metronet.com>

On Wed, 28 Jun 2000 12:54:36 +0200, Kirill Miazine <kirillm@fido.workone.com> wrote:

>I prefer to have the things to substitute in a hash, like  
>$hash{'variable'} = "qwerty";
>
>then you just do following
>
>$hash{'alfa'} = "beta";
>open(FILE, "some.file");


Nobody would (should) do that!

Everybody *always* checks the return value from open():

   open(FILE, 'some.file') or die "could not open 'some.file'  $!";


>while (<FILE>) {
>	s/\$([a-z0-9_]+)/$hash{$1}/ige;
>	print;
>}
>close FILE;


That _discards_ substrings that are not hash keys (replaces with undef).

You do not need the s//e option because the replacement string
is "double quotish", and will interpolate the hash value without 'e'.

If you use the \w char class shorthand, then you can leave
off the s///i too:

   s/\$(\w+)/$hash{$1}/g;

or

   s/\$(\w+)/exists $hash{$1} ? $hash{$1} : '$' . $1/ge; # unchanged if not
                                                         # a hash key


>	s/(\$[a-z0-9_]+)/eval ($1)/ige;
                         ^^^^        ^

You can "stack" the s///e options, as the FAQ answer to
this question shows.

Attempting to restate the FAQ answer is a waste of time.

The FAQ answer has been looked over by hundreds of pairs
of eyes.

Trust the FAQ.

Do not try to repeat FAQ answers, just give the actual FAQ answer
or a pointer to the FAQ.



[ snip Jeopardy quote of "How can I expand variables in text strings?" ]


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Wed, 28 Jun 2000 14:56:20 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Golf problem
Message-Id: <omo65.2014$k5.37613@news1.rdc1.mb.home.com>

In article <slrn8ljm2r.ka1.abigail@alexandra.delanet.com>,
 Abigail <abigail@delanet.com> wrote:
[snip] 

> You can fix that by using one extra stroke:
> 
>     perl -pe '%c=();/^.{10}$/&!grep{$c{+lc}++}split""or$_=""' /usr/dict/words
 
And we can shave off 3 from that by using /./g instead of split""

    perl -pe '%c=();$_=""if!/^.{10}$/|grep{$c{+lc}++}/./g' /usr/dict/words

> And that will still fail if there are hyphens or other punctuation
> marks present.

ditto -- but at least "obfuscated" still passes :-)

andrew

-- 
Andrew L. Johnson   http://members.home.net/perl-epwp/
      The generation of random numbers is too 
      important to be left to chance.


------------------------------

Date: Wed, 28 Jun 2000 10:31:08 -0400
From: Mike Shupp <mike@shupp.com>
Subject: Re: Help with 'If' condition - newbie
Message-Id: <395A0C2C.23301304@shupp.com>

Thank you very, very much, one and all!

Sincerely,
Mike



Mtshupp wrote:
> 
> Hello,
> 
> Perl newbie here -- I'm attempting to modify a script;  I'm trying to describe
> a condition such that if a subtotal is less than 6.00, a shipping fee is 2.00;
> 6.00 - 9.99, shipping fee is 3.00;  ...and so forth.  The amounts are
> arbitrarily set.
> 
> So far, I have:
> 
> {
> 
> local ($shipping_price) = @_;
> 
> $ship = 2.00;
> 
> if ($shipping_price == 0)
>         {
>         $ship = 0;
>         }
> elsif ($shipping_price < 6.00)
>         {
>         $ship = $ship;
>         }
> else
> 
> ...and I'm kind of stuck after that (if that's even close).
> 
> I'd be very grateful for any help pointing me in the right direction.  The
> amounts I'm trying to use are:
> 
>  Subtotal is:       Shipping is:
> 
>   0.00 -  5.99              2.00
>   6.00 -  9.99              3.00
> 10.00 - 14.99              3.50
> 15.00 - 19.99              4.00
> 20.00 - up                 5.00
> 
> Thanks very much in advance for any help,
> Mike

-- 
_________________________________________
Mike Shupp  e-mail: mike@shupp.com
tel:  (703) 536-4222  fax: (209) 633-5075
web:  http://www.shupp.com


------------------------------

Date: Wed, 28 Jun 2000 13:53:07 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Help With Reg Exp.
Message-Id: <MPG.13c4a081eef97f7d989758@news>

spurcell writes ..
>Could someone step me through this please. I understand all the components,
>but when they are all placed together, I am getting lost. This comes from
>Tom C.s class. I really need help understanding what the regular expression
>is doing and how the line is getting pushed to the array.

from perlop - the last sentence is your clue

    The /g modifier specifies global pattern matching--that is, matching
    as many times as possible within the string. How it behaves
    depends on the context. In list context, it returns a list of
    all the substrings matched by all the parentheses in the regular
    expression. If there are no parentheses, it returns a list of all
    the matched strings, as if there were parentheses around the whole
    pattern.

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: Wed, 28 Jun 2000 08:20:33 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to access all the files in a dir including its sub dir?
Message-Id: <slrn8ljrch.1ib.tadmc@magna.metronet.com>

On Wed, 28 Jun 2000 14:16:37 +0800, multiplexor <abuse@localhost> wrote:

>For example, print the name of all files in a dir and its sub like the
>command in M$ DOS: dir *.* /s
>I heard that it needs recursive function. Can you give me a hint or point me
>to a source?


use File::Find;


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Wed, 28 Jun 2000 15:50:38 +0100
From: "W Kemp" <bill.kemp@wire2.com>
Subject: Re: how to count number of line in a file ?
Message-Id: <962203967.5368.0.nnrp-01.c3ad6973@news.demon.co.uk>


Abigail wrote in message ...
>W Kemp (bill.kemp@wire2.com) wrote on MMCDXCIII September MCMXCIII in
><URL:news:962178370.20899.0.nnrp-01.c3ad6973@news.demon.co.uk>:
>//
>//
>// I am suggesting the following _because_ it looks inefficient.
>// Any comments?
>//
>// open a FILE, then:-
>//
>// $i=0;
>// while(<FILE>){$i++}
>
>
>Why reinvent the wheel? Look up $. in perlvar.


Reason:- I suggested the above to see how bad you all think it is.
I have never used the above, but I end up doing something similar to skip
lines when going through a file (ie match a line, then skip  several lines
in a way similar to the above.)

? with $. you'd still read the whole file, but win at golf?
while(<FILE>){}
$i=$.;








------------------------------

Date: Wed, 28 Jun 2000 13:48:16 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: How to maniputlate windows' filenames with perl?
Message-Id: <MPG.13c49f5bfaa4b2eb989757@news>

Steve A. Taylor writes ..
>If I've missed the Perldocs that explain, let me know
>
>Question: How can I, without using
> dos commands, convert
> short filenames to long filenames
>
>Example, from short to long
>c:\html-p~2 gz 
>c:\HTML-Parser-3_08_tar.gz
>
>Discovering that quoted input is accepted
>helps and allows parsing -- but only after the shell's
>"dir/s/b %1" is used (these four lines are one
> wrapped line):
>
>dir/s/b "%1"|perl -MFile::Basename
>   -ne "chomp;s/_/./g; 
>   ($n,$p,$s)=fileparse( $_,'.gz' );
>   print \"$n $p $s\n\";"
>
>This turns c:\html-p~2 gz into
>HTML-Parser-3.08.tar  c:\  .gz
>But can perl do it without dir/s/b?

not sure what version of Perl or Windows operating system you're using 
 .. but readdir works fine for reading in long filenames under 5.005_03 
(522) on WinNT4SP6a

  perldoc -f readdir

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: 28 Jun 2000 14:04:09 GMT
From: Randy Kobes <randy@theoryx5.uwinnipeg.ca>
Subject: Re: Image::Magick installation failed
Message-Id: <8jd0kp$ip1$1@canopus.cc.umanitoba.ca>

In comp.lang.perl.misc, Lucas Tsoi <lucas@cplhk.com> wrote:
> Hi all I am to install Image::Magick,
> the error messages said:
[ ... ]
>  Magick.xs:78: magick/api.h: No such file or directory
>  make: *** [Magick.o] Error 1

> and the README document says that i have to LIBS and INC to include the
> appropriate path information to the required libMagick library.

In Makefile.PL, you'll see lines like
     'LIBS' => ['-L/pathos/home/cristy/ImageMagick/bzlib ....'],
     'INC' => '-I../ ....',
For LIBS, make sure that one of the -L/blah/blah entries 
corresponds to a location where libMagick.* is located
(as well, make sure that the path to your X libraries 
(eg, libX11.*) is also included as one of the -L entries). 
For INC, make sure that one of the -I/blah/blah entries 
corresponds to a directory that has in it a 
subdirectory "magick" that contains the .h files for 
ImageMagick (eg, api.h). Then run 'perl Makefile.PL' 
again. You may get some warnings  (suggested as 
'probably harmless') about not finding certain libraries, 
but if it compiles OK in the end, then these warnings 
are really harmless.

best regards,
randy kobes


------------------------------

Date: Wed, 28 Jun 2000 14:10:58 GMT
From: Kostis <ke77le@my-deja.com>
Subject: Re: LWP::UserAgent blocking problem
Message-Id: <8jd112$9s6$1@nnrp1.deja.com>

Thanks for your quick response.

> > $ua->timeout(60);
> >
> > But this didn't seem to have any effect.
>
> If you are not using perl-5.6.0, you might need to upgrade your IO
> modules to version 1.20 get connect timeout to work.

I did and now timeout gives me the expected results.

> And what happens after 60 seconds?  alarm?
>
Nothing obvious. The alarm was caught by some sub but the strace still
showed that the process was waiting to connect ...anyway it all works
beautifully now.

Many Thanks,
Kostis


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Wed, 28 Jun 2000 13:43:13 GMT
From: mike@excite.com ()
Subject: Re: perl 5.6: bug with -0777 slurping?
Message-Id: <slrn8lk0sn.93a.mike@zorak.happyfish.org>

Earlier, Jakob Schmidt <sumus@aut.dk> wrote:
>mike@excite.com () writes:
>
>> Why is the empty string treated as true by the
>> while loop?
>
>This is no bug though. It's documented in eg. perlop. We were just discussing
>it in "defined()"

That makes sense.  I still think the fact that <> is returning an
empty string is a bug, though.  I submitted this report via perlbug.

Thanks,
Mike


------------------------------

Date: Wed, 28 Jun 2000 08:20:35 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Perl/cgi newbie questions
Message-Id: <3959FBA3.E3CABEDC@texas.net>

"Mark P." wrote:
> 
> On Tue, 27 Jun 2000 11:44:33 -0600, rickh <rickh@burgoyne.com> wrote:
> 
> >When I access this program through my web browser, I get an "internal
> >error.  Looking at the error_log it would appear that the Print <<HTML
> >lines are the problem.  the error message indicates that they are not
> >numeric and appearently the << is the numeric left shift operator.
> >Question is What was the Print <<HTML line supposed to do?
> >
>         Check the Perl version. Your're probably running an old
> version that doesn't support HERE docs.

That's ridiculous.  To what version of Perl would you be referring?

Did you bother to test the posted code in *any* version?

- Tom


------------------------------

Date: Wed, 28 Jun 2000 08:11:08 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Permissions -is 750  full read write access?
Message-Id: <slrn8ljqqs.1ib.tadmc@magna.metronet.com>

On Wed, 28 Jun 2000 10:11:23 GMT, Bill Evans <wgevans@voyager.co.nz> wrote:

>First question :  Is there any point having the file set to 755 when
>the directory is set to 711 ?


That is not a Perl question.

Please ask Operating System questions in a newsgroup about
Operating Systems.


>Second question: 

Also not a Perl question.


>Third question:
>Incidentally this second firm "does not have error logs for individual
>accounts". 


Not a Perl question yet again.


>So I cannot set permissions and I cannot see an error log.


   use CGI::Carp 'fatalsToBrowser';


Perl FAQ, part 9:

   "How can I get better error messages from a CGI program?"


>Why would they structure things in this way?  


The bad kind of Laziness.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Wed, 28 Jun 2000 14:00:50 GMT
From: turnere@cc.wwu.edu
Subject: Re: Permissions -is 750 full read write access?
Message-Id: <8jd0e7$9cm$1@nnrp1.deja.com>

In article <395bce7d.6234928@news.voyager.co.nz>,
  wgevans@voyager.co.nz (Bill Evans) wrote:
> I have three questions related to a script I am
> using  that allows the user to upload files via a webpage form to a
> directory on the server. The script runs perfectly on one server where
> permissions for the directory are set to 711
> and the for the file are set to 755
> drwx--x--x -
> rwxr-xr-x
>
> First question :  Is there any point having the file set to 755 when
> the directory is set to 711 ?
>

No. Group and World read permissions are useless in a directory that
does not allow Group and World read permissions!

> Second question:
> On another server where I am not allowed to set permissions it does
> not run.  This server is running Velocigen.  I have tried running the
> script with Velocigen both disabled and enabled. I am told by the
> technical support that it is unlikely to be a permissions problem
> because all files have full read write access as standard. Permissions
> on this server are set to 750 for all files
> drwxr-x---
> -rwxr-x---
>  Is  this indeed full read write access?
> Is there anything in these permission settings that could prevent the
> script running?
>

The only way that this would work is if the web server daemon is running
as the root user, because write permission is only given to root when
using -rwxr-x--- (750) permission. Running a web server daemon as root
is considered VERY bad form, and most System Administrators don't do it.
If you really want to allow saving of files via a web form, you can
either:
   1. Find out which user the web server runs as, and what groups that
user is a member of. Then chgrp the upload directory to one of those
groups, and chmod 770 that directory.
   2. chmod 757 the upload directory, although this allows anyone with
an account on the server to write to the upload directory!

> Third question:
> Incidentally this second firm "does not have error logs for individual
> accounts".
> So I cannot set permissions and I cannot see an error log.
> Why would they structure things in this way?
>

The log you are interested in would be generated by the web server. Unix
boxes generally don't generate logs viewable by the average user. I'm
not sure about Velocigen, but Apache on my server generates a log in
/var/log/error_log. I suspect they just don't have the time to search
through the log (on a busy server the log can be very extensive).

It really sounds to me like the problem is that the web server is
running as some user other than root (this is a good thing), and that
user doesn't have write permissions to your upload directory.


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Wed, 28 Jun 2000 15:26:48 +0100
From: Paul Taylor <pap@NOTHEREsotonians.org.uk>
Subject: Re: Permissions -is 750 full read write access?
Message-Id: <395A0B28.68285FDE@NOTHEREsotonians.org.uk>


> > First question :  Is there any point having the file set to 755 when
> > the directory is set to 711 ?
> >
> 
> No. Group and World read permissions are useless in a directory that
> does not allow Group and World read permissions!
> 

Completely untrue.  I have just set up a directory as 0711 and put
a 0755 file in there.  I tried to access the directory and was duly
issued a 'Forbidden'.

I then accessed the file itself ( set to 0755 ) and had it proudly
displayed on my web-browser.

Lesson for today?  Local permissions on files override those of the
containing directory, at least with the Apache webserver on Debian
2.2.

Pap.


------------------------------

Date: Wed, 28 Jun 2000 15:29:31 +0100
From: Paul Taylor <pap@NOTHEREsotonians.org.uk>
Subject: Re: Permissions -is 750 full read write access?
Message-Id: <395A0BCB.4F7FEA9C@NOTHEREsotonians.org.uk>

> Lesson for today?  Local permissions on files override those of the
> containing directory, at least with the Apache webserver on Debian
> 2.2.

Of course, you'll definitely need the 0711 ( as opposed to 0700 ) or the
accessing process won't be able to cd into the directory.

Pap.


------------------------------

Date: Wed, 28 Jun 2000 09:41:41 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Permissions -is 750 full read write access?
Message-Id: <395A0EA5.5A8ADDE3@texas.net>

turnere@cc.wwu.edu wrote:
> 
> In article <395bce7d.6234928@news.voyager.co.nz>,
>   wgevans@voyager.co.nz (Bill Evans) wrote:
> > I have three questions related to a script I am
> > using  that allows the user to upload files via a webpage form to a
> > directory on the server. The script runs perfectly on one server where
> > permissions for the directory are set to 711
> > and the for the file are set to 755
> > drwx--x--x -
> > rwxr-xr-x
> >
> > First question :  Is there any point having the file set to 755 when
> > the directory is set to 711 ?
> >
> 
> No. Group and World read permissions are useless in a directory that
> does not allow Group and World read permissions!

Garbage.

<snipped rest of garbage>

This is a perfect example of why posters should always stay *on topic*.

- Tom


------------------------------

Date: Wed, 28 Jun 2000 15:51:33 +0100
From: "Chris Denman" <chris@inta.net.uk>
Subject: regex and hashes
Message-Id: <8jd3e1$1sqr$1@news2.vas-net.net>

I have a hash array as follows:

$hash{'john'}='1';
$hash{'John'}='2';
$hash{'JOHN'}='3';

and I want to somehow do a case insensitive lookup for 'john' to bring back
3 values without going through all of the keys.

Is there a way?
i.e.
print $hash{/john/i};

The reason is that the hash has thousands of keys and checking every one of
them would be too resourceful.

I have looked all over the place and have tried loads of things to no avail.

Thanks,

Chris




------------------------------

Date: 28 Jun 2000 10:03:25 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: regex and hashes
Message-Id: <87vgytx2yq.fsf@limey.hpcc.uh.edu>

>> On Wed, 28 Jun 2000 15:51:33 +0100,
>> "Chris Denman" <chris@inta.net.uk> said:

> I have a hash array as follows: $hash{'john'}='1';
> $hash{'John'}='2'; $hash{'JOHN'}='3';

> and I want to somehow do a case insensitive lookup for
> 'john' to bring back 3 values without going through all
> of the keys.

> Is there a way?  i.e.  print $hash{/john/i};

One thing you might consider doing if you have control
over the data is to canonicalise the keys and store values
as:

    $hash{john} = [ 1, 2, 3 ];

i.e. always lc($key) before storing things, and push new
data into the value for that key.

    use strict;
    use Data::Dumper;
    
    my %hash;
    
    $hash{john} = [ 1, 2, 3 ];
    $hash{tony} = [ 7, 8, 9 ];
    
    print Dumper(\%hash);
    
    my $key = 'JOHN';
    
    push @{$hash{lc $key}}, 4;
    
    print Dumper(\%hash);


More directly, I don't think there's any way you can avoid
linearity here, you'll have to iterate and canonicalise
the keys into either upper or lower case before comparing
them (you presumably want an exact match so avoid regexps,
just use string compare).

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


------------------------------

Date: Wed, 28 Jun 2000 14:18:57 GMT
From: turnere@cc.wwu.edu
Subject: Re: Rookie's question
Message-Id: <8jd1fu$a8t$1@nnrp1.deja.com>

In article <8jc1e8$n2p$1@eng-ser1.erg.cuhk.edu.hk>,
  wstsoi@ee.cuhk.hk (TSOI_WING_SHING) wrote:
>
> HI How could I know what modules my Perl have?
> And their versions, documents under Unix.
>
> Just liked online document and ppm of ActivePerl.
>
> Thanks very much!!!
>

On my system, perl modules are installed in /usr/lib/perl5. For example,
the CGI perl module is /usr/lib/perl5/CGI.pm. By looking in
/usr/lib/perl5 (and subdirectories thereof) you should be able to
determine which modules are installed. Or use perldoc to see if
documentation exists for the module you are interested in (e.g. perldoc
CGI or perldoc Net::FTP). If the documentation exists, chances are very
good that the module is also available to use :-)


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Wed, 28 Jun 2000 15:50:51 +0200
From: Kirill Miazine <news@fido.workone.com>
Subject: Re: sending SMS
Message-Id: <Pine.LNX.4.21.0006281545180.20323-100000@zebul.uio.no>

Hi,
This depends on who is going to recive your SMS. Almost every GSM provider
have some kind of email addresses for their customers (I use NetCom GSM
and to send an sms message to my phone simply send an email to
47........@sms.netcom.no - this is an example)

So you should start searching for those sms-strings if you want to make a
script that can send sms'es to german, english etc... people simply by
asking them to fill in their tel.nr. and to choose their provider from a
select-menu.

Hope this helps

On Wed, 28 Jun 2000, Chris M. Wagner wrote:

# And to which adress do I have to send the mail? (free - if possible :-)   )
# 
# > Sure, as an email!
# 
# 
# 
# 



------------------------------

Date: Wed, 28 Jun 2000 14:46:05 GMT
From: thoma <thomastk@my-deja.com>
Subject: Re: Telnet.pm module
Message-Id: <8jd337$bm4$1@nnrp1.deja.com>

Tom, you are right, I have a broken installation of Net::Telnet module.
So I was trying to use it as a custom module. This error doesn't appear
if you got Telnet.pm installed correctly.

Thanks
Thomas.
In article <Pine.GSO.4.10.10006261623560.23149-
100000@user2.teleport.com>,
  Tom Phoenix <rootbeer@redcat.com> wrote:
> On Mon, 26 Jun 2000, thoma wrote:
>
> > I use Telnet.pm module to communicate with terminal servers.
Whenever,
> > I do a Telnet session from my Perl CGI program, I get the following
> > warning:
> >
> > Argument "" isn't numeric in gt at bin/Telnet.pm line 2569.
>
> What's Telnet.pm? It's not something derived from Net::Telnet, is it?
> What's it doing in bin/Telnet?
>
> I think you've got a broken installation of Net::Telnet, but I can't
be
> certain.
>
> > Even though, it is harmless, it's kind of disturbing to see on the
web
> > browser. Is there any way this could be fixed or supressed?
>
> Probably fixed is better than suppressed. Have you looked at line
2569 of
> your bin/Telnet.pm file to see what it's doing?
>
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Wed, 28 Jun 2000 09:57:13 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: V4 vs V5 sourcing problem
Message-Id: <395A0439.FEB687E1@attglobal.net>

Ron Auer wrote:
> 
> 
> The /etc/Tivoli/setup_env.sh permissions are set to -rw-r--r-- so it has
> to be a sourcing problem.  I can't reset permissions to be executable so
> I have to find a way around the sourcing issue.

A file must have execute permissions to be run in the way that 
you are calling it.  I wager that if you set the permissions to 
-rwxr-xr-x it would work in the way that you are using it.

Or alter the command to `sh /etc/Tivoli/setup_evn.sh`

Either way, what does this have to do with Perl?


------------------------------

Date: Wed, 28 Jun 2000 09:58:38 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: V4 vs V5 sourcing problem
Message-Id: <395A048E.CCB229D6@attglobal.net>

Drew Simonis wrote:
> 

erm.. my bad, I thought he was execing a shell script.
Didn't read the subject.  I'm going to sleep now.


------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 3500
**************************************


home help back first fref pref prev next nref lref last post