[11275] in Perl-Users-Digest
Perl-Users Digest, Issue: 4875 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 11 23:07:18 1999
Date: Thu, 11 Feb 99 20:00:17 -0800
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, 11 Feb 1999 Volume: 8 Number: 4875
Today's topics:
\n won't work <bgarrett@hamilton.net>
Re: \n won't work (Sam Holden)
Re: \n won't work <cybir@echoweb.net>
Re: \n won't work <rick.delaney@home.com>
Re: cannot run *.pl on browser (Abigail)
CGI::Push & IE 4.0 problem. <kksv@bellatlantic.net>
Re: CGI::Push & IE 4.0 problem. (Sam Holden)
Re: change column of nmbers to 2 dim array (Abigail)
Re: Comments in Perl code (Abigail)
Re: Deleting array elements while looping through... (Abigail)
Easy Q for a Perl Pro (Dustin Christopher Preuitt)
Re: Easy Q for a Perl Pro <rick.delaney@home.com>
Re: how do I get a date in perl? <psnj@my-dejanews.com>
Re: Newbie sockets question netperf@my-dejanews.com
Re: newbie: hitcounter (Abigail)
Re: newbie: hitcounter (Abigail)
No. of lines in a file krish_v@my-dejanews.com
Re: No. of lines in a file <rra@stanford.edu>
Ns2h: speed-up your connection zebu@innocent.com
Re: Ns2h: speed-up your connection <rra@stanford.edu>
Re: Perl function to reboot NT Server? (Abigail)
Re: Perl function to reboot NT Server? <gbuehler@med.unc.edu>
Re: perl password example <walton@frontiernet.net>
Perl tutorials?? <bgarrett@hamilton.net>
using perl to talk to oracle database padhu@yahoo.com
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 11 Feb 1999 21:20:50 -0800
From: Bill Garrett <bgarrett@hamilton.net>
Subject: \n won't work
Message-Id: <36C3BA30.5FC58D25@hamilton.net>
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print "hello world\n";
print "how come the new line character won't work?\n";
print "I sure wish it would!\n";
Could someone please tell me why \n doesn't cause this to go onto a new
line. I created this script and \n doesn't work but on some other
scripts I have installed it worked. hwat is wrong with this one??
thanks,
jason@wbdet.com
------------------------------
Date: 12 Feb 1999 03:32:20 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: \n won't work
Message-Id: <slrn7c7864.3h0.sholden@pgrad.cs.usyd.edu.au>
On Thu, 11 Feb 1999 21:20:50 -0800, Bill Garrett <bgarrett@hamilton.net> wrote:
>#!/usr/local/bin/perl
> print "Content-type: text/html\n\n";
> print "hello world\n";
> print "how come the new line character won't work?\n";
> print "I sure wish it would!\n";
>
>Could someone please tell me why \n doesn't cause this to go onto a new
>line. I created this script and \n doesn't work but on some other
>scripts I have installed it worked. hwat is wrong with this one??
>thanks,
How does the above not work?
If you actually cut and paste the part of the code that doesn't work then
someone might be able to help you.
I have my suspicions as to what the problem is, but since you didn't
post the code that wasn't working I'm not going to explain them.
--
Sam
Just don't create a file called -rf. :-)
--Larry Wall
------------------------------
Date: Thu, 11 Feb 1999 19:43:13 -0800
From: =?iso-8859-1?Q?Cyb=EER?= <cybir@echoweb.net>
Subject: Re: \n won't work
Message-Id: <36C3A351.1D95BD7E@echoweb.net>
If you are trying to print this to an html document you need a <br> tag
inbetween the lines, \n just makes a new line in the html source.
Ex.
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print "hello world<br>\n";
print "Oh look it makes new lines<br>\n";
print "I'm so glad!<br>\n";
Bill Garrett wrote:
> #!/usr/local/bin/perl
> print "Content-type: text/html\n\n";
> print "hello world\n";
> print "how come the new line character won't work?\n";
> print "I sure wish it would!\n";
>
> Could someone please tell me why \n doesn't cause this to go onto a new
> line. I created this script and \n doesn't work but on some other
> scripts I have installed it worked. hwat is wrong with this one??
> thanks,
> jason@wbdet.com
------------------------------
Date: Fri, 12 Feb 1999 03:48:57 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: \n won't work
Message-Id: <36C3A67E.B1EFE323@home.com>
[posted & mailed]
Sam Holden wrote:
>
[working code snipped]
>
> How does the above not work?
>
> If you actually cut and paste the part of the code that doesn't work
> then someone might be able to help you.
I think he did.
> I have my suspicions as to what the problem is, but since you didn't
> post the code that wasn't working I'm not going to explain them.
I have my suspicions as well, but I believe it's the description of
"won't work" that is lacking, not the code snippet.
I won't guess at an answer either since if my suspicions are correct,
this is not a Perl question.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: 12 Feb 1999 01:17:05 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: cannot run *.pl on browser
Message-Id: <79vveh$l63$4@client2.news.psi.net>
Chris Ow Yong (oyhpeen@bigfoot.com) wrote on MCMXC September MCMXCIII in
<URL:news:1999Feb11.160651.23332@leeds.ac.uk>:
$$ I am using Win95. I have written a simple perl script which incorporates
$$ cgi.pm. When I run *.pl on the web browser(IE3), the web browser keeps popping
$$ out the save to or open window. Please help.
That seems to be a non-perl issue. Fix your server, or your browser.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
------------------------------
Date: Thu, 11 Feb 1999 22:38:11 -0500
From: Kandarp Sevak <kksv@bellatlantic.net>
Subject: CGI::Push & IE 4.0 problem.
Message-Id: <36C3A223.DAB0E4EC@bellatlantic.net>
I am looking for solutions to following two problems.
1. I have a 'nph-' server-push script, which pushes an GIF image on the
current browser page and keeps-on updating it. With Netscape 4.5 it
seems to work and the animation can be seen. But with Internet Explorer
4.0, it goes into 'file download' mode. I tried to look for
programs/application setup change, but could not find it in IE 4.0. The
'nph-' script resides in 'cgi-bin' on a AIX box, and netscape/IE is on a
NT 4.0 client. The perl version is 5.004 with CGI.pm and CGI::Push.pm.
The GIF is created 'inline' and not coming from a file.
2. Another problem I have is with the same script for netscape 4.5. When
the script is invoked typing full URL in the browser, the script
executes only once and exits. But clicking on 'reload' loads the image
and keeps on updating, giving proper animation. This problem does not
occur if the contents of the page are 'text/html' instead of
'image/gif' as specified in the 'do_push' method of CGI::Push.
I'll appreciate any help solving these problems.
Send reply to kksv@bellatlantic.net or post it to the group.
Thanks.
------------------------------
Date: 12 Feb 1999 03:41:48 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: CGI::Push & IE 4.0 problem.
Message-Id: <slrn7c78ns.47c.sholden@pgrad.cs.usyd.edu.au>
On Thu, 11 Feb 1999 22:38:11 -0500, Kandarp Sevak <kksv@bellatlantic.net> wrote:
>I am looking for solutions to following two problems.
>
>1. I have a 'nph-' server-push script, which pushes an GIF image on the
>current browser page and keeps-on updating it. With Netscape 4.5 it
>seems to work and the animation can be seen. But with Internet Explorer
>4.0, it goes into 'file download' mode. I tried to look for
>programs/application setup change, but could not find it in IE 4.0. The
>'nph-' script resides in 'cgi-bin' on a AIX box, and netscape/IE is on a
>NT 4.0 client. The perl version is 5.004 with CGI.pm and CGI::Push.pm.
>The GIF is created 'inline' and not coming from a file.
This has nothing to do with perl. Ask in a more appropriate forum.
>
>2. Another problem I have is with the same script for netscape 4.5. When
>the script is invoked typing full URL in the browser, the script
>executes only once and exits. But clicking on 'reload' loads the image
>and keeps on updating, giving proper animation. This problem does not
>occur if the contents of the page are 'text/html' instead of
>'image/gif' as specified in the 'do_push' method of CGI::Push.
This also had nothing to do with perl.
>
>I'll appreciate any help solving these problems.
>Send reply to kksv@bellatlantic.net or post it to the group.
If you ask the right people in the right place you might even get some.
--
Sam
It has been discovered that C++ provides a remarkable facility for
concealing the trival details of a program--such as where its bugs are.
--David Keppel
------------------------------
Date: 12 Feb 1999 01:12:37 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: change column of nmbers to 2 dim array
Message-Id: <79vv65$l63$3@client2.news.psi.net>
Bart Lateur (bart.lateur@skynet.be) wrote on MCMXC September MCMXCIII in
<URL:news:36c42b72.548371@news.skynet.be>:
!! Abigail wrote:
!!
!! ><> grep/map in void context is considered bad form.
!! >
!! >It's considered bad form by some.
!!
!! Including me.
!!
!! "grep" in void context is *definitly* bad form, since it doesn't do
!! anything it was designed for, i.e. filtering data.
!!
!! "map" in a void context is bad too, again, because it's not used for
!! what it was designed for: construct a list of results of applying a
!! function to each item in a source list. In fact, the mere fact that
!! "map" *can* change that item is bad form enough. For efficiency reasons,
!! it will remain like that. But I, for one, think it is bad form to rely
!! on that fact.
Who says map changing the elements of the list it iterates over has
something to do with using it in void context?
In fact, map is an operation heavily used in functional languages.
Functional languages have a tendency to be side effect free as well.
!! Besides, what do you find so attractive in:
!!
!! map BLOCK LIST;
!!
!! over:
!!
!! foreach (LIST) BLOCK
!!
Order in which things appear. What I do is often more important then
on what I perform things.
What's so attractive about foreach (LIST) {BLOCK} ?
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
------------------------------
Date: 12 Feb 1999 01:19:20 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Comments in Perl code
Message-Id: <79vvio$l63$5@client2.news.psi.net>
Ala Qumsieh (aqumsieh@matrox.com) wrote on MCMLXXXVII September MCMXCIII
in <URL:news:x3yzp6ooncy.fsf@tigre.matrox.com>:
!!
!! Eric Kihn <kihn@mindspring.com> writes:
!!
!! > As a final thought. Has anyone considered how simple it would be to
!! > write a script called deploy.pl that simply
!! > strips all the comments (and even white space if you want) so that the
!! > "user" version is as fast as can be, but the coder get's his comments?
!!
!! Yeah .. it's extremly simple ..
!!
!! % perl -pi.bak -e 's/\#.*$//' file.pl
Do you realize that program fails on itself?
Abigail
--
perl -wle\$_=\<\<EOT\;y/\\\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT
------------------------------
Date: 12 Feb 1999 01:22:37 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Deleting array elements while looping through...
Message-Id: <79vvot$l63$6@client2.news.psi.net>
dhosek@webley.com (dhosek@webley.com) wrote on MCMXC September MCMXCIII
in <URL:news:79v6tt$8mm$1@nnrp1.dejanews.com>:
,, Programmatically it's really not a problem:
,,
,, $j=0;
,, ENTRY: for(@test) {
,, if ($_ meets deletion criteria) {
,, @test=(@test[0..$j-1],$test[$j+1..$#test]);
,, redo ENTRY;
,, }
,, $j++;
,, }
,,
,, Questions: Am I really as bullet-proof as I think I am? Is there a more
,, efficient way to delete the $j'th element of @test? Does this save memory? It
,, occurs to me that this may actually just waste memory and I'd be better off
,, simply marking array entries as invalid...
grep
Abigail
--
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT
------------------------------
Date: 12 Feb 1999 01:00:52 GMT
From: preuitt@ix.cs.uoregon.edu (Dustin Christopher Preuitt)
Subject: Easy Q for a Perl Pro
Message-Id: <79vug4$dof$1@helix.cs.uoregon.edu>
I need to help in doing the following:
I want to take a line of text and translate everything in parenthesis to uppercase and everything else to lower case.
Example:
My keys are in the (upper left) drawer.
would become
my keys are in the (UPPER LEFT) drawer.
understand?
Thanks.
------------------------------
Date: Fri, 12 Feb 1999 03:56:18 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Easy Q for a Perl Pro
Message-Id: <36C3A840.BDCBAB8B@home.com>
[posted & mailed]
Dustin Christopher Preuitt wrote:
>
> My keys are in the (upper left) drawer.
>
> would become
>
> my keys are in the (UPPER LEFT) drawer.
Check out these FAQs:
How do I capitalize all the words on one line?
How can I pull out lines between two patterns that are themselves on
different lines?
I think all the information you need is in those two. If not you can
for sure fill in the blanks with these documents:
perlre
perlop
perlfunc
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Fri, 12 Feb 1999 02:12:01 GMT
From: psnj <psnj@my-dejanews.com>
Subject: Re: how do I get a date in perl?
Message-Id: <7a02l9$21h$1@nnrp1.dejanews.com>
In article <36C245D7.AF0536A5@erols.com>,
"Matthew O. Persico" <mpersico@erols.com> wrote:
> Why not just ask her? :-)
>
> --
> Matthew O. Persico
> http://www.erols.com/mpersico
> http://www.digistar.com/bzip2
>
It is to laugh... Seriously, who wouldn't want a date with a lovely named
Perl?
pj --- london ontario canada
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 12 Feb 1999 03:18:03 GMT
From: netperf@my-dejanews.com
Subject: Re: Newbie sockets question
Message-Id: <7a06h4$55t$1@nnrp1.dejanews.com>
Which FIN_WAIT? FIN_WAIT_1, or FIN_WAIT_2?
FIN_WAIT_1 is an active retransmission state and should timeout eventually.
FIN_WAIT_2 is actually a passive state that relies on the remote (client) to
do the right thing and 1) not use a bogus abortive close (often accomplished
through SO_LINGER) and 2) not simply power off.
Since that is hard to enforce (though good application design and
implementation can deal with issue 1) some stacks can use the TCP Keepalive
mechanism to cull FIN_WAIT_2 connections. The app sets SO_KEEPALIVE and then
after the keepalive interval (default two hours, often tunable, but don't
make it less than four mintues) a probe is sent - if the remote part of the
connection is not there, the connection shuts down.
If you real problem is restarting your server app, that is fixed with a
SO_REUSEADDR setsockopt before the bind to the well-known port.
More on all this can be found in W. Richard Stevens' Unix Network Programming
series.
rick jones
raj in the cup subdomain of the hp subdomain of com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 12 Feb 1999 01:24:14 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: newbie: hitcounter
Message-Id: <79vvru$l63$7@client2.news.psi.net>
John (john@inetpres.com) wrote on MCMXC September MCMXCIII in
<URL:news:36C30334.753A3C93@inetpres.com>:
&& I would like to use perl to create a hitcounter for a website. Does
&& anyone know of some documentation or examples that could get me started
&& and/or show me what to look out for?
I would start with 0.
Abigail
--
perl -wlne '}{print$.' file # Count the number of lines.
------------------------------
Date: 12 Feb 1999 01:26:40 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: newbie: hitcounter
Message-Id: <7a000g$l63$8@client2.news.psi.net>
I R A Aggie (fl_aggie@thepentagon.com) wrote on MCMXC September MCMXCIII
in <URL:news:slrn7c6qap.dtq.fl_aggie@enso.coaps.fsu.edu>:
\\ On Thu, 11 Feb 1999 23:17:58 +0100, Alan J. Flavell
\\ <flavell@mail.cern.ch> wrote:
\\
\\ + On 11 Feb 1999, I R A Aggie wrote:
\\
\\ + > Hitcounters lie.
\\ + Nope, they count exactly what they count.
\\
\\ You're right. They're mis-named. "Number of requests for this page to this
\\ web server" may be more descriptive?
No. It's more "number of requests for this counter to this webserver that
actually resulted in executing the counter". But then only if the thing
was programmed correctly.
I wonder why people want annoy their visiters with more delays.
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
------------------------------
Date: Fri, 12 Feb 1999 01:51:13 GMT
From: krish_v@my-dejanews.com
Subject: No. of lines in a file
Message-Id: <7a01ed$101$1@nnrp1.dejanews.com>
I've seen Abigail use
perl -wlpe '}$_=$.;{' filename
to find the number of lines in a file.
What is the role of the following?
l, } and {
As a novice, I would do this as:
perl -we 'while (<>) {}; print "$.\n";' filename
In the doc, I've read that 'p' loops through the script and prints.
The best I can do is the following that, unfortunately, prints every line no.
perl -wpe '$_=$' filename
----------------------------------------------------------------
Thanks
Krish
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 11 Feb 1999 18:23:43 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: No. of lines in a file
Message-Id: <yl7lto8imo.fsf@windlord.stanford.edu>
krish v <krish_v@my-dejanews.com> writes:
> I've seen Abigail use
> perl -wlpe '}$_=$.;{' filename
> to find the number of lines in a file.
> What is the role of the following?
> l, } and {
Deep and unreliable magic related to Perl's internal interpretation of -p
and how code is wrapped around it. I wouldn't use that method; it may
continue to work in the future, but it's not documented and therefore may
not.
> As a novice, I would do this as:
> perl -we 'while (<>) {}; print "$.\n";' filename
perl -ne 'END { print "$.\n" }'
will work fine. -n is like -p but it doesn't print every line. Things
inside an END {} block run at the very end of the script, when it's
exiting.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Fri, 12 Feb 1999 01:40:57 GMT
From: zebu@innocent.com
Subject: Ns2h: speed-up your connection
Message-Id: <7a00r7$g9$1@nnrp1.dejanews.com>
#!/usr/bin/perl
##########################################################
# #
# ns2h parses your Netscape (c) bookmarks, #
# find the IP addresses of your favorite sites #
# and adds them to your /etc/hosts file, speeding #
# up your connection to the 'net. #
# #
# Please make a backup copy of your hosts file! #
# Run ns2h as root in your home directory... #
# #
# This is poor Perl, don't hesitate to send me #
# better versions as I'm just beginning to learn #
# Perl. #
# F. Wisard, zebu@innocent.com #
# #
##########################################################
open (BOOK, ".netscape/bookmarks.html") or die "pb: $! \n";
open (TMP, ">ns2h.tmp") or die "pb: $! \n";
while (<BOOK>) {
print TMP if /\/\/.*\// ;
}
close (TMP);
open (TMP, "ns2h.tmp") or die "pb: $! \n";
open (TMP2, ">ns2h.tmp2") or die "pb: $! \n";
while ($ligne = <TMP>) {
@res = split (/\//, $ligne);
print TMP2 $res[2], "\n";
}
#Gee... I guess there's another way... maybe
a #"foreach"?
close (TMP2);
open (TMP2, "ns2h.tmp2") or die "pb: $! \n";
open (RES, ">>/etc/hosts") or die "pb: $! \n";
while ($ligne2 = <TMP2>) {
chop $ligne2;
$z = gethostbyname ($ligne2);
($a, $b, $c, $d) = unpack('C4', $z);
print RES $a, ".", $b,".",$c, ".", $d, "\t", $ligne2, "\n";
}
close (RES);
unlink "ns2h.tmp", "ns2h.tmp2";
print STDOUT "Done.";
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 11 Feb 1999 18:01:07 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Ns2h: speed-up your connection
Message-Id: <ylaeyk8joc.fsf@windlord.stanford.edu>
zebu <zebu@innocent.com> writes:
> #!/usr/bin/perl
> ##########################################################
> # #
> # ns2h parses your Netscape (c) bookmarks, #
> # find the IP addresses of your favorite sites #
> # and adds them to your /etc/hosts file, speeding #
> # up your connection to the 'net. #
So what happens if those sites then change IP addresses? And what sort of
horrible ISP do you have that name service lookups are an appreciable
delay in the overall length of time you spend browsing? And if you're
using Unix anyway, and therefore have an /etc/hosts, why not just run a
caching name server locally if you're worried about speed of lookups?
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 12 Feb 1999 01:52:44 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl function to reboot NT Server?
Message-Id: <7a01hc$lvb$1@client2.news.psi.net>
Alastair (alastair@calliope.demon.co.uk) wrote on MCMXCI September
MCMXCIII in <URL:news:slrn7c6sbm.5b.alastair@calliope.demon.co.uk>:
\\ Georg Buehler <gbuehler@NOSPAMmed.unc.edu> wrote:
\\ >I need to programmatically reboot a Windows NT 4.0 server using Perl.
\\ >
\\ >I'm sure such a function exists, but I've poured over the module
\\ >documentation in vain.
\\
\\ I guess that if there's a way to do it from an NT command line, you could use
\\ 'system' to run that command. Maybe someone knows in an NT group?
Any command NT has a certain chance to reboot the machine, hasn't it?
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
-> define ("foldoc", "perl")) [0] -> print'
------------------------------
Date: Thu, 11 Feb 1999 22:40:47 -0500
From: "Georg Buehler" <gbuehler@med.unc.edu>
Subject: Re: Perl function to reboot NT Server?
Message-Id: <7a084j$ltb$1@camel18.mindspring.com>
That's just the problem. There _isn't_ a simple command-line in NT to
reboot. The NT Resource Kit includes a shutdown.exe program for doing a
command-line reboot, but it's commercial software, part of an expensive
package and not something I can just download.
I know this sucker exists in a Perl module somewhere, I remember
experimenting with it several months ago, but I just can't find it.
--Georg
Alastair wrote in message ...
>Georg Buehler <gbuehler@NOSPAMmed.unc.edu> wrote:
>>I need to programmatically reboot a Windows NT 4.0 server using Perl.
>>
>>I'm sure such a function exists, but I've poured over the module
>>documentation in vain.
>
>I guess that if there's a way to do it from an NT command line, you could
use
>'system' to run that command. Maybe someone knows in an NT group?
>
>Good luck.
>
>--
>
>Alastair
>work : alastair@psoft.co.uk
>home : alastair@calliope.demon.co.uk
------------------------------
Date: 12 Feb 1999 03:52:29 GMT
From: Bob Walton <walton@frontiernet.net>
To: Paul Farber <farber@admin.f-tech.net>
Subject: Re: perl password example
Message-Id: <36C3A5B6.2044C10A@frontiernet.net>
Paul, the salt value is chosen randomly. There are two printable characters
in the salt, for 4096 possible salt values. The purpose of the salt is to
prevent crackers from recognizing that passwords on multiple machines are the
same. You can just choose two arbitrary printable characters for your salt.
The salt is included in plaintext in the encrypted password, so anyone can
tell what is the salt is at a glance. When comparing a password to an
encrypted copy of a password, you have to use the same salt value as was used
when the first encryption was done. That is why the salt is included in
plaintext as part of the encryption string. Hope this helps.
Example:
$enc_pw=crypt('password','sa'); #salt is 'sa'
print "$enc_pw\n";
when run:
H:\Bob\junk>perl crypt.pl
sa3tHJ3/KuYvI
H:\Bob\junk>
Note that the "sa" the encrypted password starts with is the salt.
Paul Farber wrote:
> Can anyone provide me with a code example to encrypt a password in perl?
> I have the basics of the crypt function, but I need to get the salt values
> to encrypt the password. How do I get a good salt value?
>
> Any code snippets helpfull!
>
> Paul D. Farber II
> Farber Technology
> 717-628-5303
> farber@admin.f-tech.net
------------------------------
Date: Thu, 11 Feb 1999 21:17:58 -0800
From: Bill Garrett <bgarrett@hamilton.net>
Subject: Perl tutorials??
Message-Id: <36C3B984.3FCB4BF3@hamilton.net>
I am looking for a good free perl tutorial.
Anyone know wherer I can get one form?
Jason@wbdet.com
------------------------------
Date: Fri, 12 Feb 1999 02:03:39 GMT
From: padhu@yahoo.com
Subject: using perl to talk to oracle database
Message-Id: <7a025l$1hg$1@nnrp1.dejanews.com>
Hi,
I am new to perl. I have a cgi script that gets information from a form. The
form has a textarea called "Comments".The cgi script has to insert this text
from Comments into the oracle database. Due to some reason i get an oracle
error saying that the string is not properly quoted. Also the text that is
stored into the database is all jumbled up.
All other values except for this Comments are stored properly into the
database.
The following is the code. What am i doing wrong?
Any help would be greatly appreciated.
Thanks,
Prabha.
#
#
#
# set the oracle environment
#
#
$ENV{'ORACLE_SID'}="TEK1";
$ENV{'ORACLE_HOME'}="/home/oracle/product/8.0.5";
$ENV{'PATH'}="";
$ORACLE_SID="TEK1";
$ORACLE_HOME="/home/oracle/product/8.0.5";
$shellscript = "/home/wwwuser/$$.sh";
$LOGFILE = "/home/wwwuser/$$.log";
#
#
#
# insert the values into the database
#
#
#
$comments = $query{'Comments'};
$comments =~ s/\$/usd /g;
$comments =~ s/\#/ number/g;
$comments =~ s/\@/ at/g;
$comments =~ s/'/\'||chr(39)||\'/g;
$openerror = open(SHELLFILE, "> $shellscript");
print SHELLFILE <<SHELL_SCRIPT;
ORACLE_SID=$ORACLE_SID
ORACLE_HOME=$ORACLE_HOME
$ORACLE_HOME/bin/sqlplus -s jflow/jflow\@tek1.world > $LOGFILE << END
set heading off
insert into customerinfo(customerid,last_name,first_name,type,phoneno,faxno,
email,billing_address,billing_city,billing_state,billing_zipcode,
billing_country,comments,academic, companyname)
values($customerId, \'$LastName\', \'$FirstName\',
\'$query{'Type'}\', \'$query{'Phone'}\', \'$query{'Fax'}\',
\'$Email\', \'$Address\',
\'$City\',
\'$query{'State'}\',
\'$query{'Zip'}\', \'$Country\',
\'$comments\',
\'$query{'academic'}\', \'$CompanyName\');
COMMIT;
exit
END
SHELL_SCRIPT
close(SHELLFILE);
$chmodCmd = "/bin/chmod +rx $shellscript";
$mainCmd = "$shellscript";
$sys1 = system($chmodCmd);
$sys3 = system("$mainCmd");
if($sys1 != 0)
{
die("Could not assign permissions to run the oracle script\n");
}
if($sys3 != 0) { die("Could not run the SQL script. Cannot insert data into
database\n"); }
#
#
# delete the lof file and .sh file
#
#
$res = system("/bin/rm -f $LOGFILE");
$res = system("/bin/rm -f $shellscript");
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4875
**************************************