[21916] in Perl-Users-Digest
Perl-Users Digest, Issue: 4120 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 14 18:06:40 2002
Date: Thu, 14 Nov 2002 15:05:17 -0800 (PST)
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, 14 Nov 2002 Volume: 10 Number: 4120
Today's topics:
Re: -F works on command line but not on #!perl -paF lin <john@imrie37.fsnet.co.uk>
Re: [Q] Getting started with perl programming? <spam@all.costs.must.die>
Copy *.o to a different directory <doyleed@sprynet.com>
Re: Cross platform issues <tim@deadgoodsolutions.spam-me-and-die.com>
Re: Cross platform issues <usenet@dwall.fastmail.fm>
Discovering whether qr/// needs to recompile an RE (Adrian)
Re: Discovering whether qr/// needs to recompile an RE <rgarciasuarez@free.fr>
Re: format string being interpretted as perl code? <john@imrie37.fsnet.co.uk>
Re: hash names from scalar values <john@imrie37.fsnet.co.uk>
Re: hash names from scalar values <nobull@mail.com>
Help Using Crypt() - Clarification: $Salt <paanwa@hotmail.com>
Re: Help Using Crypt() <john@imrie37.fsnet.co.uk>
Re: Help with https and lwp <eweintra@jhmi.edu>
Re: Help with https and lwp <mbudash@sonic.net>
Re: how do I turn off unicode on file I/O? <rgarciasuarez@free.fr>
Re: How much memory a perl process consume <rgarciasuarez@free.fr>
How to get rid of <p> and <br> displayed in textarea af (kjc)
Re: In a Perl script executing a c-shell script to exec (nub5)
Re: menu ? <spam@all.costs.must.die>
Multiple calls to pl script <g0khaasa@cdf.toronto.edu>
Re: Multiple calls to pl script <perl-dvd@ldschat.com>
newbie to perl: printing literals(constants). <andrew_plata@rogers.com>
Re: newbie to perl: printing literals(constants). <sebbean@charter.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 14 Nov 2002 19:15:33 +0000
From: John Imrie <john@imrie37.fsnet.co.uk>
Subject: Re: -F works on command line but not on #!perl -paF line
Message-Id: <3DD3F655.9060206@imrie37.fsnet.co.uk>
Amir Karger wrote:
> Pardon if this is a FAQ, but searching for "-F" or "split" on google
> groups doesn't help much, and I could swear I'm following the docs. I
> can't seem to figure out how to use -F on the #! line, even though it
> works fine on the command line.
perldoc perlrun
will give you a list of all the run time switches you can use with perl
------------------------------
Date: Thu, 14 Nov 2002 23:05:13 +1100
From: "Tintin" <spam@all.costs.must.die>
Subject: Re: [Q] Getting started with perl programming?
Message-Id: <3dd391b1_1@news.iprimus.com.au>
"Sir Loin of Beef" <NOSPAMmdknight@pacific.net.sg> wrote in message
news:3dd24088.10934131@news.pacific.net.sg...
> Bernard
> >Don't you think that depends on what you want to do? After all,
> >modules are designed with specific tasks in mind. Having said that,
> >since you're just starting out you probably won't need any modules
> >other than the standard ones which came with your distro of Perl.
>
> Well, I was thinking, do I need a web server or anything like that?
What made you think that web servers and Perl were related?
------------------------------
Date: Thu, 14 Nov 2002 16:56:08 -0500
From: "Ed Doyle" <doyleed@sprynet.com>
Subject: Copy *.o to a different directory
Message-Id: <ar19ab$6dv$1@slb5.atl.mindspring.net>
Hi
Is there an easy way inside a perl script to copy all .o files from one
directory to another?
I tried something like:
use File::Copy;
copy("$DIR1\*\.o" , "$DIR2\*\.o"); which compiled an ran but didn't copy any
files. $DIR1 and DIR2 are valid pathnames defined earlier in the script.
Any suggestions would be appreciated.
Ed Doyle
------------------------------
Date: Thu, 14 Nov 2002 21:50:47 -0000
From: "tim" <tim@deadgoodsolutions.spam-me-and-die.com>
Subject: Re: Cross platform issues
Message-Id: <1037310624.96747.0@iris.uk.clara.net>
ok, thanks - i've included a small example script that works fine on
w2k/Activeperl but again no good on RH.
#!/usr/bin/perl
use CGI qw(:standard);
$hidden=param('SCREEN');
$input=param('T1');
print header;
print "Hidden tag: $hidden<p>Text input: $input";
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head><body>
<form action="http://www.mysite.com/cgi-bin/tim.cgi" method="POST">
<input type="hidden" value="you can't see me" name="SCREEN">
<input type="text" name="T1" size="20"><input type="submit" value="Submit"
name="B1"></p>
</form></body></html>
many thanks,
------------------------------
Date: Thu, 14 Nov 2002 22:55:09 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: Cross platform issues
Message-Id: <Xns92C6B648FDDF1dkwwashere@216.168.3.30>
tim <tim@deadgoodsolutions.spam-me-and-die.com> wrote on 14 Nov 2002:
> i've included a small example script that works fine on
> w2k/Activeperl but again no good on RH.
>
> #!/usr/bin/perl
> use CGI qw(:standard);
> $hidden=param('SCREEN');
> $input=param('T1');
> print header;
> print "Hidden tag: $hidden<p>Text input: $input";
There's nothing particularly wrong with the Perl code (except that you're not
using the safety harness of 'use strict;' and 'use warnings;').
Maybe you forgot to make it executable, or transferred it from win2k to linux
as binary instead of ascii, or perl isn't in /usr/bin.... (etc, etc).
Anyway, it's not a Perl problem.
--
David K. Wall - usenet@dwall.fastmail.fm
"Oook."
------------------------------
Date: 14 Nov 2002 14:02:42 -0800
From: apronk@csi.co.nz (Adrian)
Subject: Discovering whether qr/// needs to recompile an RE
Message-Id: <6b50cc42.0211141402.260f79c8@posting.google.com>
In the following Perl-5 program fragment (see bottom), I pass an RE
string to a function which compiles it with qr///. If I pass the same
RE multiple times, then qr/// does not recompile it.
The problem is that the RE contains a code fragment which references a
lexically scoped variable which becomes bound into a closure.
If qr/// compiles the string, then the instance of the variable is the
one in the current call. If qr/// returnes a cached copy, the
instance of the variable is one from a previous call.
Can I find out whether qr/// has recompiled or not?
Alternatively, can I:
- force it to recompile so I know that I'm getting the current
variable, or
- use a different technique to ensure that the 'execute' function can
access the variable that was modified by the RE (but still using
precompilation).
--------------------------------------
use strict;
use warnings;
use re qw(eval debug);
our $counter;
our @result;
# our $squirrel;
$counter = 0;
$\ = "\n";
my $regex = '(?{$squirrel .= ", " . ++$counter})';
my $squirrel = "main";
push @result, ["main", \$squirrel];
my $compile = 0;
my $execute = 0;
foreach (1..5)
{
my $foo = $regex;
&execute(&compile($foo));
}
foreach (@result)
{
print "$_->[0]: ${$_->[1]}";
}
sub compile
{
print "In compile";
my $context = "compile [" . ++$compile .']';
my $squirrel = $context;
# local $squirrel = $context;
push @result, ["compile $compile", \$squirrel];
qr/$_[0]/;
}
sub execute
{
print "In execute";
my $qr = $_[0];
my $context = "execute [" . ++$execute. ']';
my $squirrel = $context;
local $squirrel = $context;
'' =~ $qr;
push @result, ["execute $execute", \$squirrel];
}
--------------------------------------
--
Thanks, Adrian
------------------------------
Date: 14 Nov 2002 22:31:52 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: Discovering whether qr/// needs to recompile an RE
Message-Id: <slrnat8950.16b.rgarciasuarez@rafael.example.com>
Adrian wrote in comp.lang.perl.misc :
> In the following Perl-5 program fragment (see bottom), I pass an RE
> string to a function which compiles it with qr///. If I pass the same
> RE multiple times, then qr/// does not recompile it.
That would be called a feature of qr// : it avoids to recompile things.
> The problem is that the RE contains a code fragment which references a
> lexically scoped variable which becomes bound into a closure.
Ah, yes.
> If qr/// compiles the string, then the instance of the variable is the
> one in the current call. If qr/// returnes a cached copy, the
> instance of the variable is one from a previous call.
I don't really understand your problem, since there is no closure or
lexical-in-qr in your code example.
Basically qr// is an operator that returns a precompiled regexp. It's
evaluated each time it's run, just like the familiar qq//. But its
return value never changes, even if the value of the variable inside the
qr// changes (just like qq//). Does it make the thing clearer to you ?
------------------------------
Date: Thu, 14 Nov 2002 19:30:36 +0000
From: John Imrie <john@imrie37.fsnet.co.uk>
Subject: Re: format string being interpretted as perl code?
Message-Id: <3DD3F9DC.5030202@imrie37.fsnet.co.uk>
Nestor Dutko wrote:
> I have a perl module that is trying to construct html. I know I can
> use the CGI perl module, but this code is easier to maintain as all I
> need to do is use a html editor and format the code then dump the
> section into the perl module.
>
> What I get is:
>
> syntax error at t.pl line 35, near "){"
> Execution of t.pl aborted due to compilation errors.
>
> The perl itself is (I have made certain there are no '@' or '^'
> characters. It is interesting that perl seems to be interpretting the
> code. Is there something that triggered this or an ability to turn it
> off?
>
> Thanks!
> Nestor
>
> #! perl
> use strict vars;
>
> format HTML =
> );
>
> overdiv="0";
> // ######### CREATES POP UP BOXES
> function popLayer(a){
> if(!descarray[a]){descarray[a]="<font color=red>This popup (#"+a+")
<cut>
Your format is not formatted correctly
Each bit of the format is in fact 2 lines of code. The first is the
patern to fill and the second is the names of the variables to fill it.
Hence your format is looking at ); as the patern for the first line
followed by a line of empy vars followed by a patern of overdiv="0"
followed by // ########## CREATES POP UP BOXES which it trys to
interpilate as a list of variable names etc.
see perldoc -f format for more details
------------------------------
Date: Thu, 14 Nov 2002 19:10:43 +0000
From: John Imrie <john@imrie37.fsnet.co.uk>
Subject: Re: hash names from scalar values
Message-Id: <3DD3F533.2030303@imrie37.fsnet.co.uk>
matt wrote:
> Hi All,
>
> A little question about naming hashes from scalar values. I've heard that
> this is not a good idea, but I don't know how many hashes I will need until
> a loop finishes. Is there anything wrong with this? Here's my code:
>
> -----------------------------------
> $n=1;
> @ary=();
> while (@data = get_row_from_DB) {
>
> $hash_name = "temp" . $n;
>
> %{$hash_name} = (
> this => $data[0],
> that => $data[1]
> );
>
> push (@ary, \%{$hash_name});
> $n++;
> }
> ------------------------------------
>
> Basically as you can see I need to end up with an array full of hash ref's.
> Is there a better way to accomplish this?
>
@ary=();
while (@data = get_row_from_DB) {
push (@array,{this => $data[0], that => $data[1]});
}
This gets rid of the temp var and creates the hash ref on the fly.
John Imrie
------------------------------
Date: 14 Nov 2002 19:58:09 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: hash names from scalar values
Message-Id: <u97kffylda.fsf@wcl-l.bham.ac.uk>
"matt" <linuxnb@yahoo.com> writes:
> A little question about naming hashes from scalar values.
Stop. Do not do it.
> I've heard that this is not a good idea, but I don't know how many
> hashes I will need until a loop finishes. Is there anything wrong
> with this?
Yes it indicates you've not bothered to follow up any of the places
where you've seen the advice not to use symref to see what they
recomment instead.
There is a very important fact that you need learn: variables do not
need to be named.
> Here's my code:
You forgot:
use strict;
use warnings;
You didn't declare all your variables in the smallest enclosing
lexical scopes.
Like ropes when climbing a mountain these will slow you down a bit at
first. But the first time your loose your footing you'll make back
all the lost time and more.
Worse still you are comming into the climbers club house and asking
experienced climbers for help with your climbing technique when you've
flagrantly ignored the most basic saftey advice. The fact that you
are not yet sporting any broken limbs will not alter the fact that
they will not be kindly disposed towards you.
> -----------------------------------
> $n=1;
> @ary=();
> while (@data = get_row_from_DB) {
>
> $hash_name = "temp" . $n;
>
> %{$hash_name} = (
> this => $data[0],
> that => $data[1]
> );
>
> push (@ary, \%{$hash_name});
> $n++;
> }
> ------------------------------------
>
> Basically as you can see I need to end up with an array full of hash
> ref's. Is there a better way to accomplish this?
The real question is, is there a worse way!?
The simplest change you could do above would be simply to get rid of
the symbolisc reference - if you just changed "temp".$n to undef then
your program would continue to work (thanks to the magic of
autovivification). At least it would work for a while. Sooner or
latter your failure to follow basic safety protocols will burn you.
my @ary;
while (my @data = get_row_from_DB) {
my $hash_ref;
%$hash_ref = (
this => $data[0],
that => $data[1]
);
push (@ary, $hash_ref);
}
my $n = @ary;
More simply:
my @ary;
while (my @data = get_row_from_DB) {
my %hash = (
this => $data[0],
that => $data[1]
);
push (@ary, \%hash);
}
# forget about $n just use scalar(@ary)
Even more simply:
my @ary;
while (my @data = get_row_from_DB) {
push @ary, {
this => $data[0],
that => $data[1]
};
}
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 14 Nov 2002 14:55:04 -0500
From: "Paanwa" <paanwa@hotmail.com>
Subject: Help Using Crypt() - Clarification: $Salt
Message-Id: <ut7vspi8h2cr8b@corp.supernews.com>
My oversight, John,
The $Salt variable is defined earlier in the script and is the same salt
used to pre-crypt the saved passwords. Sorry for not making that clear. I
checked the output value of the $StoredPassword and $SubmittedPassword
variables and they come out identical - however, my if statement is not
picking up on that for some reason...
PAW
------------------------------
Date: Thu, 14 Nov 2002 19:22:26 +0000
From: John Imrie <john@imrie37.fsnet.co.uk>
Subject: Re: Help Using Crypt()
Message-Id: <3DD3F7F2.3000203@imrie37.fsnet.co.uk>
>
> ----------------------------------------------
> <snip>
> my $StoredPassword;
> $StoredPassword = $Auth{param('Username')}{Pword}; # Grab the pword for the
> correct username
> my $SubmittedPassword;
> $SubmittedPassword = crypt(param('Password'),$Salt); # crypt() the pword
> from the login form
>
> if ($StoredPassword ne $SubmittedPassword)
> {
> print "Permission Denied",p,
>
> param('Username'),"<pre>",$SubmittedPassword,"\n",$StoredPassword,"</pre>",p
> $Auth{param('Username')}{Fname}," ",$Auth{param('Username')}{Lname};
> }
> else
> {
> print "Permission Granted";
> }
> </snip>
> ----------------------------------------------
>
I think the problem is with generating the Submitted Password.
Where is $Salt comming from.
It needs to be the salt used when you created the origanal password
list. This is the first 2 characters of the encrypted password. However
the crypt function will take more caracters than that so you can write
$SubmittedPassword = crypt(param('Password'),$StoredPassword); # crypt()
the pword
John imrie
------------------------------
Date: Thu, 14 Nov 2002 15:37:07 -0500
From: ETAN WEINTRAUB <eweintra@jhmi.edu>
Subject: Re: Help with https and lwp
Message-Id: <Pine.GSO.4.44.0211141536070.14602-100000@pine>
I figured it out! Despite the fact that it says you can use EITHER
Net_SSLeay or Crypt_SSLeay, it appears that you need Crypt_SSLeay for it
to work properly. Once I tossed that module into the mix, everything
worked swimmingly.
Thanks for the help!
-Etan
On Wed, 13 Nov 2002, ETAN WEINTRAUB wrote:
> Just some added info:
> Running on Solaris 8
> Perl 5.8.0
> OpenSSL 0.9.6g
> Convert-ASN1 0.15
> MIME-Base64 2.12
> URI 1.21
> Digest-MD5 2.20
> Digest-SHA1 2.01
> libnet 1.12
> Bundle-libnet 1.00
> HTML-Parser 3.26
> libwww-perl 5.65
> Net_SSLeay.pm 1.20
> IO-SocketSSL 0.81 (Can't go higher! IO-SocketSSL versions higher that
> .81 don't work properly with LDAPS)
> Authen-SASL 2.02
> perl-ldap 0.26
> String-Random 0.198
> Devel-Symdump 2.03
> Crypt-TripleDES 0.24
>
> Anyhelp would be MUCH appreciated...
>
> On Wed, 13 Nov 2002, ETAN WEINTRAUB wrote:
>
> > Nope, https:// does work at the site. Checked that before I even thought
> > of posting here....
> >
> > On Wed, 13 Nov 2002, Bob Walton wrote:
> >
> > > ETAN WEINTRAUB wrote:
> > >
> > > ...
> > > > It works if I use http:// instead of https://, however I need it to work
> > > > with https://. When I switch it to https://, I get the following message:
> > > >
> > > > ----------------------------------------------------------------
> > > > File: local.cshrc
> > > > 500 (Internal Server Error) Can't connect to localhost:443 ()
> > > > Client-Date: Tue, 12 Nov 2002 20:32:21 GMT
> > > >
> > > > ----------------------------------------------------------------
> > > >
> > > > Any ideas???
> > >
> > >
> > > Does the https://... work at the site using your favorite web browser?
> > > If not, then it is a web server problem, not a Perl problem. Looks to
> > > me like that is probably the case.
> > >
> > >
> > > ...
> > > > -Etan Weintraub
> > >
> > > ...
> > > --
> > > Bob Walton
> > >
> > >
> >
> >
>
>
>
>
------------------------------
Date: Thu, 14 Nov 2002 22:39:44 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Help with https and lwp
Message-Id: <mbudash-9F6602.14394314112002@typhoon.sonic.net>
In article <Pine.GSO.4.44.0211141536070.14602-100000@pine>,
ETAN WEINTRAUB <eweintra@jhmi.edu> wrote:
> I figured it out! Despite the fact that it says you can use EITHER
> Net_SSLeay or Crypt_SSLeay, it appears that you need Crypt_SSLeay for it
> to work properly. Once I tossed that module into the mix, everything
> worked swimmingly.
>
> Thanks for the help!
> -Etan
you've misunderstood the README.SSL... the pertinent part reads:
----------------------------------------------------------------
Encryption support is obtained through the use of Crypt::SSLeay or
IO::Socket::SSL, which can both be found from CPAN. While libwww-perl
has "plug-and-play" support for both of these modules (as of v5.45),
the recommended module to use is Crypt::SSLeay. In addition to
bringing SSL support to the LWP package, IO::Socket::SSL can be used
as an object oriented interface to SSL encrypted network sockets.
There is yet another SSL interface for perl called Net::SSLeay. It has
a more complete SSL interface and can be used for web client
programming among other things but doesn't directly support LWP.
----------------------------------------------------------------
so, in order for lwp to support https, you can use either Crypt::SSLeay
(recommended by lwp's author) or IO::Socket::SSL. or you can skip lwp
altogether and use Net::SSLeay.
hth-
------------------------------
Date: 14 Nov 2002 22:18:25 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: how do I turn off unicode on file I/O?
Message-Id: <slrnat883d.14q.rgarciasuarez@rafael.example.com>
Jamie Zawinski wrote in comp.lang.perl.misc :
> Can someone please explain to me how to break the legs off
> of Perl 5.8.0's Unicode support?
>
> I have files that have Latin1 characters in them. I want
> Perl to *not convert them at all*. My program wants to treat
> these files as simple bytes, with no interpretation.
>
> If I set $LANG to C, then everything works as expected, but
> I would like my program to work in the default locale that
> Red Hat 8 ships, which is "en_US.UTF-8". I'd rather not
> have to tell users "set $LANG before running this program."
>
> I've tried all kinds of variants of "use bytes" and other
> things mentioned in the various man pages with no luck.
> I've also tried calling "setlocale" and setting $ENV{LANG}
> within the program, with no effect.
Setting environment from perl will be of no help, as perl turns its
internal want-utf8-on-filehandles switch on at startup time.
> % cat b.pl
> #!/usr/bin/perl -w
>
> require 5;
> use diagnostics;
> use strict;
> use bytes;
I don't see the utility of the bytes pragma here.
Does its removal help ?
> sub foo {
> local *IN;
> open (IN, "<a") || die;
> while (<IN>) {
Does sticking a binmode(IN) here help ?
Does removing the local help ? (shot in the dark)
> print "<< $_";
> }
> close IN;
> }
>
> foo();
>
> 1;
>
> The "a.pl" program just includes "b.pl" and runs it.
>
> % cat a.pl
> #!/usr/bin/perl -w
>
> require 5;
> use diagnostics;
> use strict;
> use bytes;
>
> require 'b.pl';
> foo();
>
> Running "b.pl" directly does what I expect:
>
> % ./b.pl
> << foöbar
>
> Running "a.pl" does something baffling:
>
> % ./a.pl
> << foöbar
> << foöbar
OK, this really looks like a bug in perl, and in this case you should
use perlbug(1). Somebody out there will probably able to reproduce your
problem (I can't, no RedHat 8 here.)
FWIW the problem was discussed two weeks ago on the perl5-porters ML
and I feel RedHat 8 gives a good shake at Perl 5.8 Unicode abilities.
http://use.perl.org/article.pl?sid=02/11/04/2129222&mode=nested&tid=12
------------------------------
Date: 14 Nov 2002 22:18:25 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: How much memory a perl process consume
Message-Id: <slrnat88bg.14q.rgarciasuarez@rafael.example.com>
TD wrote in comp.lang.perl.misc :
> Hello all,
>
> When Perl can tell its PROCESS ID ( $$ ), why it is difficult to tell
> how much memory this PROCESS ID is consuming??
>
> I have some memory leak in my programs. After reading
> http://www.perldoc.com/perl5.6/pod/perldebguts.html, for me it does
> not seem easy because I have too many perl classes.
>
> is there any Module in Perl or any system function in Perl or OS level
> function -- that can tell me how much memory it has consumed ( say
> getmemoryusage($$) or similar )
>
> I am running Perl 5.6 Build 631 on a windows 2000 server.
This is a highly system dependent issue. Hence I think you should check
CPAN for Win32:: modules, e.g. Win32::Process::Info.
------------------------------
Date: 14 Nov 2002 13:04:34 -0800
From: kevin@kjcrowley.com (kjc)
Subject: How to get rid of <p> and <br> displayed in textarea after being submitted in a form
Message-Id: <1fa921fe.0211141304.5e50977f@posting.google.com>
I have a form that uses a textarea for input and when the user has
completed the form the script displays a new page showing them their
responses. The textarea on this displayed page shows the <br> and <p>
used on the page. I do have a code that searches and replaces the
<br> and <p> from the variable, and when displayed using "print" it
works fine. The only time it looks wrong is when displayed in a text
area. Here is an example of what I am talking about:
http://kjcrowley.com/drforum/example.html
Thanks.
------------------------------
Date: 14 Nov 2002 11:44:27 -0800
From: rmiller_nub@yahoo.com (nub5)
Subject: Re: In a Perl script executing a c-shell script to execute a fortran program, how to?
Message-Id: <23e193ca.0211141144.5cae9e65@posting.google.com>
gorilla@elaine.furryape.com (Alan Barclay) wrote in message news:<1037240673.756473@elaine.furryape.com>...
> In article <3dd2fb76$1_2@news.iglou.com>, Vorxion <vorxion@fairlite.com> wrote:
> >In article <aquqq9$msr$1@canopus.cc.umanitoba.ca>, Walter Roberson wrote:
> >#!/bin/csh -f
> >
> >...The -f prevents it from reading any user's .cshrc and thus possibly
> >driving something whacky. It (-f) should generally always be used in
> >both csh and tcsh scripts.
>
> But even with -f, csh scripts can do wacky things. See 'csh programming
> considered harmful' by some guy called Tom Christiansen.
Thanks, that was the exact problem. The actual start_fortran script
did not have any thing in it. Once I inserted the #!/bin/csh -f
everythig is running perfect. Thanks for the info.
------------------------------
Date: Thu, 14 Nov 2002 23:11:00 +1100
From: "Tintin" <spam@all.costs.must.die>
Subject: Re: menu ?
Message-Id: <3dd3930f_1@news.iprimus.com.au>
"Linux.ie" <mail@eircom.net> wrote in message
news:aqu0k5$dsd$1@dorito.esatclear.ie...
> Thanks all.
For what?
You've just managed to reply to nothing at all.
------------------------------
Date: Thu, 14 Nov 2002 21:20:48 GMT
From: Asad <g0khaasa@cdf.toronto.edu>
Subject: Multiple calls to pl script
Message-Id: <Pine.LNX.4.30.0211141620320.23921-100000@b375-15.cdf>
I am calling this line in my fetchPosters.pl
print "Content-type: text/html\n\n";
It was included in the sample code and seemed to work fine and all before.
Now, that I am calling fetchPosters.pl from another perl script using:
exec 'fetchPosters.pl';
everything works fine (the page is displayed properly) except that I get
the following text on top of my page (page generated by fetchPosters.pl)
Content-type: text/html
The reason is that the server has already got a header from the first CGI
script and is faithfully printing out the second "content-type" to STDOUT.
Is there a way I can stop this from happening. That is have it ignore the
second "content-type" to STDOUT?
------------------------------
Date: Thu, 14 Nov 2002 15:21:55 -0700
From: "David" <perl-dvd@ldschat.com>
Subject: Re: Multiple calls to pl script
Message-Id: <9fVA9.30912$46.24809@fe01>
"Asad" <g0khaasa@cdf.toronto.edu> wrote in message
news:Pine.LNX.4.30.0211141620320.23921-100000@b375-15.cdf...
> I am calling this line in my fetchPosters.pl
>
> print "Content-type: text/html\n\n";
>
> It was included in the sample code and seemed to work fine and all
before.
>
> Now, that I am calling fetchPosters.pl from another perl script
using:
>
> exec 'fetchPosters.pl';
>
> everything works fine (the page is displayed properly) except that I
get
> the following text on top of my page (page generated by
fetchPosters.pl)
>
> Content-type: text/html
>
> The reason is that the server has already got a header from the
first CGI
> script and is faithfully printing out the second "content-type" to
STDOUT.
>
> Is there a way I can stop this from happening. That is have it
ignore the
> second "content-type" to STDOUT?
Sure, Try something like this:
if (!$ENV{'CONTENT-TYPE_PRINTED'}){
print "Content-Type: text/html\n\n";
$ENV{'CONTENT-TYPE_PRINTED'} = 1;
}
You would have to put this in all of the places you print a content
type, but then you would never print the content type twice.
Regards,
David
------------------------------
Date: Thu, 14 Nov 2002 21:38:35 GMT
From: Andrew Plata <andrew_plata@rogers.com>
Subject: newbie to perl: printing literals(constants).
Message-Id: <3DD41804.9070600@rogers.com>
Hello my name is Andrew,
I am a newbie to programming in perl and I was wondering if anyone can
help me understand the author's script.
Have a look a the following script:
#! /usr/bin/perl
# Program to illustrate printing literals
print "The price is $100.\n";
print "The price is \$100.\n";
print "The price is \$",100, ".\n";
The first two uncommented lines make sense to me. However the last line
does not. Why is there a double quote after the $? and Why was the
period placed infront of \n.
I understand that the the \n needs double quotes to be interpreted.
This is the authors explanation:
To be treated as a numeric literal, rather than a string, the number 100
is a single word (I understand that). The dollar sign must be escaped
even if it is not followed by a variable name (I don't understand that).
The \n must be enclosed within double quotes if it is to be interpreted
as a special string literal (I understand that but why is the period
placed infront of \n).
To figure it out I ran the script the following two ways.
1.
[aplata@CPE013279903217 aplata]$ perl -e 'print "The price is \$, 100, .
"\n";'
I get the following error message:
Backslash found where operator expected at -e line 1, near ""The price
is \$, 100, . "\"
(Missing operator before \?)
String found where operator expected at -e line 1, at end of line
(Missing semicolon on previous line?)
syntax error at -e line 1, near ""The price is \$, 100, . "\"
Can't find string terminator '"' anywhere before EOF at -e line 1.
2.
$ perl -e 'print "The price is \$", 100, . "\n";'
[aplata@CPE013279903217 aplata]$ perl -e 'print "The price is \$", 100,
. "\n";'
The price is $100[aplata@CPE013279903217 aplata]$
It appears to me that if the dollar sign does not have a double quotes
after it an error message will be thrown. Also, if the period is not
inclosed in double quotes with /n the STDOUT is not place on a separate
line.
Can anyone expand on this?
Sincerely,
Andrew Plata
------------------------------
Date: Thu, 14 Nov 2002 16:52:50 -0600
From: seb bean <sebbean@charter.net>
Subject: Re: newbie to perl: printing literals(constants).
Message-Id: <3DD42942.3040507@charter.net>
Andrew Plata wrote:
> Hello my name is Andrew,
>
> I am a newbie to programming in perl and I was wondering if anyone can
> help me understand the author's script.
>
> Have a look a the following script:
>
> #! /usr/bin/perl
> # Program to illustrate printing literals
> print "The price is $100.\n";
> print "The price is \$100.\n";
> print "The price is \$",100, ".\n";
>
> The first two uncommented lines make sense to me. However the last line
> does not. Why is there a double quote after the $? and Why was the
> period placed infront of \n.
>
> I understand that the the \n needs double quotes to be interpreted.
>
> This is the authors explanation:
>
> To be treated as a numeric literal, rather than a string, the number 100
> is a single word (I understand that). The dollar sign must be escaped
> even if it is not followed by a variable name (I don't understand that).
> The \n must be enclosed within double quotes if it is to be interpreted
> as a special string literal (I understand that but why is the period
> placed infront of \n).
>
>
> To figure it out I ran the script the following two ways.
>
> 1.
>
> [aplata@CPE013279903217 aplata]$ perl -e 'print "The price is \$, 100, .
> "\n";'
>
> I get the following error message:
>
> Backslash found where operator expected at -e line 1, near ""The price
> is \$, 100, . "\"
> (Missing operator before \?)
> String found where operator expected at -e line 1, at end of line
> (Missing semicolon on previous line?)
> syntax error at -e line 1, near ""The price is \$, 100, . "\"
> Can't find string terminator '"' anywhere before EOF at -e line 1.
>
>
>
> 2.
>
>
> $ perl -e 'print "The price is \$", 100, . "\n";'
>
> [aplata@CPE013279903217 aplata]$ perl -e 'print "The price is \$", 100,
> . "\n";'
> The price is $100[aplata@CPE013279903217 aplata]$
>
>
> It appears to me that if the dollar sign does not have a double quotes
> after it an error message will be thrown. Also, if the period is not
> inclosed in double quotes with /n the STDOUT is not place on a separate
> line.
>
> Can anyone expand on this?
>
> Sincerely,
>
> Andrew Plata
>
>
>
>
>
>
>
>
>
>
>
>
>
>
ok, the backslash before the dollar sign tells perl that it's not a
scalar value
(you know the variables that start with dollar signs, maybe you havnt
got that far)
the period is just a period...it marks the end of the sentance...it has
no signifigance in perl(that i know of) it's just simple english.
(notice the . after english, get it?)
and the the reason it wasnt put on a new line is because you didnt put a
comma after the period
so: perl -e 'print "The price is \$", 100, ., "\n";' will work
notice commas: ^ ^ ^
anyway, you shuld probably keep the period inside the quotes so you dont
think it's some operator or something
anything you dont understand?
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 4120
***************************************