[12736] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 146 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 14 20:07:27 1999

Date: Wed, 14 Jul 1999 17:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 14 Jul 1999     Volume: 9 Number: 146

Today's topics:
    Re: # of days between 2 dates (again) (Abigail)
    Re: ** Working With Strings (Abigail)
        ADO Insert cursor to SQLServer <dlewright@nuworld.com>
    Re: Anybody know how to to this? (Abigail)
    Re: C-like #define macros in Perl (Tad McClellan)
    Re: Calculations (Martien Verbruggen)
        Converting Prel program to DLL <sivanp@ibm.net>
        Couldn't install some perl modules. Help please. <zzhang@bayou.uh.edu>
        Greedy regular expression... <richj@home.com>
    Re: hash assignments <nead@neadwerx.com>
        Hash Size Limit? jrt915@hotmail.com
        How can I use image as a submit botton ? <factory@factory.co.kr>
        how many files can you open? (Jobin James)
        How to delete an element in the middle of an array <monty@torranceweb.com>
    Re: how to drop a connexion with a client? (Joe Smith)
    Re: knowing it's own name? (Abigail)
    Re: knowing it's own name? (Abigail)
    Re: Linux - Apache - Perl <damani@world.std.com>
        mod_perl log messages <username@ncsa.uiuc.edu>
    Re: Newbie needs help:  Environment variables (Martien Verbruggen)
        Opposite of chr() <hiller@email.com>
    Re: Opposite of chr() (Greg Bacon)
        Perl Wrapper <jpitman@novell.com>
    Re: question on mail attachments <hiller@email.com>
    Re: Subroutine references and sort (Martien Verbruggen)
    Re: Test if a File Exists? (Tad McClellan)
    Re: Test if a File Exists? (Abigail)
    Re: Using variable to modify regexp (Abigail)
    Re: Why Perl instead of ColdFusion? df6954@eecs1.eecs.usma.edu
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 14 Jul 1999 18:32:29 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: # of days between 2 dates (again)
Message-Id: <slrn7oq7ff.c9j.abigail@alexandra.delanet.com>

skyfaye@my-deja.com (skyfaye@my-deja.com) wrote on MMCXLIII September
MCMXCIII in <URL:news:7mir39$r1a$1@nnrp1.deja.com>:
-- I'm new to this list.  I've been unsuccessful at posting.  Why does it
-- log me out every time I click on the button to post my message?  I

Rabbits. Since three weeks, the Internet Centre for Postings in Perl
Groups (ICPPG) has been bothered by rabbits. Not only do the rabbits eat
all the carots (and the carots are needed to make carot-juice, which
is essential in lubricating the posts so that they can go through),
the rabbits also have the nasty habbit of logging people out.

However, the PETF, the Perl Elephant Task Force, has come to a rescue.
Almost all rabbits have been trampled to death (there will be free
rabbit stew at The Perl Conference (TPC)). The PETF is now enlarging
the tunnels of the rabbit fortress so they can go in and sweep the
underground resistance from the planet.

However, elephants are clumsy. Part of the hardware is broken. Until
further announcements, posting by "clicking a button" is strongly
discouraged. Permanent injury and death may occur. Use postings on
papyrus, written with goose feathers instead. The moderated group
accepts smoke signals as well.

-- apologize in advance if my previous post got through.  Here's my
-- question:
--
-- $old_mon = 6; $old_day = 22; $old_year = 1994; #June 22, 1994
-- $new_mon = 7; $new_day = 14; $new_year = 1999; #July 14, 1999
--
-- How do I find out the number of days between the 2 dates ?

(1999 - 1994) * 365 + 1 + (30 - 22) + 14, which makes 1848 days.

And 1848 == 77 * 24.

This, and more tricks, can be found on the CPAN, in the Dates:: section.


Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: 14 Jul 1999 17:52:03 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: ** Working With Strings
Message-Id: <slrn7oq53l.c9j.abigail@alexandra.delanet.com>

