[17590] in Perl-Users-Digest
Perl-Users Digest, Issue: 5010 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 1 14:10:36 2000
Date: Fri, 1 Dec 2000 11:10:17 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <975697816-v9-i5010@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 1 Dec 2000 Volume: 9 Number: 5010
Today's topics:
passing !~ <prlawrence@lehigh.edu>
Re: passing !~ <uri@sysarch.com>
Perl string converter (Anno Siegel)
Re: Perl string converter (Abigail)
Problem with GD <koke36@hotmail.com>
Re: Random password generator simbean@my-deja.com
Re: Random password generator (Tad McClellan)
Re: Random password generator (Lou Hevly)
Re: Reading file into array. nobull@mail.com
Re: reading from <STDIN> simbean@my-deja.com
Re: regex not matching <ren.maddox@tivoli.com>
Re: Should { } always indicate a scope? <ren.maddox@tivoli.com>
Re: sorting a file... nobull@mail.com
Re: Space near the middle <jeffp@crusoe.net>
Re: Space near the middle <ren.maddox@tivoli.com>
unsolved: <STDIN> simbean@my-deja.com
Re: unsolved: <STDIN> (Tad McClellan)
Re: unsolved: <STDIN> <ddunham@redwood.taos.com>
unzip from script HELP any_v@my-deja.com
Re: URL Get targeting HTTPS . . . nobull@mail.com
Re: Using Curses (Chris Fedde)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 1 Dec 2000 13:04:43 -0500
From: "Phil R Lawrence" <prlawrence@lehigh.edu>
Subject: passing !~
Message-Id: <908p7l$i8o@fidoii.CC.Lehigh.EDU>
Hello, I want to roll the logic of !~ into the qr// I am passing around. In
other words, can you help make the following work?
# I want SUCCESS if $str doen not contain string 'boo'
$str = ' whatever ';
# Please replace the '_not boo_' part
$regex = qr/ _not boo_ /;
# Note I'm using the =~ operator, not !~
print 'SUCCESS' if $str =~ $regex;
Thanks,
Phil
------------------------------
Date: Fri, 01 Dec 2000 18:39:56 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: passing !~
Message-Id: <x7bsuw9e9v.fsf@home.sysarch.com>
>>>>> "PRL" == Phil R Lawrence <prlawrence@lehigh.edu> writes:
PRL> # I want SUCCESS if $str doen not contain string 'boo'
PRL> $str = ' whatever ';
PRL> # Please replace the '_not boo_' part
PRL> $regex = qr/ _not boo_ /;
PRL> # Note I'm using the =~ operator, not !~
PRL> print 'SUCCESS' if $str =~ $regex;
use negative lookahead.
$regex = qr/(?!.*_not boo_)/;
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 1 Dec 2000 17:39:31 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Perl string converter
Message-Id: <908noj$qhk$1@lublin.zrz.tu-berlin.de>
Abigail <abigail@foad.org> wrote in comp.lang.perl.misc:
>On 1 Dec 2000 14:35:48 -0000, Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote in comp.lang.perl.misc <URL: news:<908d04$q9t$1@lublin.zrz.tu-berlin.de>>:
>++ { # scope for private variables
>++ my $next_num = 0; # next index to use
>++ my %num_tab; # save known associations here
>++
>++ sub enum_string {
>++ my $str = shift;
>++ $num_tab{ $str} = $next_num++ unless defined $num_tab{ $str};
>++ $num_tab{ $str};
>++ }
>
>Or:
>
> sub enum_string {$num_tab {+ shift} ||= ++ $next_num}
>
>++ }
Gee, and here I thought I had already made it short.
Anno
------------------------------
Date: 1 Dec 2000 16:43:53 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Perl string converter
Message-Id: <slrn92fla9.ejb.abigail@tsathoggua.rlyeh.net>
On 1 Dec 2000 14:35:48 -0000, Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote in comp.lang.perl.misc <URL: news:<908d04$q9t$1@lublin.zrz.tu-berlin.de>>:
++ Abigail <abigail@foad.org> wrote in comp.lang.perl.misc:
++ >On Fri, 01 Dec 2000 04:34:52 GMT, Bob Walton (bwalton@rochester.rr.com) wrote in comp.lang.perl.misc <URL: news:<3A272B18.56A2F095@rochester.rr.com>>:
++ >++ designpixs@my-deja.com wrote:
++ >++ >
++ >++ > I want to be able to pass in a string of any size
++ >++ > and return an integer. The return value is
++ >++ > always unique to the string passed in. (i.e.
++ >++ > pass in TEST returns 3452, pass in TESTS returns
++ >++ > 234532) The return value MUST be a unique value
++ >++ > to the value passed in. If I pass in TEST and
++ >++ > get 1234 and the later pass in TEST I should get
++ >++ > 1234.
++ >++ ...
++ >++ > Drew
++ >++ ...
++ >++ What you're asking for is technically infeasible. There are a *lot* of
++ >++ strings "of any size" out there, and only a relative handful of integer
++ >++ values. For example, a 100000-character string has 2**800000 possible
++ >++ values (which is probably more than the number of electrons in the
++ >++ universe), while a standard integer has only 2**32 possible values. I
++ >++ suppose you could use the Math::BigInt package to represent a unique
++ >++ number for each such string, but then why not just use the string
++ >++ itself, since there would be a 1:1 relationship anyway?
++ >
++ >Well, 18457123481273012315713645734592745983749171023827156175619 is a
++ >perfectly valid integer. Perl might not be able to do arithmetic with
++ >it, but it doesn't have a problem storing it in a scalar.
++ >
++ >Here's a trivial function that uniquely maps any string to an integer:
++ >
++ > sub str2int {join "" => map {sprintf "%03d" => ord} split // => shift}
++
++ The way I understand the OP it is not required that the mapping from
++ strings to numbers be defined a priori (before having seen the strings
++ to be mapped). It will probably be enough to assign a new number to
++ every new string and recognize old strings. This is trivially
++ achieved with a hash:
But that requires more memory; you would have to remember all strings
seen in history. To survive restarts of the program, you'd need to
store your hash on disk, which slows down the program. And to make
it work in an environment with several processors, you'd need to
complicat it even further.
++ { # scope for private variables
++ my $next_num = 0; # next index to use
++ my %num_tab; # save known associations here
++
++ sub enum_string {
++ my $str = shift;
++ $num_tab{ $str} = $next_num++ unless defined $num_tab{ $str};
++ $num_tab{ $str};
++ }
Or:
sub enum_string {$num_tab {+ shift} ||= ++ $next_num}
++ }
Given the reasons I gave above, I'd strongly prefer my one-liner.
Abigail
------------------------------
Date: Fri, 1 Dec 2000 12:06:58 -0500
From: "mk" <koke36@hotmail.com>
Subject: Problem with GD
Message-Id: <908lsk$623$1@news.kellnet.com>
I am having a problem with a perl cgi that uses graph.pm and gd.pm. When
graph.pm calls gd.pm an error is spawned saying that an object that gd needs
cannot be located. Unfortunately the object is not named. I have zlib and
png installed and freetype ( these are what gd asked to be installed before
the gd was installed).
How do I find out what is missing? I am not a perl programmer but I am
familiar with scripting and can follow directions fairly well.
For the appropriate help in getting this issue straightened out we are
willing to make some compensation.
Mike Kokinda
Chief Technology Officer
Mid Ohio Securities
mike@midoh.com
------------------------------
Date: Fri, 01 Dec 2000 16:43:30 GMT
From: simbean@my-deja.com
Subject: Re: Random password generator
Message-Id: <908kfg$dst$1@nnrp1.deja.com>
> Yuck!
> (and how come you have zero coming _after_ nine?
> Zero comes before one.
> )
> my @all = ( '1' .. '9', '0', 'A' .. 'Z', 'a' .. 'z');
I thin it doesn't matter at all.
I could have used the letters and numbers in any order, for I create
random numbers => I pick random characters from that array.
But _your_ array definitely looks better ;)
> >srand (time | $$);
>
> "In fact, it's usually not necessary to call `srand' at all"
>
> But you surely already know that, because it is in the description
> for the function that you are using.
Actually, I do know that.
But as I know from other languages, it IS better to use
those 'unnecessary' commands to not be bothered with unpleasant
surprises.
> perldoc -f srand
>
> You do read the descriptions for the functions that you use, don't
you?
I have to admit that I don't!
I only read them if I am stuck with a problem ... and sometimes I even
then prefer being a pain in the ass of some cracks in a forum like
this.
Sorry for that, but I try! :/
> #!/usr/bin/perl -w
It is old code and I DO use the -w normally.
> That would have pointed out to you that the statement above
> is not doing what you probably think it is doing.
Yes, should be
my($a, $b, $c);
right?!
> You do read the descriptions for the functions that you use, don't
you?
As I said above:
sometimes!
Although I get the impression that you are kinda aggressive to what I
posted, I thank you for the information on how to write better code. I
will try to make use of it ... :)
I myself didn't want to offend anybody and if someone felt offended by
my posting than I am very sorry. My english is not that good [I am
German] and I just tried to help someone who had a problem I had a
[maybe not perfect] solution for.
Thanks,
SimBean.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 1 Dec 2000 11:23:36 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Random password generator
Message-Id: <slrn92fk48.9j9.tadmc@magna.metronet.com>
simbean@my-deja.com <simbean@my-deja.com> wrote:
>
>> Yuck!
>> (and how come you have zero coming _after_ nine?
>> Zero comes before one.
>> )
>> my @all = ( '1' .. '9', '0', 'A' .. 'Z', 'a' .. 'z');
>I thin it doesn't matter at all.
Then it can be slightly "better":
my @all = ( '0' .. '9', 'A' .. 'Z', 'a' .. 'z');
>> perldoc -f srand
>>
>> You do read the descriptions for the functions that you use, don't
>you?
>I have to admit that I don't!
Don't say that where people can hear you, or they may do
something about it (like ignore all of your posts).
>I only read them if I am stuck with a problem ... and sometimes I even
>then prefer being a pain in the ass of some cracks in a forum like
>this.
See the problem is, if you ask other people to do it for you
often, they will eventually get tired of it and killfile you.
That will have a negative impact on getting answers to all
of your questions in the future.
>Sorry for that, but I try! :/
Asking here before checking the docs is _not_ trying.
You shouldn't do that anymore.
Trying to find the answer yourself first is trying.
>Yes, should be
> my($a, $b, $c);
>right?!
Right.
>> You do read the descriptions for the functions that you use, don't
>you?
>As I said above:
>sometimes!
You will get plonked if you keep that up.
You shouldn't do that anymore.
>Although I get the impression that you are kinda aggressive to what I
>posted,
Most folks here will get mad if you expect them to read the docs
for you. Making folks mad is not a good idea.
You shouldn't do that anymore.
>I thank you for the information on how to write better code.
Hope it helped!
>I myself didn't want to offend anybody and if someone felt offended by
>my posting than I am very sorry. My english is not that good [I am
>German]
I see nothing wrong with your English.
>and I just tried to help someone who had a problem I had a
>[maybe not perfect] solution for.
Helping out is great!
Using functions without reading their descriptions is awful!
You shouldn't do that anymore.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 01 Dec 2000 18:25:52 GMT
From: lou@visca.com (Lou Hevly)
Subject: Re: Random password generator
Message-Id: <3a27fb55.109626935@news.wanadoo.es>
simbean@my-deja.com wrote:
>In article <9078fv$c6h$1@nnrp1.deja.com>,
> fallenang3l@my-deja.com wrote:
>> I am looking for a random password generator (don't bother with
>> Crypt::RandPasswd because sometimes it can be painstainklingly [sp?]
>> slow). It doesn't have to be really complicated, just pretty random.
>
>I wrote a password generator once.
>Please don't tell me that it is ugly or slow, because I know it is for
>I am still learning. But I would appreciate advice about how to create
>better [cleaner] code. :)
I don't know enough to presume to give advice, but here's an adduser
subroutine I use that creates a password.
And perhaps someone with more knowledge will offer improvements.
# ADDUSER
sub adduser {
my ($user_id) = @_;
my $passwd = passwd();
sub passwd {
my @elems = ('a'..'z', 'A'..'Z', 0..9); # Add others if you wish
my $passwd = join '', map {$elems[rand int @elems]} 0..7;
$passwd = passwd() unless $passwd =~ /\d+/;
return $passwd;
}
my $crypted = crypt ($passwd, 'aa');
my $bad = system('useradd', '-p', $crypted, $user_id);
die $? if $bad;
log_print("Added user $user_id with password $passwd\n");
}
# end adduser
--
All the best,
Lou Hevly
lou@visca.com
http://www.visca.com
------------------------------
Date: 01 Dec 2000 18:26:06 +0000
From: nobull@mail.com
Subject: Re: Reading file into array.
Message-Id: <u97l5kgfr5.fsf@wcl-l.bham.ac.uk>
"John Boy Walton" <johngros@Spam.bigpond.net.au> writes as thought
this is the middle of a thread, but it isn't this is the start of a
new thread.
> Subject: Reading file into array.
What does this have to do with anything?
> This is the best I could come up with but $_ should be $_[$somevalue] where
> can I get the value perl would be using as it creates @_?
You seem to be confused. @_ and $_ are separate variables. $_[0] is
the first element of the array @_.
Also you are not using strict, enabling warnings and checking the
return value from open(). Comming to this newsgroup for help and not
doing these things is considered very rude because it means you think
we should help you when you cannot be bothered to help yourself. Many
of your mistakes would have been detected had you bothered.
> while (@_ = <BOGUS> ){
That's gibberish! You have a loop that reads the whole file into the
array on _each_ interation of the loop. Reading the whole file is
something that will only succede at most once so you could replace the
"while" with "if".
I suspect you meant to say
while ( $line = <BOGUS> ){
I'll change that and carry on
> #!e:/millenium programs/perl/bin/perl
> $path = "C:/Program Files/G6FTP/";
> $file = $path."Users.ini";
> open BOGUS,"$file";
> $array = 0;
Using "array" as a variable name is not something you should do in
real code. Using it as name for a scalar is like naming your cat "My
Dog". You never use this variable again.
> if ($line =~ /\[/){
Do you really want to look for [ anywhere in the string.
> $flag = "set";
When using a variable to act as a boolean flag it is sensible to adopt
the conventions of the language that you are using. In Perl you
should use '' and 1 for true and false.
$flag = 1;
> $counter = 0;
Counters are something you rearely need in Perl. For now we'll leave it.
> }elsif (/^\n/){
It is more convetuional to test for the empty line with the pattern
/^$/. This has the advantage that it'll work on Windows too. Decide
if you want to use the default "current line" buffer (aka $_) or a
named variable $line. Stick with your decision.
} elsif ( $line =~ /^$/ ){
> $flag ="not set";
$flag = 0;
> print $data[$array[$counter]];
> print $data[$array[2]];
> $temp = $data[$array[2]];
I assume here you intend @data to be a 2D array with subscripts $array
and $counter.
> print $data[$array][$counter];
> print $data[$array][2];
> $temp = $data[$array][2];
> $temp =~ s/Login=//;
> if ({time-$temp}/86400<31){
> $array++;
> }
> }elsif ($flag eq "set"){
If you use ordinary boolean convention for $flag that's just:
} elsif { $flag ) {
> $data[$array[$counter]] = $line;
$data[$array][$counter] = $line;
> $counter++;
> }
>
> }
OK, lets summarise. Note, I'm only fixing the mistakes that pertain
to lack of understang of Perl. I've ignored mistakes that petain to
not being able to program.
#!e:/millenium programs/perl/bin/perl -w
use strict;
my $path = "C:/Program Files/G6FTP/";
my $file = $path."Users.ini";
open BOGUS,"$file" or die $!;
my $array = 0;
my (@data,$flag,$counter)
while ( my $line = <BOGUS> ){
if ($line =~ /\[/){
$flag = 1;
$counter = 0;
} elsif ( $line =~ /^$/){
$flag = 0;
print $data[$array][$counter];
print $data[$array][2];
my $temp = $data[$array][2]];
$temp =~ s/Login=//;
if ({time-$temp}/86400<31){
$array++;
}
} elsif ($flag ) {
$data[$array][$counter] = $line;
$counter++;
}
}
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 01 Dec 2000 16:14:25 GMT
From: simbean@my-deja.com
Subject: Re: reading from <STDIN>
Message-Id: <908ioq$ca7$1@nnrp1.deja.com>
> Put STDIN into non-blocking mode...
> use Fcntl;
> fcntl(STDIN,F_SETFL,O_NONBLOCK);
I just tried that, because noone else seems to have a proposal, but I
can't!
I always get an
'Your vendor doesn't support O_NONBLOCK macro'
message!
> ...and then use sysread().
Yes, I got that to work just fine. But still, I cannot set <STDIN> to
non-blocking. Shouldn't sysread be a non-blocking read anyways??
Ciao,
SimBean.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 01 Dec 2000 09:55:51 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: regex not matching
Message-Id: <m3hf4o2l14.fsf@dhcp11-177.support.tivoli.com>
wyzelli@yahoo.com (Wyzelli) writes:
> The regex to skip the $0.00 lines was /\$0\.00$/ Which failed to match.
>
> To get it to work, I had to use m/\$0\.00$/.
>
> I thought the m was optional when the regex delimiter was a slash.
This worked fine for me:
#!/usr/local/bin/perl
while (<DATA>) {
print unless /\$0\.00$/;
}
__DATA__
C Around to it aroundto $22.23
C Around to it aroundto $0.00
__END__
Outputs:
C Around to it aroundto $22.23
So let's see your code...
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 01 Dec 2000 09:41:41 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Should { } always indicate a scope?
Message-Id: <m3r93s2loq.fsf@dhcp11-177.support.tivoli.com>
"John Lin" <johnlin@chttl.com.tw> writes:
> my @x = @{ 1,2,3,[4,5,6] }; # exactly the same BLOCK
> print @x;
> syntax error at line 1, near "@{ "
> Execution aborted due to compilation errors.
I found it interesting that adding parens *inside* the braces "fixes"
this:
my @x = @{ (1,2,3,[4,5,6]) };
print "@x\n";
4 5 6
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 01 Dec 2000 18:36:04 +0000
From: nobull@mail.com
Subject: Re: sorting a file...
Message-Id: <u94s0ogfaj.fsf@wcl-l.bham.ac.uk>
texasreddog@my-deja.com writes:
> for($x=4; $x<=$#junk; $x=$x+4) {
> if($junk[$x+5] eq "") {
> print OUT1 "$junk[$x]|$junk[$x+1]|$junk[$x+2]|$junk[$x+3]";
Ouch - do youself a favour do not linearise an inherently 2D data
structure into a 1D array. Use a 2D array.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 1 Dec 2000 11:22:56 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Space near the middle
Message-Id: <Pine.GSO.4.21.0012011121420.5826-100000@crusoe.crusoe.net>
[posted & mailed]
On Dec 1, Abigail said:
>On Fri, 1 Dec 2000 05:22:57 -0500, Jeff Pinyan (jeffp@crusoe.net) wrote in comp.lang.perl.misc <URL: news:<Pine.GSO.4.21.0012010452190.5826-100000@crusoe.crusoe.net>>:
>++ >
>++ >Question: is there a neat way to find that splitting point (a space)
>++ >near the middle of the string? Can it be done with regexes?
>++
>++ my $string = "external diameter in mm";
>++ my $half = int(length($string)/2);
>++
>++ $string =~ s/( ?)([^ ]*)(?<=^.{$half})([^ ]*)( ?)/
>++ length($2) < length($3) ? "\n$2$3$4" : "$1$2$3\n"
>++ /e;
>
>So, you either get rid of $1 or of $4? ;-)
Well, yes, seeing as how $1 and $4 are space characters. One of them gets
turned into a \n to put a break in the string.
That's how I interpreted the problem.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
PerlMonks - An Online Perl Community http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
------------------------------
Date: 01 Dec 2000 10:42:03 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Space near the middle
Message-Id: <m37l5k2iw4.fsf@dhcp11-177.support.tivoli.com>
abigail@foad.org (Abigail) writes:
> ++ my $string = "external diameter in mm";
> ++ my $half = int(length($string)/2);
> ++
> ++ $string =~ s/( ?)([^ ]*)(?<=^.{$half})([^ ]*)( ?)/
> ++ length($2) < length($3) ? "\n$2$3$4" : "$1$2$3\n"
> ++ /e;
>
>
> So, you either get rid of $1 or of $4? ;-)
Yes -- replaced by the newline.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Fri, 01 Dec 2000 16:23:15 GMT
From: simbean@my-deja.com
Subject: unsolved: <STDIN>
Message-Id: <908j9b$cq6$1@nnrp1.deja.com>
Hi,
I still have the problem, that I want a non-blocking read from <STDIN>
and cannot figure out how to do it.
Maybe there are better ways to do it, so I will explain my problem:
I am setting up my own server, which should be able to be shut-sown
remotely by sending a special command via an open socket. This is no
problem at all, evberything works fine, the server reports it's
shutdown and proceedes in the process.
Problem is, that I am having a thread, that is listening for input from
the console. So the server doesn't shutdown until you hit return on the
keyboard and the thread terminates itself.
If I had a non-blocking read from <STDIN>, I wouldn't have to wait for
input but I would just check if there _is_ input and if not, the thread
terminates and starts a new one which does excactly the same. Only if
there is input, I would force the thread to react to it ...
Phew, I hope that was understandable. I am German and my english might
seem worse to you than it does to me ;)
Any help is appreciated.
Thanks,
SimBean.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 1 Dec 2000 11:38:17 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: unsolved: <STDIN>
Message-Id: <slrn92fkvp.9j9.tadmc@magna.metronet.com>
simbean@my-deja.com <simbean@my-deja.com> wrote:
>I would just check if there _is_ input
Perl FAQ, part 8:
"How do I check whether input is ready on the keyboard?"
You inch ever closer to earning yourself a killfile entry.
Better stop doing that quick before it gets to be too late...
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 01 Dec 2000 17:58:05 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: unsolved: <STDIN>
Message-Id: <NERV5.8$jo.32545@news.pacbell.net>
simbean@my-deja.com wrote:
> Hi,
> I still have the problem, that I want a non-blocking read from <STDIN>
> and cannot figure out how to do it.
<STDIN> is not a filehandle. STDIN might be.
<STDIN> is an operation to read an entire line from a filehandle. Since
some of the line may be present, but not an entire line, this operation
will block until an entire line is available.
If you want non-blocking I/O, you can't use stdio stuff like this.
Instead use select to see if you can read, and then sysread to get some
data. Do this in a loop and you shouldn't have to block.
--
Darren Dunham ddunham@taos.com
Unix System Administrator Taos - The SysAdmin Company
Got some Dr Pepper? San Francisco, CA bay area
< Please move on, ...nothing to see here, please disperse >
------------------------------
Date: Fri, 01 Dec 2000 18:05:10 GMT
From: any_v@my-deja.com
Subject: unzip from script HELP
Message-Id: <908p8f$iad$1@nnrp1.deja.com>
Hy all,
I have some zip files that I want to unzip on a Linux platform using a
perl script and then read the unziped files.
If I run from the prompt "unzip myfile.zip -dtmp", my zip file is
unziped in tmp directory. I've tried to run the same command from
script,e.g 'system("unzip","myfile.zip","-dtmp");' and when I want to
open this files they don't exist. If I run the script again I receive
messages that this files are already unziped and if I want to replace
them or rename them. If I open the tmp directory from prompt it is
empty.
Any ideea what is wrong???
Thanks,
Any
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 01 Dec 2000 17:42:40 +0000
From: nobull@mail.com
Subject: Re: URL Get targeting HTTPS . . .
Message-Id: <u9d7fcghrj.fsf@wcl-l.bham.ac.uk>
ameen @ dausha . net (Ameen Dausha) writes:
> How would I go about accessing HTTPS in Perl?
Exactly the same as HTTP, (i.e. LWP) provided you've got OpenSSL and
Net::SSLeay installed.
> In a discussion today with some peers I was told it was impossible
> in Perl without using an unreliable hack.
I cannot comment on the reliability of OpenSSL or Net::SSLeay
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 01 Dec 2000 16:37:15 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Using Curses
Message-Id: <%sQV5.2$T3.170605056@news.frii.net>
In article <gDOV5.33437$3u1.8143693@news3.rdc1.on.home.com>,
Dan Cardamore <wombat@virtualdan.com> wrote:
>Chris Fedde <cfedde@fedde.littleton.co.us> wrote:
>> In article <zDFV5.30114$3u1.7441945@news3.rdc1.on.home.com>,
>> Dan Cardamore <wombat@virtualdan.com> wrote:
>>>
>>>Is there a way to have curses display the screen in two: top part
>>>being non-curses, and the bottom half being curses? Or is there a
>>>better way to execute commands like this and get them to display
>>>nicely.
>>>
>
>> One way to do this is to just do the colorization yourself. That
>> is when someone asks for a directory you just opendir and do the
>> colorization directly as you loop through the display. The other
>> method would be to build a parsing tree indexed by the ANSI escape
>> sequences using TERM::ANSIColor and match what 'ls --color' returns
>> to what is in the parse tree.
>
>
>Thanks for the reply.
>
>I'm just using ls --color as an example. Since this will be a shell I'd
>have to be able to run anything. From your reply it sounds as though I'd be
>better off not using curses since it will probably create incompatibilities
>with the run programs and be too much of a hassle. Is there another toolkit
>that can do the same type of functionality as Curses without this problem?
>
>Dan
>
You can do cursor positioning and colorization with Term::Cap and
Term::ANSIColor directly. You loose some of Curses capabilities
this way though. For example you cannot inch. Also you loose
terminal independence and update optimization, though that's not
likely to be a problem these days :-)
chris
BTW you might consider not using Jeopardy style quoting. It is
easier to follow a thread if you take a moment and edit what you
are quoting and put your text below or intermingle it as is
appropriate.
--
This space intentionally left blank
------------------------------
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 5010
**************************************