[9296] in Perl-Users-Digest
Perl-Users Digest, Issue: 2892 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 17 12:07:21 1998
Date: Wed, 17 Jun 98 09:01:38 -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 Wed, 17 Jun 1998 Volume: 8 Number: 2892
Today's topics:
Perl shell scripts in IIS 4.0 gfarris@my-dejanews.com
Perl shell scripts in IIS 4.0 gfarris@my-dejanews.com
Re: Placing variables in system calls <barnett@houston.Geco-Prakla.slb.com>
Re: Pod::Text -- Unix only? <dfan@harmonixmusic.com>
Re: Reading in multiple lines from file--elegant soluti <vallon@bear.com>
Reading the values, not the characters <p3_oksanen@hotmail.com>
Re: REVIEW: Perl CGI Programming - No Experience Requir <merlyn@stonehenge.com>
Re: REVIEW: Perl CGI Programming - No Experience Requir (Abigail)
SMTP blocking detection script comments requested. <5@mail.com>
Re: strange error message .. "value of <handle> ..." <dformosa@st.nepean.uws.edu.au>
Re: strange error message .. "value of <handle> ..." (Michael J Gebis)
Re: use strict; 755 permissions and file writing <dformosa@st.nepean.uws.edu.au>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 17 Jun 1998 14:22:31 GMT
From: gfarris@my-dejanews.com
Subject: Perl shell scripts in IIS 4.0
Message-Id: <6m8jf7$ckk$1@nnrp1.dejanews.com>
I'm having an odd problem running Perl through IIS 4.0.
I can successfully execute a Perl script through IIS. However, I seem to be
unable to return the results of a shell command.
For example,
$a = `dir `;
leaves $a empty. When I run the perl script interactively instead of through
the browser, $a is populated with the results of the directory listing.
However, when I change the command to redirect to a file,
$a = `dir > testing.txt`;
the file testing.txt is created whether I'm running the script as a CGI or
interactively.
If anyone has seen this before, I'd appreciate any help.
Thanks
Giovanni
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 17 Jun 1998 14:25:06 GMT
From: gfarris@my-dejanews.com
Subject: Perl shell scripts in IIS 4.0
Message-Id: <6m8jk2$co9$1@nnrp1.dejanews.com>
I'm having an odd problem running Perl through IIS 4.0.
I can successfully execute a Perl script through IIS. However, I seem to be
unable to return the results of a shell command.
For example,
$a = `dir `;
leaves $a empty. When I run the perl script interactively instead of through
the browser, $a is populated with the results of the directory listing.
However, when I change the command to redirect to a file,
$a = `dir > testing.txt`;
the file testing.txt is created whether I'm running the script as a CGI or
interactively.
If anyone has seen this before, I'd appreciate any help.
Thanks
Giovanni
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 17 Jun 1998 09:46:02 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Placing variables in system calls
Message-Id: <3587D6AA.CC71A52E@houston.Geco-Prakla.slb.com>
[courtesy cc to cited author]
Wesley Posvar wrote:
>
> I am new to Perl, and was wondering, if there is way to place variables
> into system calls with qx.
Sure.
> Everything I've tried doesn't work the way I
> intended.
Okay.
Less information would be useful.
What have you tried?
Code snippet (considered very helpful for those wanting to help you)?
What did you get?
What did you think you should have gotten?
What platform are you running on? Mine is Unix.
#!/usr/local/bin/perl -w
#
$command = "df -k .";
$results = qx($command);
print "$results\n";
__END__
I get the results I expect. Do you?
I get a df output of the file system in which this script is located.
If you don't, perhaps a snippet of code showing what you've tried and
any errors/unexpected results would be helpful.
Otherwise, posting to comp.lang.perl.psychic-friends would probably be
more helpful for you. *grin*
HTH.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
----------------------------------------------------------------------
Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------
------------------------------
Date: 17 Jun 1998 10:33:15 -0400
From: Dan Schmidt <dfan@harmonixmusic.com>
Subject: Re: Pod::Text -- Unix only?
Message-Id: <wkzpfc2j4k.fsf@turangalila.harmonixmusic.com>
Tom Christiansen <tchrist@mox.perl.com> writes:
| [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.
Not to put down Pod::Text at all, but Perl itself is even more portable
than that, since it runs on some non-Unix systems as well.
If you read "portable" to mean "working on all the systems for
which Perl is available", maybe the original statement becomes less
umbragious.
| If you want more than that, you'll have to write the program
| yourself.
It sounds like he is willing to do that and is asking for advice.
--
Dan Schmidt -> dfan@harmonixmusic.com, dfan@alum.mit.edu
Honest Bob & the http://www2.thecia.net/users/dfan/
Factory-to-Dealer Incentives -> http://www2.thecia.net/users/dfan/hbob/
Gamelan Galak Tika -> http://web.mit.edu/galak-tika/www/
------------------------------
Date: Wed, 17 Jun 1998 15:31:19 GMT
From: Justin Vallon <vallon@bear.com>
Subject: Re: Reading in multiple lines from file--elegant solution?
Message-Id: <x6ed8c811y0.fsf@pearl.bear.com>
sylvia@lsbio.com writes:
> Hello,
>
> Is there a more elegant way to do this?
>
> I need to parse out a file which looks something like this:
>
> //
> value1: abcdef
> value2: arwererbcdef
> value3: aweroiupoiwuer
> rweqarsfaserawer
> rweruiwoufoaeu
> //
> value1: abcdwerweef
> value2: abcderweef
> value3: aweroiupoiwuer
> rweqarsfaserawer
> rweruiwoufoaeu
> //
local @recs = grep { $_ ne '' } split /^\/\/\n/m, join '', <DATA>
--
-Justin
vallon@bear.com
------------------------------
Date: Wed, 17 Jun 1998 17:26:46 +0100
From: Petri Oksanen <p3_oksanen@hotmail.com>
Subject: Reading the values, not the characters
Message-Id: <3587E036.3B3@hotmail.com>
If this is in the docs, please just direct me to the right part of it
and I won't waste your time anymore.
I want to do the equivalent of this C in Perl:
unsigned char foo='a';
printf("Char: %c\nDec: %d\n", foo, foo);
I want to know the value of a byte, not the ascii character it
represents.
I tried:
$foo = 'a';
printf("Char: %s\nDec: %d\n", $foo, $foo);
But that is obviously not the right way to do it, since it wont even
parse.
If someone knows where this is documented, please let me know where.
My intention with this exercise is to see if I can read numeric values
from a binary file. If there is a better way to do it, I would be more
than happy to try it out.
With kind regards,
Petri Oksanen
p3_oksanen@hotmail.com
------------------------------
Date: Wed, 17 Jun 1998 13:40:22 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <8cu35kgn9h.fsf@gadget.cscaper.com>
>>>>> "Chris" == Chris Nandor <pudge@pobox.com> writes:
Chris> I really don't see how it is tough. A list is just a bunch of loose
Chris> values in a ... list.
Chris> 1, 2, 3 # list
Chris> 1..3 # list
Chris> @a # not a list
Chris> 1 # not a list
Chris> $b # not a list
Chris> qw(1 2) # list
Not to confuse things too much, but I could argue (successfully :)
that I cannot determine whether those are list values or scalar values
without looking at the context. For example:
$a = (1,2,3) # not a list here - comma operator
@a = (1,2,3) # now a list!
$a = 1..3 # not a list here - flip-flop operator
@a = 1..3 # now a list
and so on. So, even looking at THAT list (ahem :-), you still cannot
say conclusively "This is [not] a list".
Chris> Pretty much. A list is just a bunch of values floating around somewhere.
Well, I can agree with that, but you cannot determine if something is
*parsed* as a list without looking at context.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 76 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 17 Jun 1998 15:46:06 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <6m8obu$2jb$1@client3.news.psi.net>
Rahul Dhesi (c.c.eiftj@54.usenet.us.com) wrote on MDCCLI September
MCMXCIII in <URL: news:6m832q$57l$1@samba.rahul.net>:
++
++ In the absence of any other useful definition, what choice do I have but
++ to create my own? I find it logical and intuitive:
++
++ If we use subscript notation on it at least once, it's an array;
++ otherwise it's not.
Just because you make up your own definition doesn't make Perl
behave accordingly to it.
Abigail
--
Arrays are blue, lists are black.
------------------------------
Date: Wed, 17 Jun 1998 11:34:50 -0600
From: gk <5@mail.com>
Subject: SMTP blocking detection script comments requested.
Message-Id: <3587FE3A.58AD7889@mail.com>
Hi.
The purpose of the following code is to see if smtp traffic (email) from
one domain is
being blocked by another. I'm kinda new to perl/smtp, and would
appreciate any
suggestions/hints/remarks.
It uses the local server's nslookup to find the remote server's mail
exchanger. It splits and
snags the first mail exchanger it finds after doing an 'nslookup
-type=mx domain.com' ...
it then telnets to port 25 of mailexchanger.domain.com
tries to send an email from user@domainwhichmaybebeingblocked.com
if it receives a 250 code (dunno if 'Sender ok' is universal), then that
means, i *hope* that
domain.com is not blocking mail from domainwhichmaybebeingblocked.com...
Is my idea flawed? Am I not accounting for something? Below is my code
which works
the way I described above *crosses fingers*:
My hopes is to have this work 100% of the time, to prove whether or not
domain A is
blocking domain B.
Thanks!
Yes, 5@mail.com is my real email address.
#!/usr/local/bin/perl
use FileHandle;
use IPC::Open2;
$ARGV[0] ne "" and $ARGV[1] ne "" or die "Usage: block_mx.pl [server]
[domain]\$
$server = $ARGV[0];
$domain = $ARGV[1];
$mx = "";
print "Server = $server\nDomain = $domain\n";
# Read the messages from the mx record to snag the mail server address
# Search only till one mx is found
open2 (\*Reader, \*Writer, "nslookup -type=mx $server\n");
while ($line = <Reader> and $mx eq "") {
# If mail server is detected then yeah!
if ($line=~ /mail exchanger = /) {
($bleh, $mx) = split("mail exchanger = ", $line);
chomp($mx);
}
}
close Reader;
close Writer;
# In case the mail exchanger is not found
if ($mx eq "") {
print "Mail Exchanger not found\n";
exit;
}
print "Mail Exchanger = $mx\n";
open2 (\*Reader, \*Writer, "telnet $mx 25\n");
Writer->autoflush();
print Writer "helo anydomain.com\n";
print Writer "mail from:user\@$domain\n";
print Writer "quit\n";
while ($got = <Reader>) {
#print "got:\n$got\n";
die "Status = OK\n" if $got=~ /250/;
}
print "Status = Address blocked!\n";
close Reader;
close Writer;
exit;
------------------------------
Date: 17 Jun 1998 14:46:11 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: strange error message .. "value of <handle> ..."
Message-Id: <898094770.647427@cabal>
In <ebohlmanEunnM7.4CA@netcom.com> Eric Bohlman <ebohlman@netcom.com> writes:
[...]
>It is *not* rude to say "my news server is acting up, so please CC me on
>any followups."
I wonder what whould happen if you used the line "email me and I will post
a summery of the posts to usenet?" these days.
--
I'm a perl programer; if you need perl programing, hire me.
Please excuse my spelling as I suffer from agraphia; see the url. Support NoCeM
http://www.cit.nepean.uws.edu.au/~dformosa/Spelling.html http://www.cm.org/
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: 17 Jun 1998 15:38:25 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: strange error message .. "value of <handle> ..."
Message-Id: <6m8nth$sa6@mozo.cc.purdue.edu>
? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au> writes:
}In <ebohlmanEunnM7.4CA@netcom.com> Eric Bohlman <ebohlman@netcom.com> writes:
}>It is *not* rude to say "my news server is acting up, so please CC me on
}>any followups."
}I wonder what whould happen if you used the line "email me and I will post
}a summery of the posts to usenet?" these days.
What!?!?! U would DARE post private e-mail? I've been on the net a
LONG time (since January) and my provider (CyberNetMegaDyne)
specifically says that this is a bad thing. dOes anybody know how to
get ICQ to play music, mine seems to be broken. thanx.
;)
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: 17 Jun 1998 14:53:47 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: use strict; 755 permissions and file writing
Message-Id: <898095227.353651@cabal>
In <6m6rbn$70$1@news-1.news.gte.net> Rick Parks <rapark1@pop.uky.edu> writes:
[...]
>I wrote an SSI counter script a while back, before "-Tw" and "use
>strict;". I extracted the calling page and directory from
>$ENV{DOCUMENT_URI} (Say /~rapark1/test.shtml). From this I extracted
>"test" and concatenated it with ".count" and got my counter file. All
>good so far. In my first writing, I could create a file in a directory
>with 755 permissions, but after implementing "-Tw" and "use strict;", I
>cannot. Can anyone tell me why?
Perl dosn't trust the outside world when running as -T, it things that
someone could have slipped something nasty into $ENV{DOCUMENT_URL} and
useing it as a file name to open with ect could result in something other
then you expect. For example it would be C</~rapark1/`rm -rf .*`.shtml>
which would translate into C<open(FILE,">`rm -rf .*`.count">
--
I'm a perl programer; if you need perl programing, hire me.
Please excuse my spelling as I suffer from agraphia; see the url. Support NoCeM
http://www.cit.nepean.uws.edu.au/~dformosa/Spelling.html http://www.cm.org/
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
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 2892
**************************************