Tad McClellan (tadmc@metronet.com) wrote on MMCXLIII September MCMXCIII
in <URL:news:6gehm7.pbi.ln@magna.metronet.com>:
'' Abigail (abigail@delanet.com) wrote:
'' : Larry Rosler (lr@hpl.hp.com) wrote on MMCXLII September MCMXCIII in
'' : <URL:news:MPG.11f510c4a29b3bbc989cb8@nntp.hpl.hp.com>:
'' : @@ 
'' : @@ Things like this are tipping me further to the Abigail side of The 
'' : @@ Force.
'' 
'' 
'' : You like mauve too?
'' 
'' 
''    Is mauve male or female?


Yes.



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: Wed, 14 Jul 1999 23:40:03 GMT
From: Dorr Lewright <dlewright@nuworld.com>
Subject: ADO Insert cursor to SQLServer
Message-Id: <378D1FD3.303283B3@nuworld.com>

Does anyone have an example using ADO where you prepare an insert cusor,
then insert rows, then close the cursor?
I am inserting to a SQLServer 7.0 database.

Thanks, ...Dorr



------------------------------

Date: 14 Jul 1999 18:57:24 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Anybody know how to to this?
Message-Id: <slrn7oq8u5.c9j.abigail@alexandra.delanet.com>

Kris (kdom@mail.mobistar.be) wrote on MMCXLIII September MCMXCIII in
<URL:news:378CAF23.EC4CE35@mail.mobistar.be>:
%% 
%% I am newcomer to Perl, so if you're don't wish to answer to same stupid
%% questions again and again, don't read any furhter.

Too late. You already posted it. By posting it to this group, you are
entitled to be flamed. There are no stupid questions. But there are
questions that are frequently asked, and those are answered in the FAQ.
Obviously, you haven't read the FAQ, else you wouldn't excuse yourself.
Then there are off topic questions. They aren't stupid, but they don't
belong here. There are also questions that are easily answered by reading
the manual. You shouldn't ask them in this group either.

%% I want to write a cgi for apache webserver on Digital Ux using perl.

You want to write an interface? Or do you plan to write a program that
uses the CGI? Let's assume the latter....

%% This cgi should just display the contents of a variable.
%% 
%% However, the contents of this variable is not a line, but a lot of
%% lines.
%% My Netscape browser displays the content of the variable but as one big
%% string, which is normal because HTML does only react on <BR>

HTML doesn't react. HTML is markup. Tag soup browser that have been
written by incompetent programmers might "react" to tags as if they were
commands, but that's not something to be proud of. And you shouldn't
think that way either - that would severely limit yourself.

%% So what I want to do is to replace all the separator (newline, carriage
%% return or whatever) in the variable by <BR> using regular expressions.
%% 
%% Here the problem arises:
%% - what is that separator?

Well, you tell *us*. It's your variable. It might contain newlines. It
might contain carriage returns. It might contain both. How should *we*
know?

%% -                         When I use print to display the variable in UX
%% shell, everything is fine, so there must be a sort of a separator at the
%% end of each line
%% - How do I replace this separator with <BR> ?

That would be a very trivial substitution, replacing a fixed string
with another fixed string. Which part of "man perlre" is so unclear
you cannot figure out how to do this?



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: Wed, 14 Jul 1999 13:10:20 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: C-like #define macros in Perl
Message-Id: <s9gim7.2uj.ln@magna.metronet.com>

TM Lehto (hiwi1krg@iitb.fhg.de) wrote:

: I don't want to use s///)?


   Why not?


: Can I define macros like in C language?


   See the -P switch in perlrun.pod.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Wed, 14 Jul 1999 22:45:26 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Calculations
Message-Id: <aq8j3.9$9t5.1471@nsw.nnrp.telstra.net>

In article <MPG.11f5bb732b72533e989cc5@nntp.hpl.hp.com>,
	lr@hpl.hp.com (Larry Rosler) writes:
> In article <S%Si3.115$xg5.8364@nsw.nnrp.telstra.net> on Wed, 14 Jul 1999 
> 02:56:50 GMT, Martien Verbruggen <mgjv@comdyn.com.au> says...

>> s*\s+**gs&&s=\++=+=s&&s-\=+--s&&s!\?+!!s;

