[16610] in Perl-Users-Digest
Perl-Users Digest, Issue: 4022 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 15 11:05:30 2000
Date: Tue, 15 Aug 2000 08:05:15 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <966351914-v9-i4022@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 15 Aug 2000 Volume: 9 Number: 4022
Today's topics:
Re: ARRAY of HASH values (Colin Keith)
Re: ARRAY of HASH values <mjcarman@home.com>
Re: Array Printing <uri@sysarch.com>
Re: Can't call a script from html created by another sc (Colin Keith)
Re: Convert URLs to links (Decklin Foster)
Re: Convert URLs to links (Abigail)
Re: Convert URLs to links (Keith Calvert Ivey)
Re: date and time in perl (Keith Calvert Ivey)
Re: date and time in perl (Teodor Zlatanov)
Re: date manipulation (Keith Calvert Ivey)
Re: Get ip from visitor <tony_curtis32@yahoo.com>
Re: Multiline regexp search and replace? (Decklin Foster)
Re: Negativity in Newsgroup...Newbie Perspective...this <care227@attglobal.net>
Re: Negativity in Newsgroup...Newbie Perspective (Merijn Broeren)
Re: Negativity in Newsgroup <mjcarman@home.com>
newbie with perl-CGI problem in browser <franky.claeys@vt4.net>
Re: newbie with perl-CGI problem in browser (Logan Shaw)
Re: newbie with perl-CGI problem in browser <laf@gameonline.co.uk>
Re: Passwords (Greg Bacon)
Re: Passwords <alex.buell@tahallah.clara.co.uk>
Re: Passwords (Decklin Foster)
Re: Passwords (Martien Verbruggen)
Re: Passwords (Greg Bacon)
Re: Passwords <alex.buell@tahallah.clara.co.uk>
Re: Passwords (Logan Shaw)
Re: Passwords (Martien Verbruggen)
Re: Passwords <mjcarman@home.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 15 Aug 2000 13:34:25 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: ARRAY of HASH values
Message-Id: <BFbm5.128$DT4.3732444@nnrp2.clara.net>
In article <3998EE75.387B@yahoo.com>, Mouse <glodalec@yahoo.com> wrote:
>I know, similar problem was posted already.
...
>I have a subroutine which returns array of hashes.
You either mean you're returning an array of hashrefs - scalars containing a
reference to a hash - or you've missed/forgotten/didn't know about, the fact
that Perl flattens arrays that it passes. To clarify (for those readers who
don't know this stuff and are fed up with posts saying 'wrong' and never
saying 'why')
maia% perl -w -Mstrict
sub return_a_hash { my(%hash1) = (a=>1, b=>2, c=>3);
my(%hash2) = (d=>1, e=>1, f=>3);
return (%hash1, %hash2);
}
my(@array) = return_a_hash();
print 'Array length: ', scalar(@array), "\n";
my(%hash) = return_a_hash();
print "Key $_, Val: $hash{$_}\n" for(keys(%hash));
Array length: 12
Key a, Val: 1
Key b, Val: 2
Key c, Val: 3
Key d, Val: 1
Key e, Val: 1
Key f, Val: 3
But, assuming that's not causing your problem ...
> @ARRAY=();
> while (@row = $sth->fetchrow_array( ))
> {
> %rec=();
> $rec{ sysname } = $row[0];
> $rec{ sysdesc } = $row[1];
> push(@ARRAY,%rec);
> }
> return @ARRAY ;
>}
>
>Now I would like to read something like $ARRAY[3]{sysname}.
Oh, okay .. so this is your problem.
Print out @ARRAY. You're not getting @ARRAY = (hash1), (hash2), (hash3) ..
are you? If you want to nest data structures like that, you have use
references. Par example:
# Your code:
sub return_a_hash { return (a=>1, b=>2, c=>3); }
my(@ARRAY) = ();
my(%rec) = return_a_hash();
for(0..10){
push(@ARRAY, %rec);
}
print join(', ', @ARRAY, "\n");
# So $ARRAY[3] will always be a scalar value
Now because pushing your hash (%rec) onto your array (@ARRAY) converts the
values into an array, you need to pass a reference to it:
for(0..10){
push(@ARRAY, \%rec);
}
And the output you get is something like:
HASH(0x805a108), HASH(0x805a108), ...
Each array element contains a reference (pointer if you will) to the hash
structure, so you can then continue with your code:
print "Value of a: ", ${$ARRAY[3]}{a}, "\n";
Apart from the \ to make it push a reference rather than the values, your
code is right :) Oh, and in the last bit you can reduce memory overheads by
not using $HASH and %rec.
foreach (@ARRAY){
print $_->{sysname}, ' ', $->{sysdesc}, "\n";
}
The -> notation allows you to get the value of an element from a hash
reference just simply to stop people having to write confusing code like
$myhash = (a HASH ref);
%{$myhash} # the hash, same as %rec
${$myhash}{key} # the value of 'key', same as $rec{key}
$myhash->{key} # the same as above
*phew* I'm waffling, I know.. but someone might find it helpful :)
Col.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Tue, 15 Aug 2000 08:28:45 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: ARRAY of HASH values
Message-Id: <3999458D.5C026421@home.com>
Mouse wrote:
>
> I have a subroutine which returns array of hashes.
No you don't. :)
> sub SYSGROUP_select
> {
> my $sth = $dbh->prepare(qq(SELECT * FROM sysgroup)) ;
> $sth->execute ;
>
> @ARRAY=();
> while (@row = $sth->fetchrow_array( ))
You declared $sth with my(), why not do the same for @row?
> {
> %rec=();
You *need* to do 'my %rec' here instead. Explanation to follow.
> $rec{ sysname } = $row[0];
> $rec{ sysdesc } = $row[1];
> push(@ARRAY,%rec);
This flattens your hash, pushing both values *and keys* onto @ARRAY.
What you want to do is push on a reference to %rec.
push(@ARRAY, \%rec);
Why? Arrays (and hashes) can only contain scalar values, not other
arrays or hashes. References are scalars. Now, back to needing to
localize %rec with my(): Since you're pushing a reference onto your
array, you need it to be a different reference each time. (Otherwise you
would just have many pointers to the same thing.) Using my() forces %rec
to be a new variable each time through the loop.
> }
> return @ARRAY ;
> }
>
> Now I would like to read something like $ARRAY[3]{sysname}.
>
> my @ARRAY=SYSGROUP_select();
> foreach $HASH (@ARRAY)
> {
> my %rec=%$HASH;
At least here you're expecting a hashref. You just don't have one.
> print $rec{ sysname }," ",$rec{ sysdesc },"\n"; <--- Doesnt work
Are you running with strict and -w? What did the diagnostic say?
Something about "not a HASH reference" maybe? This part is okay (though
I'd write it differently). Fix the problem in your subroutine and I
think you'll be okay.
-mjc
------------------------------
Date: Tue, 15 Aug 2000 13:13:14 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Array Printing
Message-Id: <x7em3qy8et.fsf@home.sysarch.com>
>>>>> "LS" == Logan Shaw <logan@cs.utexas.edu> writes:
LS> Second, though, I have to point out that, according to tests I
LS> just did, a system call actually will be made for each line of
LS> output, at least if the output is a terminal. (This is with perl
LS> 5.6.0 on Solaris 8.) This turns out to be the case whether you
LS> pass a list to print or whether you call print once for each item
LS> in the list.
it doesn't have anything to do with the OS. it is because STDOUT is set
to line buffering by default if it is a tty. if it is a pipe, you lose
that and you can have problems sometimes. that is why you have to turn
on $| to force flushing after each print to see the output in those
cases.
try these 2 lines:
perl -e 'print "foo" ; sleep 3'
perl -e '$|++ ;print "foo" ; sleep 3 '
and read suffering from buffering:
http://www.plover.com/~mjd/perl/FAQs/Buffering.html
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: Tue, 15 Aug 2000 14:17:07 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: Can't call a script from html created by another script
Message-Id: <Dhcm5.129$DT4.3735062@nnrp2.clara.net>
In article <8n98ig$13$1@news5.svr.pol.co.uk>, "Rob" <rsouthgate@hotmail.com>
wrote:
>Apache for NT, but the people hosting the site are using IIS and when
>uploaded there the first script still works great but when you click the
>button to get to the second - nothing, just a connecting to <server address>
>in the status bar. Eventually I get an error that the server is down, but it
>isn't obviously. The weird thing I can call the script from a form if there
>is nothing being passed to it, but as soon as I put a hidden field in it
>hangs again, or even just a name to the button.
Okay, well it probably isn't a Perl problem, buuuut here are some Perly
bits to try to see if it is your script or a problem with the server
executing it. First thing to do is change the target that your submission
goes to and replace it with a really simple script like:
#!/usr/bin/perl -w
print "Content-Type: text/plain\n\n Got here\n";
You get a response, huh?
Okay, so swap it back and then start checking your script. Do you use full
headers? If not, try it see if its something dumb with the server waiting
for something before it sends the response from the script back. If you need
to, try setting
$| = 1;
to turn off buffering on the STDOUT (or whatever STDOUT is selected at the
time - for the picky:), any response?
Your script does run properly doesn't it? Use -w and 'use strict' in your
script to ensure nothing daft is going on. Make sure your script isn't dying
by redirecting STDERR to a log file:
close(STDERR);
open(STDERR, ">>logfile") || die "Content-Type: text/plain\n\n Ick - $!";
No errors?
Okay, start 'here'ing your script:
print "Content-Type: text/plain\n\n",
"Here: ", join(', ', __PACKAGE__, __FILE__, __LINE__, "\n"); exit(0);
Put it in, run the script, if you get a response, move it down to the next
section you think you have a problem with and of course you can duplicate
this idea to print something to a log file.
Of course you can duplicate this to log to a file on the server that you got
to 'here' in case its a problem returning data.
The only other thing that I could suggest is the way in which IIS executes
perl. I *believe* this is done with a registry association on the server,
(so you might have to set local($^W) = 1; instead of using -w to turn on
warnings if it doesn't read the switches on the first line of the file)
Some help maybe?
Col.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Tue, 15 Aug 2000 13:38:52 GMT
From: decklin+usenet@red-bean.com (Decklin Foster)
Subject: Re: Convert URLs to links
Message-Id: <MJbm5.9$CW2.362@news1.rdc1.ct.home.com>
Keith Calvert Ivey <kcivey@cpcug.org> writes:
> Well, I'd want to include the fragment identifier (the "#time")
> in the value of HREF, so that following the link would put me at
> the right place on the page. But since the fragment identifier
> isn't really part of the URL, it's not recognized by Abigail's
> regex, so the link stops before the #.
Eh?
; perl -wlp regex
http://www.w3.org/Addressing/#time
<a href ="http://www.w3.org/Addressing/#time">http://www.w3.org/Addres
sing/#time</a>
;
regex contains what Abigail posted, except it starts with 's<(http'
instead of '$string =~ s<(?:http'. (The first change being so that I
can call it as I did, the second being so that the substitution
works.)
At any rate, fragment identifiers are part of a URL. er, URI
reference. But not a URI.
--
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)
------------------------------
Date: 15 Aug 2000 14:46:22 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Convert URLs to links
Message-Id: <slrn8pilsr.tj3.abigail@alexandra.foad.org>
Decklin Foster (decklin+usenet@red-bean.com) wrote on MMDXLI September
MCMXCIII in <URL:news:MJbm5.9$CW2.362@news1.rdc1.ct.home.com>:
"" Keith Calvert Ivey <kcivey@cpcug.org> writes:
""
"" > Well, I'd want to include the fragment identifier (the "#time")
"" > in the value of HREF, so that following the link would put me at
"" > the right place on the page. But since the fragment identifier
"" > isn't really part of the URL, it's not recognized by Abigail's
"" > regex, so the link stops before the #.
""
"" Eh?
""
"" ; perl -wlp regex
"" http://www.w3.org/Addressing/#time
"" <a href ="http://www.w3.org/Addressing/#time">http://www.w3.org/Addres
"" sing/#time</a>
"" ;
Unfortunally, that means there is a bug, as "#fragment" is *not* part
of a URL.
Abigail
--
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
print+Just (), another (), Perl (), Hacker ();'
------------------------------
Date: Tue, 15 Aug 2000 14:05:21 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Convert URLs to links
Message-Id: <39a54d68.35414872@news.newsguy.com>
decklin+usenet@red-bean.com (Decklin Foster) wrote:
>; perl -wlp regex
>http://www.w3.org/Addressing/#time
><a href ="http://www.w3.org/Addressing/#time">http://www.w3.org/Addres
>sing/#time</a>
>;
>
>regex contains what Abigail posted, except it starts with 's<(http'
>instead of '$string =~ s<(?:http'. (The first change being so that I
>can call it as I did, the second being so that the substitution
>works.)
Odd. I get
<a href =
"http://www.w3.org/Addressing/">http://www.w3.org/Addressing/</a>#time
I deleted the ?: as you did, and deleted all the newlines in the
regex because it wouldn't compile otherwise. I'm using 5.005_03
(ActiveState build 522) on Win95.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Tue, 15 Aug 2000 13:03:34 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: date and time in perl
Message-Id: <39a13f41.31791201@news.newsguy.com>
"W Kemp" <bill.kemp@wire2.com> wrote:
>Marr, Lincoln [HOOF:4713:EXCH] wrote in message
><399907D3.E304A03B@europem01.nt.com>...
>>Try this, I used it and it works beautifully:
>>=============================================
>
><loads of stuff that could be replaced with >
>
>$date = localtime();
... if you don't care about the format of the date and time.
(Of course, Lincoln's code could be shortened.)
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: 15 Aug 2000 10:16:55 -0500
From: tzz@iglou.com (Teodor Zlatanov)
Subject: Re: date and time in perl
Message-Id: <399950d7_2@news.iglou.com>
<399907D3.E304A03B@europem01.nt.com>:Marr, Lincoln [HOOF:4713:EXCH] (lincolnmarr@europem01.nt.com):comp.lang.perl.misc:Tue, 15 Aug 2000 11:05:23 +0200:quote:
: sub get_date {
: local ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst,$date);
: local (@days, @months);
: @days =
: ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
: @months =
: ('January','February','March','April','May','June','July','August','September','October','November','December');
: ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
: if ($hour < 10) { $hour = "0$hour"; }
: if ($min < 10) { $min = "0$min"; }
: if ($sec < 10) { $sec = "0$sec"; }
: $mon++;
: $year += 1900;
: $date = "$mon/$mday/$year at $hour\:$min\:$sec";
: return $date;
: }
: $time = &get_date;
This can (and should be) replaced with strftime. The POSIX module's perldoc
(perldoc POSIX) will help. Not everyone uses "MM/DD/YY at HH:MM:SS" as the
format, you know. While the original poster would be best served by "scalar
localtime," as others have advised, this was sufficiently wrong that it had
to be corrected :)
--
Teodor Zlatanov <tzz@iglou.com>
"Brevis oratio penetrat colos, longa potatio evacuat ciphos." -Rabelais
------------------------------
Date: Tue, 15 Aug 2000 13:59:52 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: date manipulation
Message-Id: <39a44b70.34910657@news.newsguy.com>
Ilmari Karonen <iltzu@sci.invalid> wrote:
>There seems to be a typo above. Surely you meant:
>
> int(time() / 86400) * 86400 + 86400/2
>
>And as far as I can tell the time returned is not _local_ noon, but
>12:00 GMT, which sort of defeats the point of the exercise..
Well, it does solve the problem for the vast majority of the
world, at the cost of making it worse for people in two sparsely
inhabited time zones, where the problem now exists for 24 hours
each year rather than two 1-hour periods. It does seem a bit
unfair to the inhabitants of Midway Island, Vanuatu, and far
eastern Russia, though. I guess we can assume that all those
.nu domains aren't actually running on Niue time.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: 15 Aug 2000 09:31:34 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Get ip from visitor
Message-Id: <87hf8moat5.fsf@limey.hpcc.uh.edu>
>> On Tue, 15 Aug 2000 06:26:24 GMT,
>> rune@clamon.dk said:
> Hi, I want to get the ip-adress from the visitor on my
> homepage that executes my perl cgi-script. How is this
> possible?
Yes or no, depending on what you mean by the address of
the visitor.
use CGI ':standard';
my $addr = remote_addr();
but this may be the address of a proxy server, or the
direct address of the accessing software. However, this
may change over time (e.g. DHCP lease renewal) and you
cannot guarantee that the address you get refers to one
particular "visitor".
Caveat programmer.
hth
t
--
"With $10,000, we'd be millionaires!"
Homer Simpson
------------------------------
Date: Tue, 15 Aug 2000 13:46:04 GMT
From: decklin+usenet@red-bean.com (Decklin Foster)
Subject: Re: Multiline regexp search and replace?
Message-Id: <wQbm5.10$CW2.362@news1.rdc1.ct.home.com>
henrik7205@hotmail.com <henrik7205@hotmail.com> writes:
> I tried s/\n/<br>/gs but it didn't work.
perldoc perlre
search for 'end of the line'.
--
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)
------------------------------
Date: Tue, 15 Aug 2000 09:36:22 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Negativity in Newsgroup...Newbie Perspective...this sort of sums it up
Message-Id: <39994756.4BA1ADAC@attglobal.net>
Lou Moran wrote:
>
> ---Whichever side you're on these posts will sum things up...
>
> Original Poster posts vague, possibly rude post
>
> Post Respondent answers with a possibly negative tone
>
> Hundreds of posts ensue, no one gets any smarter, some come away
> dumber for the experience... Trolls win.
>
> >>>
> >>> I've been trying to find a couple of free/low-cost script that do these
> >>> things...
>
> >>You seem to have wandered into the wrong group...
>
I feel picked on.
------------------------------
Date: 15 Aug 2000 13:46:32 GMT
From: merijnb@iloquent.nl (Merijn Broeren)
Subject: Re: Negativity in Newsgroup...Newbie Perspective
Message-Id: <399949b8$0$1666@heracles>
In article <39985293.EBDA55E9@home.com>,
Michael Carman <mjcarman@home.com> wrote:
>
>perldoc -f <function> -- search for help on <function>
>perldoc -q <foo> -- search the FAQ for help on <foo>
>
What do you think of -tf and -tq? I like them much better.
Cheers,
--
Merijn Broeren | Bob's guide to high explosives for dummies:
Software Geek | Chapter One: When the pin is pulled and safety lever
| discarded, Mr. Grenade is no longer your friend.
------------------------------
Date: Tue, 15 Aug 2000 09:04:17 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Negativity in Newsgroup
Message-Id: <39994DE1.706A72FC@home.com>
John Porter wrote:
>
> I have always lived by the creed "There's no such thing as a
> stupid question". Apparently, I'm in the minority...at least
> in this group.
And there isn't, even here, *provided* that you've at least tried to
help yourself by checking the FAQ and docs, and that your question is
topical here. (Would you ask a lawyer for medical advice?)
-mjc
------------------------------
Date: Tue, 15 Aug 2000 16:12:58 +0200
From: Franky Claeys <franky.claeys@vt4.net>
Subject: newbie with perl-CGI problem in browser
Message-Id: <MPG.14036e59df93d14e989682@news.hogent.be>
[This followup was posted to comp.lang.perl.misc and a copy was sent to the cited author.]
Hi
I'm a newbie to the perl-world and the linux-world.
I have to use perl in a unix-environment for a school-project.
I'm having trouble installing a simple CGI-script (look below) on my
computer.
#!/usr/bin/perl -wT
use strict;
use diagnostics;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
# Create an instance of CGI
my $query = new CGI;
# Send an appropriate MIME header
print $query->header(-type =>
"text/html");
# Send some content
print $query->start_html(-title =>
"This is a test.");
print "<H1>Testing!</H1>\n";
print "<P>This is a test.</P>\n";
print $query->end_html;
This is what I have done:
Step 1: I have put the pl-file in my CGI-bin
Step 2: I've made a link in my index.html and I've put this file in the
appropriate dir.
Step 3: when I click on the link in the HTML-file in the browser, the
only that happens is that Netscape askes to save this file instead of
returning HTML to my browser.
What's the cause of this problem and how do I solve this?
Please keep in mind that I'm a newbie J
Thanks in advance!
Greetings from Belgium
Franky
http://franksite.ipfox.com
------------------------------
Date: 15 Aug 2000 09:20:32 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: newbie with perl-CGI problem in browser
Message-Id: <8nbjjg$6mi$1@provolone.cs.utexas.edu>
In article <MPG.14036e59df93d14e989682@news.hogent.be>,
Franky Claeys <franky.claeys@vt4.net> wrote:
>[This followup was posted to comp.lang.perl.misc and a copy was sent to the cited author.]
>Step 3: when I click on the link in the HTML-file in the browser, the
>only that happens is that Netscape askes to save this file instead of
>returning HTML to my browser.
Either you need to change some web server configuration variables
or you need to run "chmod +x" on the script to make it executable.
"man chmod" for more information.
- Logan
------------------------------
Date: Tue, 15 Aug 2000 15:21:53 +0100
From: "Neil Lathwood" <laf@gameonline.co.uk>
Subject: Re: newbie with perl-CGI problem in browser
Message-Id: <966349378.9012.0.nnrp-12.c246f129@news.demon.co.uk>
"Franky Claeys" <franky.claeys@vt4.net> wrote in message
news:MPG.14036e59df93d14e989682@news.hogent.be...
> [This followup was posted to comp.lang.perl.misc and a copy was sent
to the cited author.]
>
> Hi
>
> I'm a newbie to the perl-world and the linux-world.
>
> I have to use perl in a unix-environment for a school-project.
>
> I'm having trouble installing a simple CGI-script (look below) on my
> computer.
>
> #!/usr/bin/perl -wT
> use strict;
> use diagnostics;
> use CGI;
> use CGI::Carp qw(fatalsToBrowser);
> # Create an instance of CGI
> my $query = new CGI;
> # Send an appropriate MIME header
> print $query->header(-type =>
> "text/html");
> # Send some content
> print $query->start_html(-title =>
> "This is a test.");
> print "<H1>Testing!</H1>\n";
> print "<P>This is a test.</P>\n";
> print $query->end_html;
>
> This is what I have done:
>
> Step 1: I have put the pl-file in my CGI-bin
>
> Step 2: I've made a link in my index.html and I've put this file in
the
> appropriate dir.
>
> Step 3: when I click on the link in the HTML-file in the browser, the
> only that happens is that Netscape askes to save this file instead of
> returning HTML to my browser.
>
> What's the cause of this problem and how do I solve this?
>
As far as i am aware, this is down to your web servers configuration.
You could try naming you file with a .cgi extension instead or get your
Administrator to set up support for the file type .pl
Keep in mind i am a newbie as well ;-)
Neil
> Please keep in mind that I'm a newbie J
>
> Thanks in advance!
>
> Greetings from Belgium
>
> Franky
>
> http://franksite.ipfox.com
------------------------------
Date: Tue, 15 Aug 2000 13:24:51 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Passwords
Message-Id: <spih53qokn922@corp.supernews.com>
In article <6o7ipsol0ggc22lmmnergknhhgihd8q4tm@4ax.com>,
Alex Buell <alex.buell@tahallah.clara.co.uk> wrote:
: Other than using system("stty -echo") and system("stty echo"), are
: there any other ways of concealing passowrds being entered?
Section 8 of the FAQ answers your question.
Greg
--
/*
** the usual core dumping code
*/
-- Juergen Heinzl
------------------------------
Date: Tue, 15 Aug 2000 14:39:15 +0100
From: Alex Buell <alex.buell@tahallah.clara.co.uk>
Subject: Re: Passwords
Message-Id: <6vhipsg44rfp5nodm3kcm03l4vnh0ns0ll@4ax.com>
On Tue, 15 Aug 2000 13:24:51 GMT, gbacon@HiWAAY.net (Greg Bacon)
wrote:
>Section 8 of the FAQ answers your question.
It hasn't appeared on the news server yet (I only downloaded the last
500 posts).
Cheers,
Alex.
--
Bring on the music and lights!
http://www.tahallah.clara.co.uk
------------------------------
Date: Tue, 15 Aug 2000 13:57:57 GMT
From: decklin+usenet@red-bean.com (Decklin Foster)
Subject: Re: Passwords
Message-Id: <F%bm5.13$CW2.362@news1.rdc1.ct.home.com>
Alex Buell <alex.buell@tahallah.clara.co.uk> writes:
> Other than using system("stty -echo") and system("stty echo"), are
> there any other ways of concealing passowrds being entered?
Duct tape.
Seriously, what's the point? If I can look over your shoulder you
already have a security risk.
I wonder what this has to do with Perl...
--
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)
------------------------------
Date: 15 Aug 2000 14:00:42 GMT
From: mgjv@martien.heliotrope.home (Martien Verbruggen)
Subject: Re: Passwords
Message-Id: <slrn8piiuc.4dk.mgjv@martien.heliotrope.home>
On Tue, 15 Aug 2000 14:39:15 +0100,
Alex Buell <alex.buell@tahallah.clara.co.uk> wrote:
> On Tue, 15 Aug 2000 13:24:51 GMT, gbacon@HiWAAY.net (Greg Bacon)
> wrote:
>
> >Section 8 of the FAQ answers your question.
>
> It hasn't appeared on the news server yet (I only downloaded the last
> 500 posts).
You have perl installed already, right? Perl comes with a very complete
set of documentation, including the FAQs, all nine sections.
From your prompt:
# perldoc perlfaq8
# perldoc perl
# perldoc perldoc
If you're on windowsi and are using ActiveState's perl, there's a menu
entry somewhere under your programs thingy that contains a link to a
html version of all the perl documentation.
A lot handier than waiting for them to show up on Usenet :)
HTH
Martien
--
Martien Verbruggen |
Interactive Media Division | That's not a lie, it's a
Commercial Dynamics Pty. Ltd. | terminological inexactitude.
NSW, Australia |
------------------------------
Date: Tue, 15 Aug 2000 14:01:09 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Passwords
Message-Id: <spij95fakn9134@corp.supernews.com>
In article <6vhipsg44rfp5nodm3kcm03l4vnh0ns0ll@4ax.com>,
Alex Buell <alex.buell@tahallah.clara.co.uk> wrote:
: On Tue, 15 Aug 2000 13:24:51 GMT, gbacon@HiWAAY.net (Greg Bacon)
: wrote:
:
: >Section 8 of the FAQ answers your question.
:
: It hasn't appeared on the news server yet (I only downloaded the last
: 500 posts).
If you have Perl, you have the FAQ on your local machine. No need to
wait for slow, unreliable Usenet. :-)
Greg
--
If you believe in yourself and have dedication and pride and never quit,
you'll be a winner. The price of victory is high but so are the rewards.
-- Paul "Bear" Bryant
------------------------------
Date: Tue, 15 Aug 2000 15:04:33 +0100
From: Alex Buell <alex.buell@tahallah.clara.co.uk>
Subject: Re: Passwords
Message-Id: <jejipsg61rrdv1iapsl56ckjk6uomgosa1@4ax.com>
rOn 15 Aug 2000 14:00:42 GMT, mgjv@martien.heliotrope.home (Martien
Verbruggen) wrote:
># perldoc perlfaq8
Doh! I didn't realise there were more than one Perl FAQ.
Thanks.
Cheers,
Alex.
--
Bring on the music and lights!
http://www.tahallah.clara.co.uk
------------------------------
Date: 15 Aug 2000 09:12:53 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Passwords
Message-Id: <8nbj55$6ku$1@provolone.cs.utexas.edu>
In article <F%bm5.13$CW2.362@news1.rdc1.ct.home.com>,
Decklin Foster <decklin+usenet@red-bean.com> wrote:
>Alex Buell <alex.buell@tahallah.clara.co.uk> writes:
>
>> Other than using system("stty -echo") and system("stty echo"), are
>> there any other ways of concealing passowrds being entered?
>
>Seriously, what's the point? If I can look over your shoulder you
>already have a security risk.
Well, for one thing, what if someone is logging every
character printed on the screen during a session? If
the password is echoed back, it will go in the log,
which is a bad thing, especially on a multiuser system.
>I wonder what this has to do with Perl...
They were asking whether there's a way to change
tty modes directly from perl without calling an
external program. That seems perl related to me.
- Logan
------------------------------
Date: 15 Aug 2000 14:19:03 GMT
From: mgjv@martien.heliotrope.home (Martien Verbruggen)
Subject: Re: Passwords
Message-Id: <slrn8piju7.4dk.mgjv@martien.heliotrope.home>
On Tue, 15 Aug 2000 13:57:57 GMT,
Decklin Foster <decklin+usenet@red-bean.com> wrote:
> Alex Buell <alex.buell@tahallah.clara.co.uk> writes:
>
> > Other than using system("stty -echo") and system("stty echo"), are
> > there any other ways of concealing passowrds being entered?
>
> Duct tape.
>
> Seriously, what's the point? If I can look over your shoulder you
> already have a security risk.
Yes. That's why I propose that you write patches to all available
versions of the passwd program to put the terminal echo back in there.
And login managers should do the same. rlogin? ftp? They should just
echo.
We'll just tell all those people who need to type a password that they
have to get everyone out of the room make sure all their cables and
connections are secure, lock the door, blind the windows. It's a lot
easier than to figure out a way of disabling echo for a terminal.
Alternatively, we prohibit looking over shoulders, or simply
preemptively remove everybody's eyes.
Sounds reasonable.
> I wonder what this has to do with Perl...
It has anough to do with perl for it to have ended up as a FAQ in
section 8 of the Perl FAQ, under the heading 'How do I ask the user for
a password?'. The answer there provides a few clues on how to do that in
Perl that are specific to Perl alone.
Martien
--
Martien Verbruggen |
Interactive Media Division | The world is complex; sendmail.cf
Commercial Dynamics Pty. Ltd. | reflects this.
NSW, Australia |
------------------------------
Date: Tue, 15 Aug 2000 09:07:28 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Passwords
Message-Id: <39994EA0.D85652C0@home.com>
Alex Buell wrote:
>
> Greg Bacon wrote:
>
> >Section 8 of the FAQ answers your question.
>
> It hasn't appeared on the news server yet (I only downloaded the last
> 500 posts).
Heh, it's already on your computer. Type 'perldoc perlfaq' at a command
prompt and watch what happens.
A few other commands to get you started with perldoc:
perldoc perldoc
perldoc perl
perldoc pertoc
-mjc
------------------------------
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 4022
**************************************