[9306] in Perl-Users-Digest
Perl-Users Digest, Issue: 2901 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 18 15:08:43 1998
Date: Thu, 18 Jun 98 12:00:36 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 18 Jun 1998 Volume: 8 Number: 2901
Today's topics:
--- Is there a way to run Perl scripts from my Win95 ma <none@all.com>
Re: ?CGI scripts & Explorer <perlguy@inlink.com>
broken upload program chapman50@hotmail.com
exception handlng with eval <bing_ran@bc.sympatico.ca>
Re: first language (Rich Morin)
Re: first language <nguyend7@egr.msu.edu>
How to scrub Ctl-Z? <gacarey@domain.com>
Re: How to scrub Ctl-Z? <rootbeer@teleport.com>
Re: How to use Socket.pm? (David B. White)
Re: How to use Socket.pm? <rootbeer@teleport.com>
Re: How to use Socket.pm? (Jeffrey R. Drumm)
Re: I need help with my ^M problem. <lr@hpl.hp.com>
if (something eq "somethingfgjhf") <brian.charles@orst.edu>
Is setlogsock really in Perl 5.004_04? <henneberg@netco.de>
Re: Is setlogsock really in Perl 5.004_04? <rootbeer@teleport.com>
Little help on grabbing text <mike@newfangled.com>
mkdir MODE problem marius77@my-dejanews.com
MODE in mkdir marius77@my-dejanews.com
Re: Moving application from DOS to a GUI. <rootbeer@teleport.com>
Re: NT and CGI scripts using PERL. Help! (Steve Linberg)
Re: NT and CGI scripts using PERL. Help! <rootbeer@teleport.com>
Re: Pod::Text -- Unix only? pehanna@my-dejanews.com
Re: Processing Binary file with Perl. <bowlin@sirius.com>
Re: Question concerning the use of Net::FTP (Jeffrey R. Drumm)
RegExp Error Under UNIX PERL Runs Under Win32 PERL <jdkane@akanewmedia.com>
Socket program help (Don)
Re: Socket program help <bowlin@sirius.com>
SORTING HASHES (THE NEWBIE WAY!!) <steph@hotkey.net.au>
Re: SORTING HASHES (THE NEWBIE WAY!!) <rootbeer@teleport.com>
Re: subject and sender using open mail <rootbeer@teleport.com>
Using PERL to do a remote TELNET <kenkim@gncom.com>
Re: Using PERL to do a remote TELNET <rootbeer@teleport.com>
Using STDIN as a symbolic reference? <escrubb@att.net>
Re: Using STDIN as a symbolic reference? (Larry Rosler)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 17 Jun 1998 14:11:39 -0400
From: Webcruiser <none@all.com>
Subject: --- Is there a way to run Perl scripts from my Win95 machine?
Message-Id: <358806DA.7E2B@all.com>
I am new to Perl, and would like to be able to test my scripts before
ftping them to my host site. What is involved in doing this?
------------------------------
Date: Thu, 18 Jun 1998 17:48:29 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: ?CGI scripts & Explorer
Message-Id: <358952ED.6CD8CB72@inlink.com>
Actually there was NOTHING wrong with MY script that I was referring
to. I DID contact Microsoft and their response was:
"We have no interest in fixing it because it is in an old version of the
browser." (Version 3.02 & 3.03)
If I have to deal with dumbshit reasoning like that, I'd rather lose the
poor souls running Internet Exploder than have to jump through hoops to
get Microsofts software to work.
BUT, since I run a mixed browser extranet, and not all users could run
IE 4 (which worked), I did come up with a fix to the problem.
Yes it WAS a problem with the browser and NO I don't see why *I* should
have to come up with creative solutions to program around Microsoft's
bugs, but the people who sign my paycheck wanted it done.
I just have a real problem with the way Microsoft *doesn't* support
their products. Yes I know IE was free, but I am having a similar
problem right now with a product we purchased so I feel that this is
just "standard operating procedures" for MS.
As for the masturbatory comment: If you use two hands does that count
as tango-ing? ;-)
ROTFL AGAIN!!!
Thanks for the lively conversation today!
Brent
------------------------------
Date: Thu, 18 Jun 1998 18:21:40 GMT
From: chapman50@hotmail.com
Subject: broken upload program
Message-Id: <6mblrj$6jc$1@nnrp1.dejanews.com>
I'm attempting to upload files over a form (perl script), I'm also using
CGI.pm (version 2.36).
The problem is that no matter what I try it uploads 0 bytes. The essential
lines that do get the file's data are...
while ($bytesread = read($filename,$buffer,1024)) {
$totalbytes += $bytesread;
print OUTFILE $buffer;
}
But it is never able to find any of the data and $totalbytes = 0. CGI.pm is
able to receive properly data from text fields, buttons, etc.
The script worked prior to our machine having its ip address changed. I am
also using linux and the Apache web server.
Any suggestions?
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 18 Jun 1998 11:38:12 -0700
From: "Bing Ran" <bing_ran@bc.sympatico.ca>
Subject: exception handlng with eval
Message-Id: <6mbmuk$8c2$1@news.bctel.net>
Experts:
Why does the following code not work? The eval does not seem to catch the
die. It works if the die is in the eval block instead of in the sub called
from inside eval.
bing ran
#!/usr/local/bin/perl
sub throw {
die "exception thrown.";
}
eval {
throw();
};
if($@) {
print $@, "\n";
0;
}
------------------------------
Date: Thu, 18 Jun 1998 10:20:59 -0700
From: rdm@cfcl.com (Rich Morin)
Subject: Re: first language
Message-Id: <rdm-1806981021000001@140.174.42.30>
In article <6malar$iee$9@client3.news.psi.net>, abigail@fnx.com wrote:
> Find someone to teach you *programming*. (Not a language, *programming*).
Bingo!
As a language buff and occasional book reviewer, I have had the opportunity
to amass a great number of books on programming languages. To my dismay,
virtually all of them assume that the reader already knows another language
or two, as well as fundamental programming concepts.
Aside from making life difficult for beginners, this approach can produce
programmers who lack basic theory. There ARE some books which meet this
problem head-on. Possibly the best is Abelman and Sussman's "Structure
and Interpretation of Computer Programs". Unfortunately, this book is
based on Scheme, a Lisp variant, so many folks will avoid it.
Getting back to "Perl as a first language", here are my (windy) thoughts:
Programming languages have a certain "combinatorial complexity", based
on the number of constructs they support and the degree to which the
constructs interact.
Fortran has few constructs and little interaction, so it is pretty
simple. Pascal has few constructs and more interaction, making it more
complex. Ada and Perl have many constructs and high interaction, and
are therefore *really* complex.
In general, the number of constructs and level of interaction are well
correlated with the expressive power of the language. In "orthogonal"
languages (roughly, languages with one tool for each job), the size of
the syntax is thus a good indication of the expressive power.
Perl, however, is not an "orthogonal" language. (rather, according to
Larry, it is a "diagonal" language). So, many of Perl's constructs are
roughly equivalent, leading to the slogan that There's More Than One Way
To Do It (TMTOWTDI). This is great for experienced programmers; having
a diverse, if overlapping, set of tools can ease many programming tasks.
For a beginner, however, this diversity can be confusing. S/he has no
way of knowing which tool to use, and the increase in combinatorial
complexity does not (yet) bring any real benefits.
Complicating the matter still further, Perl can be used either as a free-
wheeling "scripting" language:
open FOO, ">foo" or die "can't open foo";
or as a more restrained "programming language":
open(FOO, ">foo") or die("can't open foo");
The first form is (slightly) faster to write, but it presents the reader
with a much harder parsing challenge. (Perl's 24 levels of operator
precedence can be a bit much to memorize!) Making matters worse, Perl
code is rife with idiomatic usages:
1;
For these reasons, aspiring programmers are often directed to languages
such as BASIC or Pascal. Once they have their feet wet, the thinking
goes, they can "move up" to Perl.
Although this is a "safe" approach, it is a bit inefficient. Wouldn't
it be more reasonable to teach the new programmer some basic theory,
followed by a useful (not to mentioned restrained and non-idiomatic)
subset of Perl? This allows the new programmer to learn "real" Perl,
while avoiding most of the pedagogical problems mentioned above.
<Promo>
"MacPerl: Power and Ease", an introduction and reference for MacPerl,
takes exactly this approach. An online copy is available at:
http://www.ptf.com/macperl/ptf_book/HTML
For general information on MacPerl (Perl 5 for the Macintosh), visit
PTF's MacPerl Pages:
http://www.ptf.com/macperl
</Promo>
-r
--
Canta Forda Computer Laboratory | Prime Time Freeware - quality
UNIX consulting, training, & writing | freeware at affordable prices
+1 415-873-7841 | +1 408-433-9662 -0727 (Fax)
Rich Morin, rdm@cfcl.com | www.ptf.com, info@ptf.com
------------------------------
Date: 18 Jun 1998 18:05:35 GMT
From: Dan Nguyen <nguyend7@egr.msu.edu>
Subject: Re: first language
Message-Id: <6mbktf$5qp$1@msunews.cl.msu.edu>
Rich Morin <rdm@cfcl.com> wrote:
: In article <6malar$iee$9@client3.news.psi.net>, abigail@fnx.com wrote:
: > Find someone to teach you *programming*. (Not a language, *programming*).
: Bingo!
[snip]
: Getting back to "Perl as a first language", here are my (windy) thoughts:
: Programming languages have a certain "combinatorial complexity", based
: on the number of constructs they support and the degree to which the
: constructs interact.
: Fortran has few constructs and little interaction, so it is pretty
: simple. Pascal has few constructs and more interaction, making it more
: complex. Ada and Perl have many constructs and high interaction, and
: are therefore *really* complex.
Pascal, IMHO is a good language to learn as your first language.
Especially if your planning on learning C along the way. Its been my
experience that learning the first language is always the hardest.
Learning new ones is simply a making connections with previous
language. i.e. I did it this way in this language, and in this one
these things act like those things, and this keyword is like that
keyword. e.g. Pascal and C
PASCAL C Perl
while( i > 0 ) while( i > 0 ) while( $i > 0 )
begin { {
. . .
. . .
. . .
end; } }
The perivous examples show how things you can make connections, and
make your programming experience more enjoyable.
: In general, the number of constructs and level of interaction are well
: correlated with the expressive power of the language. In "orthogonal"
: languages (roughly, languages with one tool for each job), the size of
: the syntax is thus a good indication of the expressive power.
: Perl, however, is not an "orthogonal" language. (rather, according to
: Larry, it is a "diagonal" language). So, many of Perl's constructs are
: roughly equivalent, leading to the slogan that There's More Than One Way
: To Do It (TMTOWTDI). This is great for experienced programmers; having
: a diverse, if overlapping, set of tools can ease many programming tasks.
: For a beginner, however, this diversity can be confusing. S/he has no
: way of knowing which tool to use, and the increase in combinatorial
: complexity does not (yet) bring any real benefits.
Pascal is a good language (though it is begining to be taught in fewer
and fewer high schools.) to learn. One of the things that helps
begining programmers is the strictness of the language. Generally
there is either one way or a few ways of doing things. That one way
usually is the best for most situation. Though it may not always
produce the most effient code.
: Complicating the matter still further, Perl can be used either as a free-
: wheeling "scripting" language:
: open FOO, ">foo" or die "can't open foo";
: or as a more restrained "programming language":
: open(FOO, ">foo") or die("can't open foo");
: The first form is (slightly) faster to write, but it presents the reader
: with a much harder parsing challenge. (Perl's 24 levels of operator
: precedence can be a bit much to memorize!) Making matters worse, Perl
: code is rife with idiomatic usages:
: 1;
: For these reasons, aspiring programmers are often directed to languages
: such as BASIC or Pascal. Once they have their feet wet, the thinking
: goes, they can "move up" to Perl.
Most languages were invented (made up) for a reason.
FORTRAN (FORMula TRANslation): give programmers the ability to produce
code that had actually algebraic expressions.
COBOL (COmmon Business Oriented Language): give business people
something to do.
Pascal (in honor of Pascal): teaching language.
C (sucessor to the B programming language): write powerful code with
the least amount of typing.
Smalltalk (?? just thank the people at XeroxPARC): parent of all other
Object oriented programming
C++ (C += 1): oop implementation of C.
Ada (??): something the DoD made up
Java (named after the coffee they drank): write an OOP language that
could be run on any OS without any changes to the code.
BASIC (Beginners All-purpose Symbolic Instruction Code): simple
language with thousands of different derivatives. BASICA QBASIC
VisualBASIC to name a few. What the names implies. Its fairly
simple.
Perl (Practical Extraction and Report Language || Pathologically
Eclectic Rubbish Lister): Something that Larry Wall came up with. It
grew and grew. Now its the king of scripting languages. If not
programming languages in general.
: Although this is a "safe" approach, it is a bit inefficient. Wouldn't
: it be more reasonable to teach the new programmer some basic theory,
: followed by a useful (not to mentioned restrained and non-idiomatic)
: subset of Perl? This allows the new programmer to learn "real" Perl,
: while avoiding most of the pedagogical problems mentioned above.
My greatest difficulty while learning Perl was the pattern matching.
(Wish I new Awk and Sed). The implementation of objects was difficult
for me. It was nothing linke C++ or Java.
Sorry I took the promo out.
--
Dan Nguyen |
nguyend7@cps.msu.edu | Remember Byron.
http://www.cps.msu.edu/~nguyend7 |
------------------------------
Date: Thu, 18 Jun 1998 10:58:22 -0700
From: Greg Carey <gacarey@domain.com>
Subject: How to scrub Ctl-Z?
Message-Id: <3589553E.FD2ACC26@domain.com>
I started getting improper ^Z characters in my mainframe download files
and the middleware pgm treats it as EOF. I am attempting to use Perl as
a scrubber, but unfortunately, Perl also sees it as EOF. Is there a way
to substitute ^Z with a space? If so, how would I deal with the "real"
EOF?
I've tried:
s/\x1A/" "/g
s/char(26)/" "/g
s/\xZ/" "/g
s//" "/g
none of which work.
Earle Pearce
------------------------------
Date: Thu, 18 Jun 1998 18:14:42 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: How to scrub Ctl-Z?
Message-Id: <Pine.GSO.3.96.980618111410.13348T-100000@user2.teleport.com>
On Thu, 18 Jun 1998, Greg Carey wrote:
> I started getting improper ^Z characters in my mainframe download files
> and the middleware pgm treats it as EOF. I am attempting to use Perl as
> a scrubber, but unfortunately, Perl also sees it as EOF.
See binmode(), in perlfunc. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 18 Jun 1998 17:17:40 GMT
From: dbwhite@btv.ibm.com (David B. White)
Subject: Re: How to use Socket.pm?
Message-Id: <6mbi3k$103k$1@mdnews.btv.ibm.com>
In article <mbudash-1806980920550001@d152.pm4.sonic.net>,
mbudash@sonic.net (Michael Budash) writes:
> I have the feeling I'll need Socket (or possibly LWP), but I just can't
> seem to find the documentation or example that I need...
You might try
http://www.perl.com/CPAN-local//modules/by-category/15_World_Wide_Web_HTML_HTTP_CGI/LWP/
and pick up the libwww-perl package. There's a lwpcook.pod with lots of examples
in the tar file...
--
David B. White
IBM Microelectronics, Circuit Verification & Design Tools
Internal: dbwhite@btv Internet: dbwhite@vnet.ibm.com
Phone: 802-769-5671 (TieLine: 446) Fax: 802-769-5722
------------------------------
Date: Thu, 18 Jun 1998 17:29:13 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: How to use Socket.pm?
Message-Id: <Pine.GSO.3.96.980618102810.13348K-100000@user2.teleport.com>
On Thu, 18 Jun 1998, Michael Budash wrote:
> I have the feeling I'll need Socket (or possibly LWP), but I just can't
> seem to find the documentation or example that I need...
Have you seen lwpcook? Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 17:25:58 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: How to use Socket.pm?
Message-Id: <358b4aa9.5417760@news.mmc.org>
[posted and mailed]
On Thu, 18 Jun 1998 09:20:55 -0700, mbudash@sonic.net (Michael Budash) wrote:
>Hey all -
>
>Can someone tell me how to, in a perl script, execute this:
>
>http://www.domain.com/cgi-bin/pgm.cgi?parm1=value1&parm2=value2
>
>then collect the returned html into a variable?
>
>I have the feeling I'll need Socket (or possibly LWP), but I just can't
>seem to find the documentation or example that I need...
This is a FAQ . . . see perlfaq9: How do I fetch an HTML file?
$ perldoc perlfaq9
or
C:\> perldoc perlfaq9
Useful examples abound therein.
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: Thu, 18 Jun 1998 10:11:36 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: I need help with my ^M problem.
Message-Id: <35894A48.6E049CEC@hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <Pine.SGI.3.96.980618104135.12577B-100000@umbc7.umbc.edu>,
Scott Burright <burright@umbc.edu> says...
> On Wed, 17 Jun 1998, Larry Rosler wrote:
...
> > In article <Pine.SGI.3.96.980617165915.3901E-100000@umbc7.umbc.edu>,
> > burright@umbc.edu says...
> > > Just backslash the ^.
> > >
> > > $blah =~ s/\^M//gs;
...
> > NO!!!
>
> Yes.
>
> > Even the most rudimentary test would show that this substitution
> > does nothing. What your editor may display as '^M' is a single
> > character, not the two characters '^' and 'M'. Perl's way of
> > representing Control-M is '\cM' and
> >
> > $blah =~ s/\cM//gs;
> >
> > works just fine. Please don't spew crap into the archives of this
> > newsgroup without testing it first.
>
> Excuse me?
>
> I did test it, and it worked. I also tested the \cM, which did not work
> on my system.
>
> Some of these things are system-dependent. I would think that, of all
> people, a Hewlett Packard employee should know that.
>
> Thanks for flaming me, though. You seem like such a nice guy.
Most people think so.
Look, there is *nothing* system-dependent here at all. If you say that
you matched something with the regex /\^M/, then you matched the *two*
characters ^ and M which is *NOT* the single control character ^M (or
\r)
that some software represents visually as the two characters ^ and M.
Before flaming you, I made very sure in my tests to use the Perl
length() function before and after all substitutions to guarantee that
what I was seeing with my text editor (the two-character representation
^M) was in fact only one character (\r) in my data strings.
No useful software would replace its visual representation ^M by those
two characters in its output to a file. Please let us know how such a
file was generated, so we can appropriately blacklist the program that
did it.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 18 Jun 1998 11:57:15 -0700
From: Brian Charles <brian.charles@orst.edu>
Subject: if (something eq "somethingfgjhf")
Message-Id: <3589630B.469C767C@orst.edu>
Hi,
Is it possible to only test the first 8 characters/digits to see if a
statement is true?
I need the following statement to be true as long as the first 9
characters are the same. I don't care about what follows the 9
characters.
if (something eq "somethingetdsfg.....................")
then....
Thanks
Brian
------------------------------
Date: Thu, 18 Jun 1998 17:23:21 +0200
From: Gunnar Henneberg <henneberg@netco.de>
Subject: Is setlogsock really in Perl 5.004_04?
Message-Id: <358930E9.A342BB89@netco.de>
Hi there,
I have just installed the latest Perl 5.004_04 to use the
module Sys::Syslog and the setlogsock function.
I have compiled it on my Linux 2.0.32 kernel i586 system.
The manpage of Sys::Syslog reads: setlogsock $sock_type (added in
5.004_03).
But NOTHING!
Running the sample script gives me:
Undefined subroutine &main::setlogsock called at ....
The other functions from Sys:Syslog are available and working.
What can I do, I need to set syslog to log on unix socket instead
of inet socket.
Thanks in advance,
Gunnar.
--
********************************************************************
E-Mail: Henneberg@NetCo.de
------------------------------
Date: Thu, 18 Jun 1998 17:34:45 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Is setlogsock really in Perl 5.004_04?
Message-Id: <Pine.GSO.3.96.980618103407.13348M-100000@user2.teleport.com>
On Thu, 18 Jun 1998, Gunnar Henneberg wrote:
> Undefined subroutine &main::setlogsock called at ....
>
> The other functions from Sys:Syslog are available and working.
Did you request that function properly on your 'use Sys::Syslog' line?
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 14:18:44 -0400
From: "Michael S. Brito, Jr." <mike@newfangled.com>
Subject: Little help on grabbing text
Message-Id: <358959FA.E7D26062@newfangled.com>
I'm kinda new to this so bear with me:
I'm writing a script that will grab a users e-mail address from a form
that he/she fills out. It will then slap it in a file (email.txt). Then
It will grab whatever is in the file body.txt and use it for the body of
an e-mail which is then sent to that users input (or e-mail address).
One problem though, I can only grab the first line of body.txt! I don't
know how to grab the entire thing and send it away. I *think* it's a
FOREACH thing but I experimented with no luck.
!----------- Here is the code ---------------!
#!/usr/bin/perl
read(STDIN,$buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name,$value) = split(/=/,$pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/~!/ ~!/g;
$FORM{$name} = $value;
}
open(OUTF,">>email.txt");
print OUTF
"$FORM{'email'}\n";
close(OUTF);
$mailprog = '/usr/sbin/sendmail';
$recipient = "$FORM{'email'}";
if ($FORM{'email'} eq "") {
print "<h2>Error!</h2>\n";
print "Please fill out the field for your e-mail.<p>";
die;
}
open (MAIL, "|$mailprog $recipient") || die "Cant open $mailprog!\n";
print MAIL "From: mike\@newfangled.com\n";
print MAIL "Reply-to: mike\@newfangled.com\n";
print MAIL "Subject: Instant Reply\n\n";
$filename = "body.txt";
open(INF,$filename);
$indata = <INF>;
close(INF);
print MAIL "$indata\n";
close(MAIL);
print "Location:http://208.XXX.XXX.XXX/thanks.html\n\n";
!--------------- EOF --------------------!
Thanks for any help u can offer,
Mike : mike@newfangled.com
------------------------------
Date: Thu, 18 Jun 1998 18:42:38 GMT
From: marius77@my-dejanews.com
Subject: mkdir MODE problem
Message-Id: <6mbn2u$8ps$1@nnrp1.dejanews.com>
I know this question has been asked before, but it wasn't answered in the way
I needed. Here's my problem:
I have a script that creates several new directories, but I'm having trouble
with the permissions. I need them to be either
drwxrwxrwx or drwxr_xrwx and I currently have a umask of 002.
I've been able to get permissions up to drwxr_xr_x, but no further and it's
killing me to be so close. I know I could do a chmod after the mkdir, but I
am creating so many directories that the list would be quite long. There
must be a way to get the permissions I want using only MODE. Thanks!
Marius
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 18 Jun 1998 18:43:48 GMT
From: marius77@my-dejanews.com
Subject: MODE in mkdir
Message-Id: <6mbn54$91a$1@nnrp1.dejanews.com>
I know this question has been asked before, but it wasn't answered in the way
I needed. Here's my problem:
I have a script that creates several new directories, but I'm having trouble
with the permissions. I need them to be either
drwxrwxrwx or drwxr_xrwx and I currently have a umask of 002.
I've been able to get permissions up to drwxr_xr_x, but no further and it's
killing me to be so close. I know I could do a chmod after the mkdir, but I
am creating so many directories that the list would be quite long. There
must be a way to get the permissions I want using only MODE. Thanks!
Marius
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 18 Jun 1998 17:12:01 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Moving application from DOS to a GUI.
Message-Id: <Pine.GSO.3.96.980618101121.13348H-100000@user2.teleport.com>
On Wed, 17 Jun 1998, David Sheets wrote:
> If anyone could comment on Perl, Python, Tcl, or even any
> other language's usefulness for this application, it would be very
> helpful in our final decision.
The Perl FAQ has some comments upon its usefulness for many kinds of
applications. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 13:00:39 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: NT and CGI scripts using PERL. Help!
Message-Id: <linberg-1806981300390001@projdirc.literacy.upenn.edu>
In article <6mb7uu$b0h6$1@newssvr04-int.news.prodigy.com>, "Johnny
Sandaire" <Johnny.Sandaire@bmc.org> wrote:
> 'D:\InetPub\wwwroot\cgi-bin\test.cgi' script produced no output
>
> is the answer that I received after I installed the Perl software on my NT4
> / IIS3.0.
> Please help me to configure Perl to run on NT4.0 with IIS. Please Send
> information directly by email to: Johnny.Sandaire@bmc.org
I'll be happy to. Please send a check for $450 (1st 3 hours at $150/)
directly by postal mail to:...
(you get the point, I'm sure.)
>The page that I called contains 548 lines of code, which I have taken the
>liberty of patching a piece below:
And we're supposed to figure out what you did from a piece of "patched"
code that you didn't write with no context given other than "it doesn't
work?"
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Thu, 18 Jun 1998 17:16:26 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: NT and CGI scripts using PERL. Help!
Message-Id: <Pine.GSO.3.96.980618101455.13348I-100000@user2.teleport.com>
On Thu, 18 Jun 1998, Johnny Sandaire wrote:
> Please help me to configure Perl to run on NT4.0 with IIS.
Chances are that if Perl is properly installed, it's also properly
configured. :-) But maybe you need to configure IIS. The docs, FAQs, and
newsgroups about such servers should be of assistance. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 17:15:43 GMT
From: pehanna@my-dejanews.com
Subject: Re: Pod::Text -- Unix only?
Message-Id: <6mbhvu$vcl$1@nnrp1.dejanews.com>
In article <6m8f9g$8df$2@csnews.cs.colorado.edu>,
tchrist@mox.perl.com (Tom Christiansen) wrote:
>
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, pehanna@my-dejanews.com writes:
> :Is there any particular reason why Pod::Text uses "stty -a 2>/dev/null" as a
> :one of its means of determining the screen width? Is there a portable
> :alternative?
>
> Maybe it's just that time of the mornin, but I take umbrage here.
>
> Portable doesn't mean "runs on a Mac". I code for corss-platform
> use. That means my code works on Linux, BSD, SunOS, *and* Solaris
> -- and probably any other profession/open/POSIX/Unix-like system.
> If you want more than that, you'll have to write the program yourself.
>
> --tom
If cross-platform means "Linux, BSD, SunOS, *and* Solaris -- and probably any
other professional/open/POSIX/Unix-like system" then why bother to use readdir
instead of `ls`? Perl provides a number of constructs that abstract most
operating system differences. (OK, "runs on a Mac" is pushing it, I'll agree.)
Many Perl scripts need to operate in both Unix and Windows NT environments --
*most* Fortune 500 companies use both. This is hardly an off-the-wall
situation. It is also one of Perl's great strengths that it can do this.
--
Phil Hanna
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 18 Jun 1998 09:45:52 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: ahmadz@comm.mot.com
Subject: Re: Processing Binary file with Perl.
Message-Id: <35894440.82906DC9@sirius.com>
ahmadz@comm.mot.com wrote:
>
> Hi,
>
> Could somebody guide me how can I process a binary file with perl?
>
> I need to remove the first few bytes (depends on the file). I'm trying to
> remove the extra header of macbin file so that the file can be read by
> application directly.
The read and write functions do just what you want. If you are on Win32
you also need to use binmode. Use
perldoc -f read
perldoc -f write
perldoc -f binmode
HTH -- Jim Bowlin
------------------------------
Date: Thu, 18 Jun 1998 17:00:01 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Question concerning the use of Net::FTP
Message-Id: <358a42de.3423532@news.mmc.org>
[posted and mailed]
On Thu, 18 Jun 1998 15:15:25 +0200, Rainer Finocchiaro
<rainer@demag.rwth-aachen.de> wrote:
>Hi all,
>
>I want to upload a file to the cgidir of a remote Webserver AND make it
>executable.
>
>No problem with the upload, works flawlessly, but I can't seem to figure
>out how to set the file to another mode like rwxr-x-r-x. I tried the
>following
>
>my $ftp = new Net::FTP($ip) || &io_error("Cannot connect to $ip");
>$ftp->login($login, $pass);
>$ftp->type("binary");
>$ftp->mkdir(dirname($dest_file),true);
>$ftp->put($source, $dest_file);
>$mode = 0755;
>$ftp->quot(chmod $mode $dest_file);
>...
In this case, Perl's internal chmod is being evaluated and is probably failing
with a 'missing operator' error . . .
>
>and
>
>$ftp->command(CHMOD, $mode, $dest_file);
>...
This actually turned out to be a little more difficult than I expected. Here's
a solution that worked for me:
$ftp->quot('site chmod 0777', $dest_file);
Note the quotes, and the fact that quot is being supplied with a list.
>but everything had no effect. I have no idea how to continue and would
>appreciate any help.
>
>Thanks in advance
>
>Rainer
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: Thu, 18 Jun 1998 14:34:09 -0400
From: "John Kane" <jdkane@akanewmedia.com>
Subject: RegExp Error Under UNIX PERL Runs Under Win32 PERL
Message-Id: <6mbmkt$gnd$1@newsmaster.pathcom.com>
I have created an attribute-parsing function (which I have included below
for
reference purposes). It is meant to parse HTML tag attributes. It compiles
under my Win32 version of PERL, but not under the UNIX version. The
following error message is produced on the UNIX machine...
# perl cgi-bin/test/aka-parser.cgi
/(\w+\s*=\s*"(?:.*?(?:"{2})*)*")/: regexp *+ operand could be empty at
cgi-bin/t
est/aka-parser.cgi line 133.
My ISP is using v5.004_03 of PERL.
I am using Win32 Build 316 v5.003_07.
I don't understand the regular expression error. Can someone enlighten me.
Any help would be appreciated. Thanks.
-- John
# ----- THE FUNCTION IN ERR -----
########## parseAttribs
# Parses the specified string, extracting attributes into a hash
# Accepts: $attributes_string
# Returns: \%parsed_attributes
# Attribute form : key="value" [key="value" ...]
# Attribute example: name = "john" chars="abc""123"
# Each attribute consists of a key/value pair.
# Each key and corresponsding value must be separated by an equals sign.
# Whitespace is ignored between a key and its corresponsing value.
# Attributes must be separated by whitespace.
# Attribute values must be delimited by double quotes.
# Each double quote within an attribute value must be escaped by using two
# double quotes (i.e. "abc""123" produces the value: abc"123).
#
sub parseAttribs {
$_ = shift;
my %parms;
my @attribs = split /(\w+\s*=\s*"(?:.*?(?:"{2})*)*")/; # this is the
error line
foreach $attrib (@attribs) {
my ($hkey, $hval) = split /=/, $attrib, 2;
$hkey =~ s/\s//g; # strip space from key
$hval =~ s/^\s*?"(.*)"\s*?$/$1/; # remove value from qualifiers
$hval =~ s/""/"/g; # unescape qualifiers within the value
$parms{$hkey} = $hval if $hkey ne undef();
}
return \%parms;
}
------------------------------
Date: Thu, 18 Jun 1998 18:28:45 GMT
From: defike@ilstu.edu..spam.not (Don)
Subject: Socket program help
Message-Id: <35895b40.20149919@news.ice.net>
Below is the code for a client script that I basically lifted from a
book. Unfortunately the script fails at line 45 following the bind(S,
$this) statement. Since I am writing this to learn sockets I don't
know what is causing this error. Could some one help me find the
error of my ways...
Thanks,
Don
defike@ilstu.NOSPAM.edu
#! /usr/local/bin/perl
# client.pl, sockets 101
use Socket;
($them,$port) = @ARGV;
$port = 2345 unless $port;
$them = 'localhost' unless $them;
$SIG{'Int'} = 'dokill';
sub dokill {
kill 9, $child if $child;
}
chop($hostname = `hostname`);
($name, $aliases, $proto) = getprotobyname('tcp');
($name, $aliases, $port) = getservbyname($port, 'tcp') unless $port =~
/^\d+$/;
print "Using port $port to connect to server on host $them...\n";
($name, $aliases, $type, $len, $thisaddr) = gethostbyname($hostname);
($name, $aliases, $type, $len, $thataddr) = gethostbyname($them);
#if (socket(S,1,1, 0))
if (socket(S,AF_INET, SOCK_STREAM, $proto)) {
print "Socket creation succeeded.\n";
}
else {
die $!;
}
$socketaddr = 'S n a4 x8';
$this = pack($sockaddr, AF_INET, 0, $thisaddr);
$that = pack($sockaddr, AF_INET, $port, $thataddr);
#### This is where it fails, states invalid arguement ####
if (bind(S, "$this")) {
print "Bind succeeded.\n";
}
else {
die $!;
}
if (connect(S, $that)) {
print "Connect succeeded.\n";
}
else {
die $!;
}
select(S);
$| = 1;
select(STDOUT);
if ($child = fork) {
while (<STDIN>) {
print S;
}
sleep 3;
do dokill();
}
else {
while (<S>) {
print "Server: $_";
}
}
------------------------------
Date: Thu, 18 Jun 1998 11:47:11 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: defike@ilstu.edu
Subject: Re: Socket program help
Message-Id: <358960AF.252B8BC6@sirius.com>
Don wrote:
>
> Below is the code for a client script that I basically lifted from a
> book. Unfortunately the script fails at line 45 following the bind(S,
> $this) statement. Since I am writing this to learn sockets I don't
> know what is causing this error. Could some one help me find the
> error of my ways...
If you want to learn about sockets, I suggest you read "UNIX Network
Programming" by W. Richard Stevens.
-- Jim Bowlin
------------------------------
Date: Fri, 19 Jun 1998 03:50:03 +1000
From: Stephan Carydakis <steph@hotkey.net.au>
Subject: SORTING HASHES (THE NEWBIE WAY!!)
Message-Id: <3589534B.2772@hotkey.net.au>
Hello All,
I know I say this on every post I make, but please excuse my ignorance
as I am a newbie Perl hacker(who is a full time musician).
My Question(s):
Can one sort a HASH on the Values??
Or is there a method to do this somehow??
I thought I could maybe output the contents of the hash to a flat text
file, reversing the key/values, then reading them back in to another
hash which can then be sorted. BUT, this didn't work as some of the
keys(which were the values) are equivalent and I got an ODD NUMBER OF
ELEMENTS IN HASH LIST error :[
I've read through the camel and cant seem to find anything that will
solve my problem although I bet there is ay??
If someone could point me in the right direction or offer their learned
opinion, I would greatly appreciate it. I'm not asking for the code to
solve this problem as I do enjoy trying to solve my problems on my
own.(but code would be nice too :-] )
Thanks
____________________________________________
Stephan Carydakis steph@hotkey.net.au
"I'm a Musician.......What's Software?"
print "Howdy, world!\n";
____________________________________________
------------------------------
Date: Thu, 18 Jun 1998 18:13:50 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: SORTING HASHES (THE NEWBIE WAY!!)
Message-Id: <Pine.GSO.3.96.980618111313.13348S-100000@user2.teleport.com>
On Fri, 19 Jun 1998, Stephan Carydakis wrote:
> Subject: SORTING HASHES (THE NEWBIE WAY!!)
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> Can one sort a HASH on the Values??
The FAQ talks about this. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 17:31:21 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: subject and sender using open mail
Message-Id: <Pine.GSO.3.96.980618103010.13348L-100000@user2.teleport.com>
On Wed, 17 Jun 1998, Claudio Villa Santa wrote:
> Somebody can tell me what I'll can specify subject and sender using the the
> command
>
> open (mail, "pippo@ppp.com")
That's not the way to do it, of course. See the docs for your mail program
for what you're asking, but see the perldata and perlfunc manpages for
what you'll need to know to call your mail program properly from perl.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 13:33:35 -0400
From: "Kenneth" <kenkim@gncom.com>
Subject: Using PERL to do a remote TELNET
Message-Id: <6mbj85$qgj$1@demon.uunet.ca>
I am having some troubles getting perl in UNIX to telnet to a remote host
and grab necessary information and then exit.. Maybe I am doing something
wrong, but it won't even get to the LOGIN prompt before it exits.
This is basically what I am doing:
open (TEL,"|telnet somesite.com");
while (<TEL>)
{
$dum = <TEL>;
if ($dum =~ /login/i)
{
print TEL "username";
}
if ($dum =~ /pass/i)
{
print TEL "password";
}
print "$dum";
}
But all I seem to get from this is:
Trying somesite.com..
Connected to somesite.com...
Escape Character is '^]'...
Connection to host has been closed.
Thanks for any info regarding this matter.
Gorkem Yuksel
------------------------------
Date: Thu, 18 Jun 1998 17:55:21 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Using PERL to do a remote TELNET
Message-Id: <Pine.GSO.3.96.980618105440.13348O-100000@user2.teleport.com>
On Thu, 18 Jun 1998, Kenneth wrote:
> open (TEL,"|telnet somesite.com");
You may want a module like Net::Telnet instead. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 14:11:17 -0400
From: Cornelius Griffin <escrubb@att.net>
Subject: Using STDIN as a symbolic reference?
Message-Id: <6mbl7g$9c@bgtnsc02.worldnet.att.net>
All,
I am trying to read in a string from STDIN, then use that string as
a symbolic reference. For Example:
$i = <STDIN>;
$$i = "help";
print "$jan\n";
Now, if I enter ' jan ' from the console, I cannot get it to print
out "help". However, if I change the first line to:
$i = "jan";
"help" is printed out fine. Is there something different about the
way perl stores STDIN that restricts STDIN from being used as a symbolic
reference? Any Help would be appreciated. thanks.
Cornelius
------------------------------
Date: Thu, 18 Jun 1998 11:22:19 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Using STDIN as a symbolic reference?
Message-Id: <MPG.ff2fab35ab613879896ce@nntp.hpl.hp.com>
In article <6mbl7g$9c@bgtnsc02.worldnet.att.net>, Cornelius Griffin
<escrubb@att.net> says...
> All,
>
> I am trying to read in a string from STDIN, then use that string as
> a symbolic reference. For Example:
>
> $i = <STDIN>;
> $$i = "help";
>
> print "$jan\n";
>
> Now, if I enter ' jan ' from the console, I cannot get it to print
> out "help". However, if I change the first line to:
>
> $i = "jan";
>
> "help" is printed out fine. Is there something different about the
> way perl stores STDIN that restricts STDIN from being used as a symbolic
> reference? Any Help would be appreciated. thanks.
There is a newline character at the end when it is read in from STDIN.
To get rid of it:
chomp($i = <STDIN>;
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 2901
**************************************