> Stripping whitespace seems unnecessary somehow.  This produces a better 
> golf score by far (and should be much faster, too):
> 
>   y=+==s&&y-=?--d;

I knew someone would come up with something shorter :) I wasn't going
for short, but for aesthetically pleasing line noise :) I actually
threw out a few shorter ones, including something like:

($_=<<'======')=~tr=+==s;
123456
++++++
234567
======
print eval, "\n";

Yes, I know that's still (at least) one character longer than
necessary :) I'll leave that fix as an exercise for the original
poster.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | +++ Out of Cheese Error +++ Reinstall
Commercial Dynamics Pty. Ltd.       | Universe and Reboot +++
NSW, Australia                      | 


------------------------------

Date: Thu, 15 Jul 1999 02:51:22 -0000
From: "āV" <sivanp@ibm.net>
Subject: Converting Prel program to DLL
Message-Id: <7mj7jg$thq$1@news.ibm.net.il>

I need to use a script in Perl, in a stand-alone application.
The application is written in VB.
Until now I executed the script with the SHELL command, that runs it in DOS
mode.
I don't like it like this.

I want to know if I can convert in some way the Perl script to something
more like a window's DLL?




------------------------------

Date: Wed, 14 Jul 1999 17:28:32 -0500
From: Zhengdong Zhang <zzhang@bayou.uh.edu>
Subject: Couldn't install some perl modules. Help please.
Message-Id: <378D0F10.2A55@bayou.uh.edu>

I tried to install several perl modules yesterday on a Red Hat Linux 5.0
machine using CPAN module. All but LWP and DBD::mysql were successfully
installed.
Both of the installation of LWP and DBD::mysql cannot pass the test. For
LWP, the error message is:

 ...(messages above are omitted)...
Running make test
/usr/bin/perl -e 'use Config; chdir q{./blib/script}; foreach (qw(GET
HEAD POST)) {' \
-e 'unlink "$_";' \
-e 'system("$Config{\"lns\"} lwp-request $_") && die; }'
/usr/bin/perl t/TEST 0
base/common-req.....ok
base/cookies........ok
base/date...........ok
base/headers-auth...ok
base/headers-etag...ok
base/headers-util...ok
base/headers........ok
base/listing........ok
base/mediatypes.....ok
base/message........ok
base/negotiate......ok
base/response.......ok
base/status.........ok
robot/rules-dbm.....ok
robot/rules.........ok
robot/ua............HTTP Server terminated
FAILED tests 1-3, 5, 7
        Failed 5/7 tests, 28.57% okay
local/autoload......ok
local/get...........ok
local/http..........HTTP Server terminated
Can't call method "is_redirect" without a package or object reference at
local/http.t line 186, <DAEMON> chunk 1.
dubious
        Test returned status 9 (wstat 2304, 0x900)
Undefined subroutine &Test::Harness::WCOREDUMP called at
/usr/lib/perl5/Test/Harness.pm line 252.
make: *** [test] Error 2
  /usr/bin/make test -- NOT OK
Running make install
  make test had returned bad status, won't install without force




For DBD::mysql, the message is: 


 CPAN.pm: Going to build JWIED/Msql-Mysql-modules-1.2201.tar.gz

Which drivers do you want to install?

    1)  MySQL only
    2)  mSQL only (either of mSQL 1 or mSQL 2)
    3)  MySQL and mSQL (either of mSQL 1 or mSQL 2)
    4)  mSQL 1 and mSQL 2
    5)  MySQL, mSQL 1 and mSQL 2

Enter the appropriate number:  [3] 1


