[16430] in Perl-Users-Digest
Perl-Users Digest, Issue: 3842 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 29 09:05:24 2000
Date: Sat, 29 Jul 2000 06:05:11 -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: <964875911-v9-i3842@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 29 Jul 2000 Volume: 9 Number: 3842
Today's topics:
Re: Apology to perl newsgroup (Marcel Grunauer)
Re: Better way to do this pattern match? <mauldin@netstorm.net>
Re: Comparing a number to a string aqutiv@softhome.net
Re: Converting strings to numbers for comparison <gellyfish@gellyfish.com>
Re: day_of_week() and age() without using Date::Calc ? madsere@my-deja.com
Re: ecologically printed perldocs <flavell@mail.cern.ch>
Re: Error with dbd using Oracle <gellyfish@gellyfish.com>
Re: Expanding lists of ranges of integers 1-3,5-8,9,13- (Eric Kuritzky)
Re: Help with SQL query in Perl script <gellyfish@gellyfish.com>
Re: hide or encrypted Per source? <gellyfish@gellyfish.com>
I Am An Idiot <collin@crosslink.net>
Re: I Am An Idiot (Jon Bell)
Re: I Am An Idiot <tkosmider@mgfairfax.rr.com>
Re: Is "exit()" really necessary? <gellyfish@gellyfish.com>
Re: perl -lpi.bak -e "s/old/new/g" *.* broken on NT? (Martin Vorlaender)
Re: Perl jobs? <ben@baddis.plus.com>
Re: perl on Windows NT web server (Martin Vorlaender)
Re: Perl Rocks!(OT?) (Martin Vorlaender)
search.cgi >How do I? <rock.ice@bigfoot.Xcom>
Re: search.cgi >How do I? (Marcel Grunauer)
Re: search.cgi >How do I? (remove)
Re: Should truncate length be 0? <gellyfish@gellyfish.com>
Re: Suggestion for syntax change <elephant@squirrelgroup.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 29 Jul 2000 07:33:04 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: Apology to perl newsgroup
Message-Id: <slrn8o52fm.tv.marcel@gandalf.local>
On Sat, 29 Jul 2000 04:14:46 GMT, Keith Calvert Ivey <kcivey@cpcug.org> wrote:
>Well, if he became involved in interesting discussions and made
>useful contributions, he might be quoted in enough other
>people's messages that people would remove him from their
>killfiles to see what they're missing. Also, some people clear
>out their killfiles periodically or killfile only temporarily.
Oh, but the next killfile amnesty isn't due until January 2001.
--
Marcel
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();
------------------------------
Date: Sat, 29 Jul 2000 11:47:55 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: Better way to do this pattern match?
Message-Id: <3982C395.602888BD@netstorm.net>
Neil Kandalgaonkar wrote:
>
> Here's another way of doing what you did, which also gives a ranking to the
> match. Depending on how many words you expect per query, it *might* be less
> efficient (test it first!), since it doesn't group the nots and musts and
> coulds all together.
<snip>
> sub alta {
> my ($query, $data) = @_;
> my $score;
>
> foreach my $token (split ' ', $query) {
>
> my ($mod, $word) = ( $token =~ /^([+-]?)(\S+)/ );
> my @match = ($data =~ /(\Q$word\E)/gi);
> if ($mod eq '-') {
> return 0 if @match;
> } elsif ($mod eq '+') {
> return 0 unless @match;
> } else {
> # if very paranoid, test if $mod was neither + nor -.
> }
> $score += @match;
> }
> return $score;
> }
Elegant, readable, and almost certainly more efficient.
-- Jim
------------------------------
Date: Sat, 29 Jul 2000 08:04:47 GMT
From: aqutiv@softhome.net
Subject: Re: Comparing a number to a string
Message-Id: <8lu36v$v6r$1@nnrp1.deja.com>
In article <8ltr97$pe2$1@nnrp1.deja.com>,
paul5544@my-deja.com wrote:
> I recently discovered this forum and have soaked
> up quite a bit from all of the fantastic brains
> here. I was hoping someone could provide some
> help to a programmer new to the PERL language.
>
> I am trying to compare two values together.
> But they need to be converted to numbers.
> Here is my current statement
> if ($line =~ "<price>")
> {
> if ($line =~ /$target/i)
> {
> $found_flag = 1;
> }
> }
> This works fine if $line and $target are equal.
> However, I want the statement to be something like
> if ($line =~ "<price>")
> {
> if ($line <= $target)
> {
> $found_flag = 1;
> }
> }
> This way $found_flag=1 if the $target value is
> equal to or less then (but greater then zero) the
> $line value.
>
> Can anyone help me to convert these values to
> numbers for comparison?
> Very much appreciate any help and thanks to all
> those that contribute to the forum.
>
Well, It depends.. If the line includes something like this:
<price>nn</price>
you'd do something like:
if ($line =~ m[<price>(.+?)</price>]i)
{
$price = $1;
if ($price <= $target)
{
$found_flag = 1;
}
}
read: perldoc perlre
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 29 Jul 2000 13:51:03 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Converting strings to numbers for comparison
Message-Id: <8lujvn$m73$1@orpheus.gellyfish.com>
On Sat, 29 Jul 2000 05:53:22 GMT paul5544@my-deja.com wrote:
> I recently discovered this forum and have soaked up quite a bit from all
> of the fantastic brains here.
I think you must be thinking of some other newsgroup ... ;-}
> I was hoping someone could provide some
> help to a programmer new to the PERL language.
>
> I am trying to compare two values together.
> But they need to be converted to numbers.
> Here is my current statement
> if ($line =~ "<price>")
> {
> if ($line =~ /$target/i)
> {
> $found_flag = 1;
> }
> }
> This works fine if $line and $target are equal. However, I want the
> statement to be something like
> if ($line =~ "<price>")
If '<price>' is a literal then this should be $line =~ /<price>/ ...
otherwise you should explain what it is more clearly.
> {
> if ($line <= $target)
> {
> $found_flag = 1;
> }
> }
> This way $found_flag=1 if the $target value is equal to or less then
> (but greater then zero) the $line value.
>
> Can anyone help me to convert these values to numbers for comparison?
> Very much appreciate any help and thanks to all those that contribute to
If something looks like a number then it can be treated as a number.
I'm not quite sure what you are trying to achieve here - could you show
us a bit of the data.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Sat, 29 Jul 2000 11:55:34 GMT
From: madsere@my-deja.com
Subject: Re: day_of_week() and age() without using Date::Calc ?
Message-Id: <8lugnm$78s$1@nnrp1.deja.com>
In article <8lj1d0$pmp$1@nnrp1.deja.com>,
madsere@my-deja.com wrote:
> I am frantically looking for two functions:
>
> 1) One that can return the day-of-week for a given date
> 2) one that can return the age for a given date (birthday)
>
> Yeah I know - Date::Calc can do it.
>
> Unfortunately my web hosting service doesn't have it installed and is
> not very quick in installing new modules - to say the least.
Hmm, nobody knows? really?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 29 Jul 2000 11:45:00 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: ecologically printed perldocs
Message-Id: <Pine.GHP.4.21.0007291143211.3514-100000@hpplus03.cern.ch>
On Sat, 29 Jul 2000, Brendon Caligari wrote:
> ZCZC
Good heavens! I haven't seen that used since half a lifetime.
all the best
------------------------------
Date: 29 Jul 2000 13:44:41 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Error with dbd using Oracle
Message-Id: <8lujjp$kvn$1@orpheus.gellyfish.com>
On Sat, 29 Jul 2000 06:32:51 GMT gary_n@my-deja.com wrote:
> I've recently installed DBD 1.05 for Oracle and DBI 1.13. I'm running
> Oracle 8.05 and Apache 1.3.12.
>
> I was able to get both DBD and DBI to make and test successfully and am
> able to run DBD at the command line and select from the database ok. I
> get the following error in the Apache error log when I try and run the
> same perl file as a cgi script.
>
> -------
> install_driver(Oracle) failed: Can't load
> '/usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/Oracle/Oracle.so'
> for module DBD::Oracle: libclntsh.so.1.0: cannot open shared object
> file:
> No such file or directory at
> /usr/lib/perl5/5.00503/i386-linux/DynaLoader.pm line 169
> -------
>
> Now I can run other perl cgi files ok and this one works up unitl the
> database select. I am setting LD_LIBRARY_PATH and ORACLE_SID ok as I've
> outputted the environment to the web page. The libclntsh.so.1.0 file is
> in $ORACLE_HOME/lib and has correct permissions.
>
It probably *is* LD_LIBRARY_PATH , or whatever is appropriate for your
system, are you sure that it is set in your CGI environment. You might
want to print your %ENV from your program to determine that it is set
correctly.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 29 Jul 2000 09:04:07 GMT
From: kuritzky@math.berkeley.edu (Eric Kuritzky)
Subject: Re: Expanding lists of ranges of integers 1-3,5-8,9,13-14
Message-Id: <8lu6m7$53t$1@agate.berkeley.edu>
In article <slrn8o0uiq.vcg.abigail@alexandra.foad.org>,
Abigail <abigail@foad.org> wrote:
[Lot's of stuff omitted to save bandwidth]
>Or to save on strokes:
>
> $_="1-3,5-8,10,13-14";
> @list=map{split/-/;$_[0]..$_[-1]}split/,/;
>
Alas, this scribbles over @_ in the calling routine (not just the map block):
#!/usr/bin/perl -w
foo("1-3,5-8,10,13-14");
sub foo{
local $_=shift;
@list=map{split/-/;$_[0]..$_[-1]}split/,/;
print join ':',@list,"\n";
print join '!',@_,"\n";
}
prints out the following 2 lines:
1:2:3:5:6:7:8:10:13:14:
13!14!
It also generates an annoying warning about a deprecated feature.
--Eric Kuritzky
perl -pe \ 'echo JAPH|'
------------------------------
Date: 29 Jul 2000 14:29:08 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help with SQL query in Perl script
Message-Id: <8lum74$lk$1@orpheus.gellyfish.com>
On Fri, 28 Jul 2000 15:09:07 GMT Michael Segulja wrote:
> I checked my apache error log. The following is the error I get when I
> run the cgi script from my web browser. If I run it from the command
> line, I get nothing.
>
> Use of uninitialized value at /home/httpd/cgi-bin/dbase.cgi line 40.
> install_driver(mysql) failed: Can't
> load '/usr/lib/perl5/site_perl/5.005/i386-li
> nux/auto/DBD/mysql/mysql.so' for module
> DBD::mysql: /usr/lib/perl5/site_perl/5.0
> 05/i386-linux/auto/DBD/mysql/mysql.so: undefined symbol: uncompress
> at /usr/lib/
> perl5/5.00503/i386-linux/DynaLoader.pm line 169.
>
> I checked my install of DBD::mysql, and I'm getting some errors when I
> run make test. Here's what I get there.
<snip>
Your MySQL is not properly installed - I would imagine that you have some
older libraries knocking around. I would suggest that you download the
most recent version of MySQL and install it before making DBD::MySQL.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 29 Jul 2000 14:57:04 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: hide or encrypted Per source?
Message-Id: <8lunrg$64n$1@orpheus.gellyfish.com>
On Sat, 29 Jul 2000 13:42:55 +0800 DT wrote:
> In article <8lsg7l$q13$1@brokaw.wa.com>, lauren_smith13@hotmail.com
> says...
>>
>> <nospam.tomtt@hotmail.com> wrote in message
>> news:MPG.13ec364036dd9176989680@news.newsguy.com...
>> > Someone please help me the follow code? What is the all about, Million
>> > Thanks
>>
>> It's about how clever the programmer could be. I'd fire him.
>>
>>
> Can anyone help? I paid for the source code and yet he give me this.
>
You shouldnt have paid for it if you commissioned the source code.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Sat, 29 Jul 2000 06:56:30 -0400
From: "Collin Borrlewyn" <collin@crosslink.net>
Subject: I Am An Idiot
Message-Id: <964868333.926550@pizza.crosslink.net>
Okay, this is stupid. I know it, and soon you will too. I'm trying to
perform what I believe should be a fairly easy and fairly routine action. I
am trying to use a perl script to interact with information in a text file
on a server. I think this should be a common enough thing that doing it is
possible. I mean, it'd be useful, right? So, unless one can't do this (and
I'd like to know why not) can someone tell me how to get the contents of a
file into an interact-able form, such as a variable? Something to do with
open()? read()? The documentation isn't prescise, and nothing I have tried
has worked.
Disclaimer: Don't kill me. I've been messing with perl all of three days.
I've read a few tutorials and poked about in the documentation. Maybe this
is something they cover on page one of every perl book and day one of every
perl course out there, but I don't know it.
-Collin E Borrlewyn
-Too sexy for his shirt.
-collin@crosslink.net
------------------------------
Date: Sat, 29 Jul 2000 11:41:06 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: I Am An Idiot
Message-Id: <FyGJ4I.2oE@presby.edu>
In article <964868333.926550@pizza.crosslink.net>,
Collin Borrlewyn <collin@crosslink.net> wrote:
> [...] can someone tell me how to get the contents of a
>file into an interact-able form, such as a variable? Something to do with
>open()? read()? The documentation isn't prescise, and nothing I have tried
>has worked.
The documentation that comes with Perl is rather precise; it's simply
meant as a reference, not as a tutorial. But you can easily find what
you need with a Web search engine.
Go to http://google.com/ and enter "Perl read file variable" into the
search box. The very first hit is titled "Learn Perl -- Read files with
Perl". The third one (obviously part of a larger tutorial) is "Chapter 9
-- Using Files". Etc.
--
Jon Bell <jtbell@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
[ Questions about newsgroups? Visit http://www.geocities.com/nnqweb/ ]
[ or ask in news:news.newusers.questions ]
------------------------------
Date: Sat, 29 Jul 2000 11:56:14 GMT
From: "Tim Kosmider" <tkosmider@mgfairfax.rr.com>
Subject: Re: I Am An Idiot
Message-Id: <yDzg5.4224$c33.668663@typhoon-news1.southeast.rr.com>
There are many ways, depends on the kinds of data you are reading.
open (FILE, "myfile.txt");
while (<FILE>) {
chomp;
print "$_\n"; # line from file is in special variable $_
}
If the file you want to read is comma delimited. You can put the line into
an array.
open (FILE, "myfile.txt");
while (<FILE>)
chomp;
@flds = split(","); #create array from input line, separate line at
every comma
for $i (0..$#flds) { # go through the array
print "Field $i: $flds[$i]\n"; # print each value in the array
}
print "\n";
}
Collin Borrlewyn wrote in message <964868333.926550@pizza.crosslink.net>...
>Okay, this is stupid. I know it, and soon you will too. I'm trying to
>perform what I believe should be a fairly easy and fairly routine action. I
>am trying to use a perl script to interact with information in a text file
>on a server. I think this should be a common enough thing that doing it is
>possible. I mean, it'd be useful, right? So, unless one can't do this (and
>I'd like to know why not) can someone tell me how to get the contents of a
>file into an interact-able form, such as a variable? Something to do with
>open()? read()? The documentation isn't prescise, and nothing I have tried
>has worked.
>
>
>Disclaimer: Don't kill me. I've been messing with perl all of three days.
>I've read a few tutorials and poked about in the documentation. Maybe this
>is something they cover on page one of every perl book and day one of every
>perl course out there, but I don't know it.
>
>
>
>-Collin E Borrlewyn
> -Too sexy for his shirt.
> -collin@crosslink.net
>
>
------------------------------
Date: 29 Jul 2000 13:37:29 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Is "exit()" really necessary?
Message-Id: <8luj69$jk9$1@orpheus.gellyfish.com>
On Fri, 28 Jul 2000 16:13:34 -0700 Lauren Smith wrote:
>
> BUCK NAKED1 <dennis100@webtv.net> wrote in message
> news:668-3982068C-9@storefull-246.iap.bryant.webtv.net...
>>
>> So, I don't think that exit() is needed at the end of every Perl script
>> written. Who is correct?
>
> What do you want to do? These are guidelines I use in my programs.
>
> Do you want to:
>
> 1) Exit the program immediately : yes, use exit() or die() (the latter being
> preferable for reasons explained in the docs)
> 2) Execute some EXIT code which may or may not actually exit : no, just make
> that code a function and exit() from inside the function.
> 3) Exit at the end of the script : no, why use exit() when the program will
> terminate anyway?
>
Except if you want to return some exit code to the calling environment
where you will have to use 'exit EXPRESSION'.
> These may work for you, the may not, but they are what I follow. I almost
> never find exit() preferable to die(), though.
>
There might be perfectly valid reasons for occasioning a normal termination
from a program somewhere other than at the end, though most people will
just use flow control to do this rather than just jumping straight out
of the program, though why if we are quite happy to sling 'die' around in
the program we eschew exit does seem a little strange.
There are of course reasons for *not* using exit() - under mod_perl the
Apache module overrides the core exit().
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Sat, 29 Jul 2000 08:54:12 +0200
From: martin@radiogaga.harz.de (Martin Vorlaender)
Subject: Re: perl -lpi.bak -e "s/old/new/g" *.* broken on NT?
Message-Id: <39827f94.524144494f47414741@radiogaga.harz.de>
atramos_us@my-deja.com wrote:
: "George Karpodinis" <ucesgka@ucl.ac.uk> wrote:
: > <atramos_us@my-deja.com> wrote...
: > > My fovorite Perl one-liner (multi-file global search/replace)
: > > fails on NT with an "Invalid Argument" error.
: >
: > If you run the following program:
: >
: > perl -e "print join ',' => @ARGV" *.*
: >
: > you'll see that $ARGV[0] is the string "*.*". To get around this, ...
:
: Thanks for the reply!
:
: I'm pretty sure though older versions of Perl compiled
: for NT did the globbing automatically. I think it was
: a pre-ActiveState build. Maybe the DJGPP one.
The workaround below was suggested by Gurusamy Sarathy. I use it on all
CP/M+ machines I install Perl on.
cu,
Martin
[-- snip(pet) --]
=pod
=head2 Why won't my perl understand wildcards in arguments?
The default command shells on DOS descendant operating systems (such as
they are) usually do not expand wildcard arguments supplied to programs.
They consider it the application's job to handle that. This is commonly
achieved by linking the application (in our case, perl) with startup
code that the C runtime libraries usually provide. However, doing that
results in incompatible perl versions (since the behavior of the argv
expansion code differs depending on the compiler, and it is even buggy on
some compilers). Besides, it may be a source of frustration if you use
such a perl binary with an alternate shell that *does* expand wildcards.
Instead, the following solution works rather well. The nice things about
it: 1) you can start using it right away 2) it is more powerful, because
it will do the right thing with a pattern like */*/*.c 3) you can decide
whether you do/don't want to use it 4) you can extend the method to add
any customizations (or even entirely different kinds of wildcard
expansion).
C:\> copy con c:\perl\lib\Wild.pm
=cut
# Wild.pm - emulate shell @ARGV expansion on shells that don't
use File::DosGlob 'glob';
@ARGV = map {
my @g = File::DosGlob::glob($_) if /[*?]/;
@g ? @g : $_;
} @ARGV;
1;
=pod
^Z
C:\> set PERL5OPT=-MWild
C:\> perl -le "for (@ARGV) { print }" */*/perl*.c
p4view/perl/perl.c
p4view/perl/perlio.c
p4view/perl/perly.c
perl5.004_02/win32/perlglob.c
perl5.004_02/win32/perllib.c
perl5.004_03/win32/perlglob.c
perl5.004_03/win32/perllib.c
perl5.004_531/win32/perlglob.c
perl5.004_531/win32/perllib.c
Note there are two distinct steps there: 1) You'll have to create Wild.pm
and put it in your perl lib directory. 2) You'll need to set the PERL5OPT
environment variable. If you want argv expansion to be the default, just
set PERL5OPT in your default startup environment.
--
One OS to rule them all | Martin Vorlaender | VMS & WNT programmer
One OS to find them | work: mv@pdv-systeme.de
One OS to bring them all | http://www.pdv-systeme.de/users/martinv/
And in the Darkness bind them.| home: martin@radiogaga.harz.de
------------------------------
Date: Sat, 29 Jul 2000 13:51:26 +0100
From: "Ben Addis" <ben@baddis.plus.com>
Subject: Re: Perl jobs?
Message-Id: <pmAg5.409$N5.30493@stones>
There are jobs for most programming languages. It just depends on what you
want to do.
If your that worried, why not just learn both?
Ben
"peter" <peterp100@hotmail.com> wrote in message
news:kre4os899d2g278fl1i22bfeoj59ipmg0h@4ax.com...
> I'm teaching myself perl and I'm taking a Java class this fall. But,
> I'm thinking about dropping the Java class and concentrating on Perl.
> Are there any jobs out there for perl programmers? When I look in the
> paper everything says "Java and C ++" ???
------------------------------
Date: Sat, 29 Jul 2000 09:04:37 +0200
From: martin@radiogaga.harz.de (Martin Vorlaender)
Subject: Re: perl on Windows NT web server
Message-Id: <39828205.524144494f47414741@radiogaga.harz.de>
Mike Burnett (mnb@ornl.gov) wrote:
: #!/usr/local/bin/perl -w
: use CGI ":standard";
: $pi = open (FOO,"|myprog.exe");
: print "$pi pid\n";
: sleep 5;
: kill 9, $pi;
: close FOO;
:
: I put this exact code into a perl script that will generate a web page
: on a Windows NT Server running IIS web server. When I open the perl
: script from Netscape, I always get an error message when myprog
: starts. (myprog does start as can be seen in the Task Manager. The
: error has nothing to do with the program not being found, for example.)
I suspect this has to do with the broken I/O redirection in WinXX. See
the article below for a fix.
cu,
Martin
[-- snip --]
IIS 3.0
=======
In the registry, insert into the hive
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\
- ScriptMap\.pl, contents REG_SZ x:\yourpath\perl.exe -Tw "%s" "%s"
- CreateProcessWithNewConsole , contents REG_DWORD 1
and restart IIS.
If you omit the second one, I/O redirection will not work, i.e. external
commands using e.g. backticks or open(X, "$cmd|").
(You can find a description of these registry variables in the online
"IIS Installation And Maintainance Manual", in the chapter about
Registry variables.)
IIS4.0
======
Micro$oft has gone and changed it all. Script mapping is now set up
through the Internet Service Manager (ISM), utilizing the Microsoft
Management Console (MMC), rather than with Registry settings.
Using ISM go to the website entry and right click for its Properties. Click
on the "Home Directory" tab. At the bottom under "Application Settings"
click on the "Configuration" button (if it's greyed out, "Create" one).
A "Script Mapping" window will show all existing maps. The entry for Perl
should look like:
.pl x:\yourpath\perl.exe -Tw "%s" "%s"
If it doesn't exist, add a new script map. In the "Method Exclusion" field,
delete "POST", so that only "PUT,DELETE" remain.
For the second setting mentioned above:
- Make sure that you've got Windows Scripting Host installed as part
of Option Pack 4. You can verify this by looking for the file
%system32%\cscript.exe. If it isn't there, run setup.exe from
the Option Pack CD-ROM and install it.
- Using the CLI, go to %system32%\inetsrv\adminsamples.
- Run this:
adsutil.vbs SET W3SVC/1/CreateCGIWithNewConsole 1
(the number after "W3SVC/" may vary if you have multiple websites.
If you have, repeat the procedure for all websites.)
It'll say that CScript isn't set up to handle this. That's ok.
- Click Ok.
- Click yes, you want to register.
- Run it again.
- Using the ISM, restart all web sites.
A few remarks:
- I prefer to have the "-Tw" options on CGI scripts, but they are not
really necessary. "-T" doesn't work always (because of the missing
fork()).
- %system32% stands for the system32 subdirectory in Windows directory.
--
One OS to rule them all | Martin Vorlaender | VMS & WNT programmer
One OS to find them | work: mv@pdv-systeme.de
One OS to bring them all | http://www.pdv-systeme.de/users/martinv/
And in the Darkness bind them.| home: martin@radiogaga.harz.de
------------------------------
Date: Sat, 29 Jul 2000 09:16:54 +0200
From: martin@radiogaga.harz.de (Martin Vorlaender)
Subject: Re: Perl Rocks!(OT?)
Message-Id: <398284e6.524144494f47414741@radiogaga.harz.de>
Rage Matrix (Rage@matrix13.freeserve.co.uk) wrote:
: I don't see much point in using it on a non-UNIX based machine
I rarely have contact with *ix, but use it daily under VMS and WinXX.
That is one of Perl's beauties: it's been ported to a variety of OS's,
and most scripts do run without a change on those (sometimes very)
different platforms.
cu,
Martin
--
One OS to rule them all | Martin Vorlaender | VMS & WNT programmer
One OS to find them | work: mv@pdv-systeme.de
One OS to bring them all | http://www.pdv-systeme.de/users/martinv/
And in the Darkness bind them.| home: martin@radiogaga.harz.de
------------------------------
Date: Sat, 29 Jul 2000 13:21:51 +0100
From: "Rich" <rock.ice@bigfoot.Xcom>
Subject: search.cgi >How do I?
Message-Id: <8lui3q$hv3$1@newsg1.svr.pol.co.uk>
Hi,
Can anyone give me details or send me an example of how to change the html
colour scheme and background on this popular script?
I have tried adding various things and have had very little success.
I have no problem getting the script to work on our Unix sever but if I
attempt to add images or change things I get mostly errors.
Any help would be appreciated.
Rich.
please reply to rock.ice@(remove)bigfoot.com
------------------------------
Date: Sat, 29 Jul 2000 12:25:05 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: search.cgi >How do I?
Message-Id: <slrn8o5jio.hij.marcel@gandalf.local>
On Sat, 29 Jul 2000 13:21:51 +0100, Rich <rock.ice@bigfoot.Xcom> wrote:
>Can anyone give me details or send me an example of how to change the html
>colour scheme and background on this popular script?
'search.cgi' may be a popular script, but as it comes from some (probably
dubious) archive, it may not be very popular in this group, as people
here prefer to write their own programs.
Nevertheless, Perl programs don't have background colors (not in vi they
don't). Most likely this script will just print some HTML, so change
what's being printed.
HTH.
--
Marcel
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();
------------------------------
Date: Sat, 29 Jul 2000 13:52:02 +0100
From: "Rich" <rock.ice@(remove)bigfoot.com>
Subject: Re: search.cgi >How do I?
Message-Id: <8lujsc$km5$1@newsg1.svr.pol.co.uk>
If I add say the second line here for example:
===============================
print "Below are your search results:<p></center><hr size=7
width=75%><p>\n";
print "<font=arial>\n";
foreach $key (keys %include) {
if ($include{$key} eq 'yes') {
print "<li><a href=\"$baseurl$key\">$titles{$key}</a>\n";
}
}
print "</ul>\n";
=================================
The script won't work. If I remove the 2nd line it works again. How so?
Should I do this offline in Windows before I dos2unix and chmod or online
afterwards with FTP Pro?
Rich.
Marcel Grunauer <marcel@codewerk.com> wrote in message
news:slrn8o5jio.hij.marcel@gandalf.local...
> On Sat, 29 Jul 2000 13:21:51 +0100, Rich <rock.ice@bigfoot.Xcom> wrote:
>
> >Can anyone give me details or send me an example of how to change the
html
> >colour scheme and background on this popular script?
>
> 'search.cgi' may be a popular script, but as it comes from some (probably
> dubious) archive, it may not be very popular in this group, as people
> here prefer to write their own programs.
>
> Nevertheless, Perl programs don't have background colors (not in vi they
> don't). Most likely this script will just print some HTML, so change
> what's being printed.
>
> HTH.
>
> --
> Marcel
> sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print}
Just_Another_Perl_Hacker();
------------------------------
Date: 29 Jul 2000 13:20:06 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Should truncate length be 0?
Message-Id: <8lui5m$g8e$1@orpheus.gellyfish.com>
On Sat, 29 Jul 2000 00:48:23 GMT Katia Hayati wrote:
> In article <m3l2oskqu9qqpc7dqru1ervfflu2c383b3@4ax.com>,
> Bart Lateur <bart.lateur@skynet.be> wrote:
>> However, This sequence:
>>
>> seek FILE, 0, 0;
>> print FILE, $data;
>> truncate FILE, tell FILE;
>>
>> *has already failed* on me, on a fews platforms. IT truncated the file
>> to the wrong length, even though I think that tell() returned the
>> correct offset.
>
> Does that mean that truncate() can be trusted to work only with a 2nd
> argument of 0?
>
No its just the order of things that might cause the problem with certain
OS. What Bart is doing here is truncating the file to the current
location of the file pointer which logically *should* work and it does *work*
on this machine for the appropriate open modes. If you have opened the
file for '+>>' you will need truncate to zero, then seek, then print
obviously otherwise the print will go to the end of the file.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Sat, 29 Jul 2000 12:37:45 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Suggestion for syntax change
Message-Id: <MPG.13ed6d7a1c6c0464989698@news>
Ilmari Karonen writes ..
>Are you really suggesting that, say:
>
> (qw/a b c d e/)[print join ':' => -2 .. 0 ? 1, 2 : 3, 4]
>
>should be magically transformed into:
>
> (qw/a b c d e/)[print join ':' => 3 .. 0 ? 1, 2 : 3, 4]
>
>before evaluation?
excuse the mass deletion of the rest of your post .. I just wanted to
say that you're right - in these more complicated examples of list index
context it would be difficult to work out when to turn the negative
integers within the list index into relative indices from the end of the
list
that's enough to convince me of the usefulness of $#
--
jason -- elephant@squirrelgroup.com --
------------------------------
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 3842
**************************************