Do you want to install the MysqlPerl emulation? You might keep your old
Mysql module (to be distinguished from DBD::mysql!) if you are concerned
about compatibility to existing applications! [n] 
Where is your MySQL installed? Please tell me the directory that
contains the subdir 'include'. [/usr] 
Which database should I use for testing the MySQL drivers? [test] 
On which host is database test running (hostname, ip address
or host:port) [localhost] 
User name for connecting to database test? [undef] 
Password for connecting to database test? [undef] 
Creating files for MySQL ....................
Checking if your kit is complete...
Looks good
Using DBI 1.13 installed in /usr/lib/perl5/site_perl/i386-linux/auto/DBI
Writing Makefile for DBD::mysql
Writing Makefile for Msql-Mysql-modules
mkdir ./blib
mkdir ./blib/lib
mkdir ./blib/arch
mkdir ./blib/arch/auto
mkdir ./blib/arch/auto/Msql-Mysql-modules
mkdir ./blib/lib/auto
mkdir ./blib/lib/auto/Msql-Mysql-modules
mkdir ./blib/man1
/usr/bin/perl -I./blib/arch -I./blib/lib
-I/usr/lib/perl5/i386-linux/5.00404 \
-I/usr/lib/perl5 -Ilib -MExtUtils::PerlPP \
-e "ppp('dbd/dbimon.in', 'dbimon', 'lib/DBD/mysql/Install/Config.pm')"
pod2text mysql/lib/DBD/mysql.pm >README
/bin/sh: pod2text: command not found
make: *** [README] Error 127
  /usr/bin/make  -- NOT OK
Running make test
  Oops, make had returned bad status
Running make install
  Oops, make had returned bad status

cpan>


Any ideas and suggestions will be appreciated. Thanks.


------------------------------

Date: Wed, 14 Jul 1999 23:44:59 GMT
From: Joan Richards <richj@home.com>
Subject: Greedy regular expression...
Message-Id: <378D20A5.7C70CE62@home.com>

I've got a little subroutine that replaces a line in my configuration
file with another.  So, let's say that my config was:

foo
foobar 30

If i was trying to replace foobar 30 with foobar 60 that works fine.
However, when I call my replace subroutine to remove foo, then it will
remove both foo and foobar 30.  here's the code I'm using to replace a
line:

sub replace {
 my($old_line,$new_line,$file,$del) = @_;
 my($rep) = 0;
 system("chmod +w $file");
 open(OUT,">$file.bak") || &show("Can't open $file!");
 open(FILE,"$file") || &show("Can't open $file!");

 while(<FILE>)
 {
  if (/$old_line/)
  {
   if ($_ eq "$new_line\n")
   {
    print OUT;
    $rep = -1;
   }
   else
   {
    print OUT "$new_line\n";
    $rep = 1;
   }
   next;
  }
  print OUT;
 }

 close(FILE);
 close(OUT);
 rename("$file.bak", "$file");
 $rep;
}

When I'm trying to remove "foo" I'll do a call something like this:

&replace("foo", "", $PATH_TO_CONFIG, 1);

It looks like my /$old_line/ might be grabbing everything starting with
"foo", however, I don't want it to do this.  I only want it to grab
"foo".

Any suggestions?

-J



------------------------------

Date: 14 Jul 1999 23:00:44 GMT
From: "Nick Downey" <nead@neadwerx.com>
Subject: Re: hash assignments
Message-Id: <01bece4c$d458fa70$53343d80@r52h83>

Thanks!




------------------------------

Date: Wed, 14 Jul 1999 23:39:22 GMT
From: jrt915@hotmail.com
Subject: Hash Size Limit?
Message-Id: <7mj739$vph$1@nnrp1.deja.com>

Greetings.

Does anybody know if there is a size limit on hashes?  I assume they do
their processing in memory, so maybe the limit is a system resource
constraint.

I am thinking about reading in two sets of data and putting them each
in a multi-dimensional hash so I can do some easy referencing,
comparison and processing.  Hashes are an ideal solution, but the size
of them could be in the hundreds or records.

Thanks.



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: Thu, 15 Jul 1999 08:14:00 +0900
From: "Yeong Mo/Director Hana co." <factory@factory.co.kr>
Subject: How can I use image as a submit botton ?
Message-Id: <7mj526$ssu$1@news1.kornet.net>

How can I use image as a submit botton ?

or text ?

Something like
upload/shopcall.cgi?value=001/upload




------------------------------

Date: 14 Jul 1999 22:35:46 GMT
From: jobin@unser.ucr.edu (Jobin James)
Subject: how many files can you open?
Message-Id: <7mj3c2$c9a$1@pravda.ucr.edu>


hi

is there any limit on the number of files
that can be kept open simultaneously?
i was trying to open 60+ files at the same 
time, but it always stops at the 56th one.

thanks
jobin



------------------------------

Date: Wed, 14 Jul 1999 16:45:12 -0700
From: Steve Montgomery <monty@torranceweb.com>
Subject: How to delete an element in the middle of an array
Message-Id: <378D2108.F6D12C7F@torranceweb.com>

If I read a database (plain text file) into an array, how do I delete
one of lines of the database  ( one element - let's call it $databse[10]
)
and shift the remaining lines up to fill the gap.

I've seen a DELETE command when using associative arrays but nothing
in my book talks about standard arrays.

Is there also a simple way to delete many elements at one time? If you
delete one, then I'm assuming the remaining elements will be called by
a number that is one less than it was called before. Is deleting one at
a time the only way to go?

Thanks so much,

Steve





------------------------------

Date: 14 Jul 1999 16:55:06 -0700
From: inwap@best.com (Joe Smith)
Subject: Re: how to drop a connexion with a client?
Message-Id: <7mj80q$3l8$1@shell3.ba.best.com>

In article <cdessimoz-0807991158180001@pop-ls-07-1-dialup-78.freesurf.ch>,
Christophe Dessimoz <cdessimoz@reference.ch> wrote:
>line "</html>". that make a problem as i have some long "post-processes".
>the client waits for infos i'll never get!
>so my question is, how can we drop the connexion with the client, to make
>some internal stuff (e.g. send some mails).

#!/usr/local/bin/perl5

open(OUT,">>test.log");
select OUT;    $| = 1;	# Force outputs to file to be unbuffered
select STDOUT; $| = 1;	# Make STDOUT unbuffered so fork() works properly

$_ = "Started  at ".localtime()."\n";
print OUT $_;

print <<EOM;
Content-type: text/html

$_
<H1>OK</H1>
sleeping for 15 seconds now.<BR>
EOM

$pid = fork();	# 
if ($pid) {	# parent process
  exit;		# causes web server to tell browser that document is done
} else {	# child process
  close(STDIN); close(STDOUT); close(STDERR);
  sleep 15;	# the log file will prove that the child ran after parent gone
  print OUT "Finished at ".localtime()."\n";
  exit;
}


-- 
INWAP.COM is Joe Smith, Sally Smith and our cat Murdock.
  (The O'Hallorans and their cats moved to http://www.tyedye.org/ Nov-98.)
See http://www.inwap.com/ for PDP-10, "ReBoot", "Shadow Raiders"/"War Planets"


------------------------------

Date: 14 Jul 1999 18:00:14 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: knowing it's own name?
Message-Id: <slrn7oq5j1.c9j.abigail@alexandra.delanet.com>

John Klassa (klassa@aur.alcatel.com) wrote on MMCXLIII September MCMXCIII
in <URL:news:7mibna$soo$1@aurwww.aur.alcatel.com>:
"" On 14 Jul 1999 08:42:55 -0500, Abigail <abigail@delanet.com> wrote:
""  > perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
""  >          / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
""  >          % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
""  >          BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
"" 
""  % perl ...
"" syntax error at -e line 4, near "= >"


Hmmm. I don't see an equal sign followed by a space in my program, do you?



Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: 14 Jul 1999 18:03:39 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: knowing it's own name?
Message-Id: <slrn7oq5pe.c9j.abigail@alexandra.delanet.com>

Vice Admiral Acker (KamiBot@rotfl.com) wrote on MMCXLIII September
MCMXCIII in <URL:news:378ca310.5002338@news3.inxpress.net>:
?? I kinda guess you sorta mean:
?? 
?? $script = $ENV{'SCRIPT_FILENAME'};
?? print "$script\n";
?? 
?? This will print the full pathname of the file you're using, if I'm correct.


Well, that might work on your system, but it's not very portable.


$ perl -we 'print $ENV {SCRIPT_FILENAME}'
Use of uninitialized value at -e line 1.

$ 


Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: Wed, 14 Jul 1999 22:14:46 GMT
From: Damani Walton <damani@world.std.com>
Subject: Re: Linux - Apache - Perl
Message-Id: <v9n1wy3mll.fsf@world.std.com>

abigail@delanet.com (Abigail) writes:

> Damani Walton (damani@world.std.com) wrote on MMCXLII September MCMXCIII
> in <URL:news:v9yaglgug1.fsf@world.std.com>:
> !! "Brad Long" <bjl@uq.net.au> writes:
> !! 
> !! > Does anyone know how to get Apache web server to recognize ".pl" programs a
> !! > perl programs (i.e. to run them as scripts)?
> !! > 
> !! > If so, please let me know how to do it!
> !! 
> !! I think you're asking the wrong question.  Apache uses a "mime.types"
> !! configuration file to tell it what extensions map onto what file
> !! types.  The web server mainly uses this to let web browsers know how
> !! to interpret the data the server's sending to them. 
> 
> I wonder what's worse. People asking totally off topic questions, or
> people answering off-topic questions, rewarding the posters of off topic
> questions.
> 
> It's like tourists feeding the bears in a national park. They become a
> problem. 


You're not exactly part of the solution, Abigail.  I pointed the
original poster to a place where he could find the answer to his
question, the Apache web site.  I also looked for a news group to
refer him to where his question was on-topic, but didn't find any.  (I
looked in the comp hierarchy, but didn't think to look under
infosystems.)  But I tried to do the right thing by pointing someone
the right direction rather than starting a thread in this news group
on the subject on web servers.

But you, in a high-handed, insulting manner, managed to generate a lot
more off-topic posts than would otherwise have existed.  (Yes, I'm
admitting that this current post is somewhat off-topic.)  Instead of
yelling at people for being off-topic, you should help them find a
place where they are on-topic.  Otherwise, you're making no meaningful
contribution to the dialog and just helping to make the Usenet a
nastier place. 


Damani


------------------------------

Date: Wed, 14 Jul 1999 18:52:13 -0500
From: NCSA User <username@ncsa.uiuc.edu>
Subject: mod_perl log messages
Message-Id: <378D22AD.A9CD1CE0@uiuc.edu>


    Hi,

 I installed mod_perl on my machine (Irix 5.3, Apache_1.3.6) and I
tested the "Hello" script from "Apache Modules" book. It works fine, but
server takes longer then usual to start and in error_log I got a bunch
of messages like:

[Wed Jul 14 18:22:02 1999] (eval 194): Constant subroutine
RC_METHOD_NOT_ALLOWED
 redefined at (eval 194) line 31.
[Wed Jul 14 18:22:02 1999] (eval 194): Constant subroutine
RC_HTTP_VERSION_NOT_S
UPPORTED redefined at (eval 194) line 32.
[Wed Jul 14 18:22:02 1999] (eval 194): Constant subroutine
RC_UNSUPPORTED_MEDIA_
TYPE redefined at (eval 194) line 33.
 ..........................................................
[Wed Jul 14 18:22:02 1999] Status.pm: Constant subroutine
RC_MOVED_TEMPORARILY
redefined at /usr2/local/lib/perl5/site_perl/HTTP/Status.pm line 154.

Is it OK, or I need to worry about them?

            Thank you,


                            Anton



------------------------------

Date: Wed, 14 Jul 1999 23:25:27 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Newbie needs help:  Environment variables
Message-Id: <H%8j3.20$9t5.2631@nsw.nnrp.telstra.net>

In article <378CC37E.394D2E7C@stargate-systems.com>,
	Peter Marek <pmarek@stargate-systems.com> writes:

>                                       execute a bourne shell script that
> exports some environment variables.  These variables need to be visible
> to the caller which is the Perl script.
[snip]
> Can anyone shed some light on this?

The perl FAQ can:
# perldoc perlfaq8
[snip]
     I {changed directory, modified my environment} in a perl
     script.  How come the change disappeared when I exited the
     script?  How do I get my changes to be visible?

HTH
Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Hi, Dave here, what's the root
Commercial Dynamics Pty. Ltd.       | password?
NSW, Australia                      | 


------------------------------

Date: Wed, 14 Jul 1999 22:50:14 GMT
From: Jordan Hiller <hiller@email.com>
Subject: Opposite of chr()
Message-Id: <378D142B.23F03B03@email.com>

Hi,
I looked in the docs but I couldn't find anything to answer my question. Is
there a function that does the opposite of chr($number), that returns a number
when given a letter?

Thanks,
Jordan Hiller (hiller@email.com)

JavaScript and Perl programs for
 making online tests and quizzes:
http://web-shack.hypermart.net/quiz.html


------------------------------

Date: 14 Jul 1999 22:54:35 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Opposite of chr()
Message-Id: <7mj4fb$f04$1@info2.uah.edu>

In article <378D142B.23F03B03@email.com>,
	Jordan Hiller <hiller@email.com> writes:
: I looked in the docs but I couldn't find anything to answer my
: question. Is there a function that does the opposite of chr($number),
: that returns a number when given a letter?

ord()

Greg
-- 
Reality is only an illusion, albeit a very persistent one.
    -- Albert Einstein


------------------------------

Date: Wed, 14 Jul 1999 15:46:53 -0600
From: "Jeff Pitman" <jpitman@novell.com>
Subject: Perl Wrapper
Message-Id: <7mj0gh$i28$1@acs2.byu.edu>

I'm trying to create a perl wrapper that will execute scripts in different
directories depending on how and when it is called.  My wrapper initializes
a dozen variables in a particular namespace that I want called-scripts to
have access to.  Currently this is how I'm doing it:

{Initialize Namespace}
$ScriptDir="$ENV{HTTP_HOST}/";

require "$in{SCRIPT}";

But, require doesn't import the current variables into the subsequent file.

Any ideas.

Thanks
Jeff




------------------------------

Date: Wed, 14 Jul 1999 22:08:45 GMT
From: Jordan Hiller <hiller@email.com>
Subject: Re: question on mail attachments
Message-Id: <378D0A72.A2314DD4@email.com>

MIME::Lite

tommylebrun@my-deja.com wrote:
> 
> Anyone know how to attach a file to an email then send it? Thanks.
> 
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

-- 
Jordan Hiller (hiller@email.com)

JavaScript and Perl programs for
 making online tests and quizzes:
http://web-shack.hypermart.net/quiz.html


------------------------------

Date: Wed, 14 Jul 1999 22:33:46 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Subroutine references and sort
Message-Id: <ef8j3.8$9t5.1471@nsw.nnrp.telstra.net>

In article <7mhkjm$avd@harrier.le.ac.uk>,
	nja@le.ac.uk (A.J. Norman) writes:

>  I can think of one case where this isn't true - assuming the function
>  "banana" can return either undef, "apple" or "orange", this will throw
>  a warning while running correctly when the return value is undef:
> 
>  my $fruit = banana();
>  if ($fruit eq "apple") 
>  {
>  ...
>  }
> 
>  I'd say that $fruit is definitely initialised here, even if it might 
>  be initialised to undef.  

In Perl undefined and unitialised are basically the same. Even though
the documentation uses them both, they really mean the same in most
practical cases, even though linguistically they may not mean the same
thing.

From perldiag:

     Use of uninitialized value
         (W) An undefined value was used as if it were already
         defined.  It was interpreted as a "" or a 0, but maybe
         it was a mistake.  To suppress this warning assign an
         initial value to your variables

The error message uses the word 'uninitialized', while the explanation
uses 'undefined'. Same thing.

If you want to use the above code style, and avoid warning messages,
you should probably design your subroutines in such a way that they
return a false but defined value (like 0 or "").

The reason why it is really the same thing is that variables are by
default initialised to undef by perl. -w just makes use of that little
bit of knowledge to warn you that you are manipulating an undefined
value with an operator that wasn't designed to handle it well.

So, why have an undefined value if it doesn't simply mean
uninitialised?

Suppose you need to write a sub that can return a string of any length
(including 0), but which may need to signal failure for certain
conditions:

my $result = stringSub('foo');
die "Horrible death" unless defined $result;

The same goes for a sub that returns a number, or for a sub that could
return anything. undef will always signify some failure.

Why aren't there two different states, uninit and undef? 

I guess one could argue for it, but somehow it doesn't feel very well
with the design of Perl. And I yet have to come across a situation
where I could actually make use of this. If you ever need to test
whether you have initialised your variable, your better rewrite your
code. The fact that variables are initialised to undef 

Why doesn't the error message say 'undefined' instead of
'uninitialized'?

I guess that's a matter of taste. The warning is trying to alert you
to the fact that you _may_ be using an uninitialised value, and it
infers that from the fact that the value is undefined. It would
probably be more correct to call it an undefined value, but then the
warning gives less of a hint to what the problem may be.

>  I'm not saying -w isn't useful or a good thing, but I'm rather 
>  perplexed by the emphasis some people place on it rather than on "use 
>  strict" (which in my opinion ought to be the default).  "use strict" 
>  is always the second thing I type in a script, but I generally add 
>  the -w flag late in the day, and I'm usually pleasantly surprised by 
>  how little it warns me about.  

I always advise people to use both 'use strict' and -w. From the
start. The first thing you type is:

#!/usr/local/bin/perl -w
use strict;

They do have a different function. It is true that using strict will
prevent many wanrings by forcing you to code in a cleaner way, but it
won't stop it. It's easy enough to write code under strict that
generates many many warnings.

strict is a compile time issue, while -w is a run time issue. They're
very different beasts.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | +++ Out of Cheese Error +++ Reinstall
Commercial Dynamics Pty. Ltd.       | Universe and Reboot +++
NSW, Australia                      | 


------------------------------

Date: Wed, 14 Jul 1999 13:07:27 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Test if a File Exists?
Message-Id: <f4gim7.2uj.ln@magna.metronet.com>

Bart Lateur (bart.lateur@skynet.be) wrote:
: Vice Admiral Acker wrote:

: >How would I test if a file existed or not?

: 	open(FILE,">>filename");

: Now it exists!    :-)


   Maybe, maybe not.


      open(FILE, '>>filename') || die 'file does not exist';

   If you get no output from that, _then_ the file exists.

   :-)  :-)


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: 14 Jul 1999 18:14:15 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Test if a File Exists?
Message-Id: <slrn7oq6da.c9j.abigail@alexandra.delanet.com>

Vice Admiral Acker (KamiBot@rotfl.com) wrote on MMCXLIII September
MCMXCIII in <URL:news:378ca014.4238283@news3.inxpress.net>:
$$ How would I test if a file existed or not?


Phone your sysadmin and ask him to read out the manual for you.
If there are 2 sysadmins in your MIS department, they can do it
in stereo. With 3 or more, they can sing it in an ensemble.



Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: 14 Jul 1999 18:17:10 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Using variable to modify regexp
Message-Id: <slrn7oq6ip.c9j.abigail@alexandra.delanet.com>

Bill Snow (snow@flinet.com) wrote on MMCXLIII September MCMXCIII in
<URL:news:378CC53F.4709CC50@flinet.com>:
@@ Is it possible to use a variable to modify a regexp?  I'm able to use a
@@ variable ok between the slashes but if I try to use one at the end. It
@@ does not work.  I've tried various combinations and looked at FAQ
@@ without finding anything.


Look what the manual has to say about (?...) regex constructs.



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: Wed, 14 Jul 1999 22:38:46 GMT
From: df6954@eecs1.eecs.usma.edu
Subject: Re: Why Perl instead of ColdFusion?
Message-Id: <7mj3hl$uh2$1@nnrp1.deja.com>

Additional concerns with ColdFusion:

-The underlying design is generally going to result in
a system that will be difficult to change if the
scale/magnitude of use increases.  This sometimes
leads to requiring the next generation of hardware
to meet a demand that exceeds some threshold level.

-The security of the system is not open to improvement
by the application system developer.

-The application system is dependent on the software vendor
for continuing improvement, enhancement, and maintenance.
Remember if your need is not central to the vendor's view of
what is going to make them money, they are unlikely to modify
the product (ColdFusion) out of the goodness of their collective
hearts.

Dr. Frank Mabry
Dept. of EE&CS
U.S. Military Academy
West Point, NY 10996

df6954@eecs1.eecs.usma.edu


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 146
*************************************


home help back first fref pref prev next nref lref last post