[13404] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 814 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 16 01:57:30 1999

Date: Wed, 15 Sep 1999 22:05:09 -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: <937458309-v9-i814@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 15 Sep 1999     Volume: 9 Number: 814

Today's topics:
    Re: Can Perl talk to Javascript?? <sjs@yorku.ca>
    Re: Critique/comments for web board? (David Wall)
    Re: End Of File (Abigail)
    Re: End Of File (Larry Rosler)
    Re: End Of File (Kragen Sitaker)
    Re: Forcing Variable interpolation of string read from  (Philip 'Yes, that's my address' Newton)
    Re: How do I delete apostraphe from a string? (Kragen Sitaker)
        How to delete previous four lines and handle a header i <donotspam@me.ca>
    Re: How to delete previous four lines and handle a head (Larry Rosler)
        How to handle hang problem <chansam@worldnet.att.net>
    Re: how to hide secured info? <nickread@primus.com.au>
    Re: How to validate a URL? (Kragen Sitaker)
        Installing Tk module failed. Please help. <zzhang@bayou.uh.edu>
    Re: need to write www search engine (Benjamin Franz)
        Net::Ping problem <bfb@att.net>
    Re: Newbie Help:  Syntax of Perl Command <kmonte@columbus.rr.com>
    Re: Newbie Help:  Syntax of Perl Command <bowman@montana.com>
        Opportunity for Perl or Linux Programmer <todd.rovito@stargate-tech.com>
    Re: Parsing Tab Delimited File (Larry Rosler)
    Re: PERL (cgi) and Databases -> How To? (Abigail)
        Perl + ICQ <hiller@email.com>
    Re: script to dynamically produce standard calender (Kragen Sitaker)
    Re: script to dynamically produce standard calender (Larry Rosler)
    Re: Text Parsing - How to Multi-Line? <tchrist@mox.perl.com>
    Re: Text Parsing - How to Multi-Line? (Larry Rosler)
        Tk.pm <blake_star@email.msn.com>
    Re: trimming spaces from a string (Larry Rosler)
    Re: trimming spaces from a string (Abigail)
    Re: Two dimensional array <bie@connect.ab.ca>
    Re: Two dimensional array (Abigail)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 15 Sep 1999 22:47:32 -0500
From: Steven Smolinski <sjs@yorku.ca>
Subject: Re: Can Perl talk to Javascript??
Message-Id: <m3zoynwm97.fsf@hank.yorku.ca>

abigail@delanet.com (Abigail) writes:

> wolflake (wolflake@xxorn.net) wrote on MMCCVI September MCMXCIII in

> Of course, if JavaScript program is being run inside a wowser, you need to
> figure out how to communicate with the wowser, not to JavaScript directly.

I know I'll regret this, but I cannot resist.  I'm familiar with the 
unfortunately-named "browser" family of applications; however, I've not
encountered a "wowser."  What is such a beast?

Steve


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

Date: Thu, 16 Sep 1999 02:22:47 GMT
From: darkon@one.net (David Wall)
Subject: Re: Critique/comments for web board?
Message-Id: <37e05478_1@news2.one.net>

In article <7rnome$ho2@dfw-ixnews19.ix.netcom.com>, ebohlman@netcom.com (Eric Bohlman) wrote:
>David Wall (darkon@one.net) wrote:
>: So...  comments, anyone?
>
>Based on a very cursory examination:
>
>1) You've got a concurrency problem when you're posting a message because
[the program doesn't keep a crucial file locked the whole time it's using it 
(my interpretation -dkw)]

Ah, I didn't notice that.  I think I'll follow your suggestion on adding an 
argument to one of my subroutines to keep the lock active.

>2) You're using symbolic references just to reduce typing.  This is a 
>false economy.  Use a hash instead, and use strict.

I'm not sure I understand offhand what you mean here.  I guess I shouldn't 
have done something like the following?

# grab the message fields and put them in their own variables
# so I don't have to type so much when maintaining this code
foreach $field ( keys %{$Messages{$id}} ) {
   $$field = $Messages{$id}{$field};
}

So instead I should just go ahead and use $Messages{$id}{$field}?  Hey, 
whatever happened to Laziness?  :-)  (Yeah, I know, you said it's a false 
economy.)

What's so bad about symbolic references?  [Time passes while I look it up in 
the Camel]  Hmm, I suppose I could accidentally mix up a hard and a symbolic 
reference, and then have one hell of a time figuring out the bug, eh?

Someone else suggested 'use strict' in an email message.  I plan to follow 
that suggestion, but I about half expect perl will barf all over the place the 
the first time I run it.  :-)  One of the things I really liked about Perl 
when I first started playing with it is the ability to use a variable without 
declaring it first.  Now it seems that even though I CAN do that, it's not 
good practice to do so.  Sigh....

>3) You could use here-document syntax in a lot more places than you 
>presently are.

Yeah, I sure could.  More false laziness, I guess.  I'm never sure which is 
uglier, here-documents, or all those backslashes in print statements.  I like 
here-documents, but they screw up the indenting of my code.  I suppose I could 
always space them over, but I want to keep whatever HTML I generate as minimal 
as possible (within reason);  I want pages to load *quickly*, none of this 
"scatter a half-dozen comments and useless tags everywhere" like some 
so-called wysiwyg HTML editors do.

>4) In your date-printing code, there are a couple places where you use an 
>if statement to zero-pad numbers.  Use sprintf or printf instead.

Ok.  Something else I didn't think of.

>The concurrency problem is the major issue I see, and your code is a lot 
>better-structured than many common CGI scripts.

Thanks!  I appreciate the time and comments!

David Wall
darkon@one.net



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

Date: 15 Sep 1999 21:43:15 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: End Of File
Message-Id: <slrn7u0mf2.i4j.abigail@alexandra.delanet.com>

eX-HTML (spam-me-sydneyfong@yahoo.com) wrote on MMCCVII September
MCMXCIII in <URL:news:7rpgrh$cun$1@lobster.vol.net>:
\\ could anyone tell me how to write the script like:
\\ 
\\ open (MYFILE, "test.dat");
\\ 
\\ while (*not end-of-file*) {
\\ 
\\ -*thescript*-
\\ 
\\ };
\\ 
\\ close MYFILE;
\\ 
\\ what should *not end-of-file* be in the script?


That's the wrong question. The answer would be eof, but you don't want
to test on eof. You want to read lines, and stop processing when there
are no more lines to read.

Look up the diamond operator. Or, for that matter, the -n switch.



Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


  -----------== 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, 15 Sep 1999 19:51:33 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: End Of File
Message-Id: <MPG.1249fb107ee052a7989f83@nntp.hpl.hp.com>

In article <7rpgrh$cun$1@lobster.vol.net> on Thu, 16 Sep 1999 09:29:45 
+0800, eX-HTML <spam-me-sydneyfong@yahoo.com> says...
> could anyone tell me how to write the script like:
> 
> open (MYFILE, "test.dat");

Always test the result of an open().  And include $! in the diagnostic.  
Always, always, always...
 
> while (*not end-of-file*) {
> 
> -*thescript*-
> 
> };
   ^
   useless semicolon
 
> close MYFILE;
> 
> what should *not end-of-file* be in the script?

   while (<MYFILE>) { ... }

which reads the lines one at a time into $_, until there are no more 
lines.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 16 Sep 1999 02:58:23 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: End Of File
Message-Id: <j1ZD3.13897$N77.1018252@typ11.nn.bcandid.com>

In article <7rpgrh$cun$1@lobster.vol.net>,
eX-HTML <spam-me-sydneyfong@yahoo.com> wrote:
>what should *not end-of-file* be in the script?

<MYFILE>, which will also read the next line into $_.  Read perldoc
perlop, especially the section about I/O operators.  Also consider
reading the FAQs.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Sep 14 1999
55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Thu, 16 Sep 1999 04:05:06 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: Forcing Variable interpolation of string read from a file - How?
Message-Id: <37df250e.639243290@news.nikoma.de>

On Tue, 14 Sep 1999 22:26:42 +0200, Frank de Bot <debot@xs4all.nl>
wrote:

>$name = "My name";  # Not important here...
>$today = "Genius";
>
>$file[0] =~ s/$name/$today/g;  #Replaces every "$name" in the variable with
>$today

The comment is wrong. This replaces every occurence of the string "My
name" with the string "Genius". It leaves the string '$name'
completely alone.

See also Tom Christiansen's post for more advice on how to do it.

>(Note. This script isn't yet debugged....)

I noticed. Please don't post buggy code.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.net>


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

Date: Thu, 16 Sep 1999 03:04:24 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: How do I delete apostraphe from a string?
Message-Id: <Y6ZD3.13909$N77.1018787@typ11.nn.bcandid.com>

In article <37E03038.9855C88F@mail.cor.epa.gov>,
David Cassell  <cassell@mail.cor.epa.gov> wrote:
>Kragen Sitaker wrote:
>[snip]
>> On the other hand, you can't delete things with regular expressions.
>                            ^^
>A tiny typo, as shown by Kragen's next line:
> 
>> If you want to delete the first apostrophe, you can s/'//.

No, I'm deleting the apostrophe with the s/// operator.  The regular
expression is only matching it so s/// can delete it -- it is a
pacifist construct itself and does not engage in modification of text.
:)
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Sep 14 1999
55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Thu, 16 Sep 1999 04:26:02 GMT
From: "Mike" <donotspam@me.ca>
Subject: How to delete previous four lines and handle a header in a streaming input?
Message-Id: <uj_D3.10$P4.3187@news1.frmt1.sfba.home.com>

Hi all,

I'm trying to write a script that reads a text file and begins a
line-by-line search
*AFTER* a header is matched (and just reprints everything to stdout).  There
are two tricks to this:

1.  I want the script to be able to simply reprint all lines *EXCEPT* for
when one
certain pattern is matched on a line, in which case I want that line and
previous
three lines to not be printed out.
2.  I want to be able to do this on a *VERY* large file (~300MB).

I've been thinking that because of a large file, I should just use stdin as
in a
while(<>) statement.  My problem is, I don't know how to process the file
line-by-
line and be able to remember the previous four lines (i.e. my brain is fried
trying
to make a loop to handle this).  Can anyone help?

Thanks in advance,
Mike




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

Date: Wed, 15 Sep 1999 21:54:41 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to delete previous four lines and handle a header in a streaming input?
Message-Id: <MPG.124a17eca537859f989f8a@nntp.hpl.hp.com>

In article <uj_D3.10$P4.3187@news1.frmt1.sfba.home.com> on Thu, 16 Sep 
1999 04:26:02 GMT, Mike <donotspam@me.ca> says...
 ...
> I've been thinking that because of a large file, I should just use stdin as
> in a
> while(<>) statement.  My problem is, I don't know how to process the file
> line-by-
> line and be able to remember the previous four lines (i.e. my brain is fried
> trying
> to make a loop to handle this).  Can anyone help?

Your newsreader software is seriously dain-bramaged.

my @list;

while (<>) {
    push @list, $_;
    shift @list if @list > 4;
}

 ...

And @list holds the final <=4 lines of the file.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 15 Sep 1999 22:42:34 -0400
From: "Sam Chan" <chansam@worldnet.att.net>
Subject: How to handle hang problem
Message-Id: <7rpm35$nhu$1@bgtnsc01.worldnet.att.net>

I am using perl on NT system. Sometimes, I am accessing registry and the
system hangs. Do you know how to stop the process and move on the next line
?




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

Date: Thu, 16 Sep 1999 13:35:51 +1000
From: "Nick Read" <nickread@primus.com.au>
Subject: Re: how to hide secured info?
Message-Id: <937456459.841877@diddley.primus.com.au>

Hi,

>I want to hide oracle login id and password in perl code. Is it
> possible?

I suggest you take up writing JAPH's, only in your case, you'd be writing
JAOL's (Just Another Oricle Login)

Best Regards,
Nick Read

==========================
"How many apples fell on Newton's head
before he got the hint!"

 -- Robert Frost
==========================





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

Date: Thu, 16 Sep 1999 02:17:06 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: How to validate a URL?
Message-Id: <CqYD3.13849$N77.1011750@typ11.nn.bcandid.com>

In article <37DFF87A.E960932D@tburg.net>,
Robert W. Byrd <tech@tburg.net> wrote:
>Amazing Abigail, just amazing!

It reminds me of the email-address regex in the appendix of Friedl's
regex book.  I suspect it was constructed by similar means.  (I haven't
read the whole book yet; maybe this regex appears in the book too.)
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Sep 14 1999
55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Wed, 15 Sep 1999 22:01:18 -0500
From: "zzhang" <zzhang@bayou.uh.edu>
Subject: Installing Tk module failed. Please help.
Message-Id: <7rpmfl$bqr$1@Masala.CC.UH.EDU>

I downloaded Tk800.015.tar.gz from a CPAN mirror site and saved it in an
empty directory. I used the following commands to decompress and unpack it:
    # gzip -dc Tk800.015.tar.gz | tar -xof -
In the newly-created directory Tk800.015, I used:
    # perl Makefile.PL
and I got the following error message:
    perl is installed in /usr/lib/perl5/5.00503/i386-linux okay
    PPM for perl5.00503
    Test Compiling config/signedchar.c
    Test Compiling config/Ksprintf.c
    Test Compiling config/tod.c
    Test Compiling -DTIMEOFDAY_TZ config/tod.c
    TZ gettimeofday()
    Using -L/usr/X11R6/lib to find /usr/X11R6/lib/libX11.so.6.1
    Cannot find X include files via /usr/X11R6/include
    Cannot find X include files anywhere at ./myConfig line 318.
    BEGIN failed--compilation aborted at Makefile.PL line 19.
The O.S. is Red Hat Linux 6.0.
Does anybody know what's wrong? Thanks.

Zhengdong Zhang
zzhnag@bayou.uh.edu




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

Date: Thu, 16 Sep 1999 04:55:16 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: need to write www search engine
Message-Id: <UK_D3.452$pd.42700@typhoon01.swbell.net>

In article <slrn7u0ihu.i4j.abigail@alexandra.delanet.com>,
Abigail <abigail@delanet.com> wrote:
>Benjamin Franz (snowhare@long-lake.nihongo.org) wrote on MMCCVII
>September MCMXCIII in <URL:news:CyWD3.246$pd.21650@typhoon01.swbell.net>:
>@@ [posted and mailed]
>@@ 
>@@ In article <7rp8ac$3ou$1@fddinewz.oit.unc.edu>,
>@@ Roger Jacques <channel@sunsite.unc.edu> wrote:
>@@ >I want to write a robot program that will search all www sites by 
>@@ >domain type and return the <title>.
>@@ 
>@@ >I would appreciate any help that would get me started.
>@@ 
>@@ 2) You are going to need a _LOT_ of disk space. 100,000
>@@    raw pages take roughly 800 megabytes of disk space before
>@@    indexing. So to store 6,000,000 pages prior to indexing
>@@    takes roughly 48 gigabytes. If you try to 'incremental'
>@@    it you will find there are algorithmic performance problems
>@@    with O(N^2) properties attached to making inverted indexes
>@@    that way. Bad juju. Do it as a single batch and it is
>@@    O(N log N).
>
>I don't understand the need to keep pages and run indexing algorithms
>on them if he only wants to extract the titles. Given that the title
>tends to be found in the beginning of the document, you don't even have
>to download all of the document. Unless of course you want to extract
>links from it; but then there's still no need to store the entire page.

Fair enough. Although I think it pretty pointless to scan all those
pages just to get the 40 odd bytes of the title. _DO SOMETHING_
with all that data you collected....After all you spent a _lot_
of resources to get it. It's like digging the Panama Canal 
- and then only sending a single rowboat through and filling it
back in. Keep the data. Then if you decide to send another ship 
through it is close to a billion times cheaper than the first one.

>@@ 5) You need a machine with a gig or two of memory for the indexer.
>
>What indexer?

He has to build an index by top level domain of domains and titles.
I suppose a bit map would work in this restricted case - only a couple
of hundred top level domains and circa six million systems. What does
that come out to in memory for efficiency? Something like 1/4 gig I
guess.... I still think it is a waste of resources to crawl all
those pages and then throw away 95% of the information of the
1% of the pages you don't discard completely.....

>@@ 7) Don't even think about trying this unless you have _substantial_
>@@    resources behind you.
>
>That was what I thought at first as well. Then I noted his email address,
>and realized that he may indeed have the resources.

Maybe so. 

--
Benjamin Franz


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

Date: Thu, 16 Sep 1999 00:51:39 -0400
From: Bernie <bfb@att.net>
Subject: Net::Ping problem
Message-Id: <37E0775B.59AFEE8F@att.net>


When attempting to run ICMP ping as setuid, I still receive
the error "icmp ping requires root privilege at ./test line 104".
So far, I've added the following to the beginning of the script:

$ENV{'PATH'} = '/bin:/usr/bin';
$ENV{'SHELL'} = '/bin/sh';
$ENV{'IFS'} = '';
$ENV{'ENV'} = '';

$> = 0;
$) = 0;

I'm also using #!/usr/bin/perl -T.

I then did a chmod 4755 ping.pl, and changed the
UID and GID to root.

What am I doing wrong?

-Thanks




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

Date: Wed, 15 Sep 1999 22:42:33 -0400
From: "kmonte" <kmonte@columbus.rr.com>
Subject: Re: Newbie Help:  Syntax of Perl Command
Message-Id: <YKYD3.11234$mo.404896@viper>


B.J.G. <Ghassemlou@home.com> wrote in message
news:cSWD3.37245$kL1.417741@news2.rdc1.on.home.com...
> Q1- I need to find out to exit a "ForEach" loop!
>         is there such a thing like:
>         ForEach $elem (@Array) [Until ...] {...}
sure. foreach, while, until...
> Q2- Where can I get a document which list the syntax of all Perl Command.?


> Thank everyone
> bGhassemlou@yahoo.com
>
>
>
>
>




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

Date: Wed, 15 Sep 1999 20:44:11 -0600
From: bowman <bowman@montana.com>
Subject: Re: Newbie Help:  Syntax of Perl Command
Message-Id: <37E0597B.33521389@montana.com>

B.J.G. wrote:
> 
> Q1- I need to find out to exit a "ForEach" loop!
>         is there such a thing like:
>         ForEach $elem (@Array) [Until ...] {...}

look at 'last', 'next', and 'redo'.  



> Q2- Where can I get a document which list the syntax of all Perl Command.?


man perlsyn



-- 
Bear Technology  Making Montana safe for Grizzlies

http://people.montana.com/~bowman/


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

Date: Thu, 16 Sep 1999 00:25:45 -0400
From: "Todd V.Rovito" <todd.rovito@stargate-tech.com>
Subject: Opportunity for Perl or Linux Programmer
Message-Id: <37E07149.91FE1DD@stargate-tech.com>

I am not a recruiter I am a programmer and my company Viox Services is
currently in search for another programmer. We have a terrific
opportunity for someone with any skills in Linux, Perl, Apache, VB,
MySQL, AS/400, and Crystal Reports,  but we are more interested in
someone who is willing and able to learn quickly. Viox Services is a
fifty year old Cincinnati based firm that performs Facility Management.
One of our core functions is the processing and reporting of Facility
data for our customers.  We have a open environment and would give a
programmer the freedom to use their creative skills to solve our
customer's business problems.  The full range of benefits are offered
Vacation, 401K, Dental, Health, company paid training, and many more.
If interested please contact me:

Todd Rovito
513-679-3261
todd.rovito@viox-services.com
todd.rovito@stargate-tech.com






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

Date: Wed, 15 Sep 1999 19:43:37 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Parsing Tab Delimited File
Message-Id: <MPG.1249f9389539354e989f82@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <37e04926@cs.colorado.edu> on 15 Sep 1999 19:34:30 -0700, Tom 
Christiansen <tchrist@mox.perl.com> says...
 ... 
> I make no claims of inevitably:  I no more pretend it impossible under
> Unix to create a file in a format as annoying to parse as were those
> from my original posting than do I allege that all non-Unix systems
> should be somehow fated to generate files inherently cumbersome to
> process.  I simply relate my own previous experiences and consequent
> perceptions--which, being clearly anecdotal, are more illustrative
> than probative.  Nevertheless, should this matter prove itself to be
> in fact as it would otherwise in appearance suggest, this then would
> be minor mystery whose explanation I confess myself somewhat reticent
> to speculate upon.  I am certainly open to entertaining any hypotheses
> you or others might offer up.

Prejudice???  :-)

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 15 Sep 1999 21:52:08 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: PERL (cgi) and Databases -> How To?
Message-Id: <slrn7u0mvo.i4j.abigail@alexandra.delanet.com>

LynchMan (lynchmanNOpaSPAM@cyberenet.net) wrote on MMCCVI September
MCMXCIII in <URL:news:0b51f39f.f8b3f1be@usw-ex0102-012.remarq.com>:
"" Hey,
"" I am curently developing some PERL Cgi scripts, and I want
"" to get into using a database with my scripts.  I was
"" wondering where I should start.  I use my ISP to host my
"" pages (it is a unix box).  So basically I was wondering what
"" database program I should use, and how do I connect to it
"" using perl.  I am running a Linux box at home, so what I am
"" really looking for is some database that I can create
"" locally, then upload it to the server and be able to have
"" the scripts (which are running on the sever) hit it on a
"" needs be basis.  My main concern is what my ISP will
"" support.  I don't think they will install any modules for me
"" or a new database driver, so what types would a typical unix
"" ISP box support? 

What your ISP will do, and not do, is not something we can answer
here. Call 1-888-429-8638 for more information. Do you however not
need your ISP to install modules, but you knew that, because you
read the FAQ, didn't you?

As for what database to use, well, that of course depends what you want
to do. Since you're not saying, how can we say? But deciding which
database to use isn't a Perl question, it's better asked in a group
dealing with databases.

BTW, it's Perl, not PERL. And address munchers are lusers.


Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\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: Thu, 16 Sep 1999 02:45:09 GMT
From: Jordan Hiller <hiller@email.com>
Subject: Perl + ICQ
Message-Id: <37E059C9.203BDA69@email.com>

Hello,
Is there any sort of script or module to send ICQ messages and check ICQ
online status' from Perl?

Thanks in advance,
Jordan Hiller (hiller@email.com)


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

Date: Thu, 16 Sep 1999 02:50:13 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: script to dynamically produce standard calender
Message-Id: <FVYD3.13882$N77.994741@typ11.nn.bcandid.com>

In article <7rp0ko$pc$1@gellyfish.btinternet.com>,
Jonathan Stowe  <gellyfish@gellyfish.com> wrote:
>or at least started something like this and so I had - truly awful it is
>too - 

I have added comments showing where I think it could be improved a
bit.  But it's really quite good, IMHO.  (I don't suppose you could do
the same for the scripts I've posted?)

How long do the modules take to load?  CGI makes this more
consequential than it should be.

>
>my @stuff = localtime;

Hmm.  Perhaps @date would be a better name?  :)

>my $me = script_name;

Where is script_name defined?

>print header;

That's CGI::header?

>   $myear = $stuff[5] + 1900;
>   $mmonth = $stuff[4] + 1;

$myear makes sense.  Why are you adding 1 to $mmonth?  Oh, you want to
use 1-based months internally.  This would not be my choice :)

>my $weekday = Day_of_Week($myear,$mmonth,1);

 . . . but evidently Date::Calc uses 1-based months?

>my $this_month_name = Month_to_Text($mmonth);
>my $last_month_name = Month_to_Text($last_month);
>my $next_month_name = Month_to_Text($next_month);

>   my @tommorrow = Add_Delta_Days($myear,$mmonth,$this_day,1);

Yak, misspelled variable name!  Catch it, quick, before it runs away!

>   my $query_date = $myear . $mmonth . $this_day;

Perhaps this should be after the 'print'.

>   print <<OOLALA;

I like your choice of quotes :)

><HTML>
>  <BODY>

No DTD specified, and no <head>.  Against my preference.  I like my web
pages to validate.

All upper-case also violates my preference.

>  <P ALIGN=CENTER>
>  <TABLE BORDER=0 WIDTH=75%>
>    <TR WIDTH=75%>
>       <TD WIDTH=25% ALIGN=left>
>         <A
>HREF=$me?month=$yesterday[1]&year=$yesterday[0]&day=$yesterday[2]&type=detail>

No quotes on attribute containing funky chars.  Bad for validation.

I might try to factor the table-printing code a bit, if I were writing
it; I hate to type the same thing three times in a row, especially when
I'm editing somebody else's code.

>OOLALA
>
>my @fields;
>
>if ((@fields = date_query($query_date)) > 0 )

What is date_query supposed to do?

>    my $fields;
>    print <<EOGFG;
><TABLE WIDTH=100%>
>EOGFG
>   foreach $fields (@fields)
>     {
>       print <<EELPIE;
>        <TR WIDTH=100%>
>          <TD>
>            $fields->[1]
>          </TD>
>          <TD>
>            $fields->[2]
>          </TD>
>          <TD>
>            $fields->[3]
>          </TD>
>          <TD>
>            $fields->[4]
>          </TD>
>       </TR>
>EELPIE

You could say 
print '<tr width="100%">', 
	(map { 
		my $fields = $_;
		map { "<td>$_</td>\n" } @$fields
	} @fields), 
	"</tr>\n";

>print end_html;
>}
>else

That's a *big* if-consequent clause.  So big I'd forgotten I was in an
if clause.  Maybe the consequent should be factored into a separate
routine?

>{ 
>print <<EOW;
><HTML>
><BODY>
>  <P ALIGN=CENTER>
>  <TABLE BORDER=0 WIDTH=75%>
>    <TR WIDTH=75%>
>       <TD WIDTH=25% ALIGN=left>
>         <A HREF=$me?month=$last_month&year=$last_year>
>          $last_month_name $last_year

At this point, $last_year has become a misleading variable name :)

> <TABLE HEIGHT=75% WIDTH=100% BORDER=1 VALIGN=TOP ALIGN=LEFT>
>   <TR>
>     <TD WIDTH=14% BGCOLOR="gray" ALIGN=CENTER>
>       Monday
>     </TD>
>     <TD WIDTH=14% BGCOLOR="gray" ALIGN=CENTER>
>       Tuesday
>     </TD>

Yow.  map{} qw(Monday Tuesday Wednesday Thursday Friday Saturday Sunday)?

>for (0 .. 41)

41?  12 and 7 are magic numbers I can understand in the context of
calendars.  But 41?

>  {
>    my $dow = (($_ % 7) + 1 );

Hmm, 42 is 7*6.  0..41 must be six weeks.  (But no month includes parts
of more than five weeks, right?)

>    if ($dow == 1)
>      {
>        print "<TR>";
>      }
>    print "<TD WIDTH=14% VALIGN=top ALIGN=left>\n";
>   if ( ($_ >= $weekday - 1 ) && ($monthday <= Days_in_Month($myear,$mmonth )))
>     {
>       $monthday++;  
>       print "<A
>HREF='$me?type=detail&day=$monthday&year=$myear&month=$mmonth'>\n";
>       print $monthday;
>       print "</A>\n";

I don't like sequential print statements, and tend to combine them into
single print statements.

It also sort of looks like every month starts on Monday.  Did I miss
something?  Ahh, $weekday must be the weekday of the first of the
month.  It's sort of confusingly named.

> [sub neighbouring_periods]

Doing it functionally instead of imperatively gives (untested)

$last_year = $this_year - (($this_month == 1) ? 1 : 0);
$next_year = $this_year + (($this_month == 12) ? 1 : 0);

$last_month = ( ($this_month - 2) % 12 ) + 1;
$next_month = ( ($this_month) % 12) + 1;

If we use 0-based months, which would be my preference, this becomes

$last_month = ($this_month - 1) % 12;
$next_month = ($this_month + 1) % 12;

(with the obvious modifications made to $last_year and $next_year.)

(In Perl, % works correctly; in most programming languages, it usually
gives you negative values when your divisor is positive and your
dividend is negative.)

I don't know if this is better.  It's clearer to me that these are
correct, and it's certainly shorter.  Is it more readable to the
general audience?
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Sep 14 1999
55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Wed, 15 Sep 1999 21:48:30 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: script to dynamically produce standard calender
Message-Id: <MPG.124a167591623904989f89@nntp.hpl.hp.com>

In article <FVYD3.13882$N77.994741@typ11.nn.bcandid.com> on Thu, 16 Sep 
1999 02:50:13 GMT, Kragen Sitaker <kragen@dnaco.net> says...
> In article <7rp0ko$pc$1@gellyfish.btinternet.com>,
> Jonathan Stowe  <gellyfish@gellyfish.com> wrote:
 ...
> >my $me = script_name;
> 
> Where is script_name defined?

CGI.pm .  It is for people who find it too hard to type 
$ENV{SCRIPT_NAME} . :-)
 
> >print header;
> 
> That's CGI::header?

Where else?

 ...
> >for (0 .. 41)
> 
> 41?  12 and 7 are magic numbers I can understand in the context of
> calendars.  But 41?
> 
> >  {
> >    my $dow = (($_ % 7) + 1 );
> 
> Hmm, 42 is 7*6.  0..41 must be six weeks.  (But no month includes parts
> of more than five weeks, right?)

Wrong.

% cal 10 1999
   October 1999
 S  M Tu  W Th  F  S
                1  2
 3  4  5  6  7  8  9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31

 ...
> Doing it functionally instead of imperatively gives (untested)
> 
> $last_year = $this_year - (($this_month == 1) ? 1 : 0);
> $next_year = $this_year + (($this_month == 12) ? 1 : 0);

By now, no one will oppose the assertion that the value of a Boolean in 
arithmetic context is 1 or 0.  So:

  $last_year = $this_year - ($this_month == 1);
  $next_year = $this_year + ($this_month == 12);

 ...

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 15 Sep 1999 20:57:52 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Text Parsing - How to Multi-Line?
Message-Id: <37e05cb0@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, Scott Davis <scott@royallepage.com> writes:
:Newbie here.  I'm attempting to parse a multi-line input to a single
:line output.  Is this possible?  Any quick tips would be appreciated.

Print all line pairs where the first one ends in YIN and the next starts
with YANG.  This should suffice for your purposes.

--tom

while (<DATA>) {
    $n = /YIN$/ ... $n or next;
    $pair .= $_;
    1 - $n || next;
    /^YANG/ && print $pair;
    $pair = '';
} 
__END__
Yes, we know that we must continue.  You!
Search for the YIN
YANG with perserverence
you can gather, that we might then
have more
of happy YIN
YANG to play
with.
But what now if that 
YANG comes before
its following YIN
or if the very same line has 
YANG first and then YIN
all at once?  Can this YIN 
with that new YIN
YANG in a trio of harmony--
the one much delayed--still
play on?
One with YIN
Two with YIN
Three with YIN
YANG to finish.
And false at end: once more, to YIN
-- 
    It's documented in The Book, somewhere...
            --Larry Wall in <10502@jpl-devvax.JPL.NASA.GOV>


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

Date: Wed, 15 Sep 1999 21:38:33 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Text Parsing - How to Multi-Line?
Message-Id: <MPG.124a1420dab758bd989f85@nntp.hpl.hp.com>

In article <37E03425.7F63A5CF@cisco.com> on Wed, 15 Sep 1999 17:04:54 -
 ...
>                                 $line3 = <DATA>; # lose this line
>                                 $line4 = <DATA>; #lose this line
>                                 $line5 = <DATA> ;
>                                 $line6 = <DATA> ; #lose this line
>                                 $line7 = <DATA> ; #lose this line

                                           <DATA>; # lose this line
                                           <DATA>; #lose this line
                                  $line5 = <DATA> ;
                                           <DATA> ; #lose this line
                                           <DATA> ; #lose this line

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 15 Sep 1999 20:39:34 -0700
From: "blks" <blake_star@email.msn.com>
Subject: Tk.pm
Message-Id: <#zWqTW$$#GA.145@cpmsnbbsa02>

I have a couple of questions relating to PERL/TK.

First, is the Tk.pm module installed on a Linux 5.2 machine? and if so does
anyone know where?
Second, at the perl.com site (CPAN) their is a list of TK modules for PERL,
but which one should I get and install?
Third, if I install a new Tk.pm module, must I recompile PERL to use it?

Thank you everyone for your help;




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

Date: Wed, 15 Sep 1999 19:40:08 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: trimming spaces from a string
Message-Id: <MPG.1249f85bec19e844989f81@nntp.hpl.hp.com>

In article <slrn7u0jah.i4j.abigail@alexandra.delanet.com> on 15 Sep 1999 
20:49:38 -0500, Abigail <abigail@delanet.com> says...
 ...
>     s/^ +// + s/ +$// for ($s, $t);

Hmmm...

Useless use of integer addition in void context at ...

    s/ + /, /;

(as I posted earlier today).

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 15 Sep 1999 21:53:49 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: trimming spaces from a string
Message-Id: <slrn7u0n2t.i4j.abigail@alexandra.delanet.com>

Martien Verbruggen (mgjv@comdyn.com.au) wrote on MMCCVII September
MCMXCIII in <URL:news:xNXD3.112$E%1.6244@nsw.nnrp.telstra.net>:
\\ In article <7rpepc$m34$1@bgtnsc02.worldnet.att.net>,
\\ 	"Dolly & Will Cardwell" <wellhaven@worldnet.att.net> writes:
\\ > Thanks so much for all the helpful and educational responses. I want to
\\ > apologies that I did not intend to show an unequal number of embedded
\\ > spaces, and I do not want to discard them. Looking at the responses, I like
\\ > the following, but I'd like to combine the two statements into one. - which
\\ > I am still working on:
\\ > 
\\ > $s=~s/^ *//;
\\ > $s=~s/ *$//;
\\ 
\\ Don't combine them. One of the responses referred to the perlfaq.
\\ 
\\ # perldoc perlfaq4
\\ =head2 How do I strip blank space from the beginning/end of a string?
\\ 
\\ This explains why _not_ to combine the two.

It explains why not to combine them in a single _regex_, but all Dolly 
and Will want is to combine them in a single _statement_.

Of course, it's unclear to me what the benefit of that will be.



Abigail
-- 
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT


  -----------== 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, 15 Sep 1999 18:28:51 -0600
From: Tim <bie@connect.ab.ca>
Subject: Re: Two dimensional array
Message-Id: <37E039C3.103D@connect.ab.ca>

Like a Hash? (%)



Scott D. Wells wrote:
> 
> Does PERL have any kind of implimentation of two dimensional arrays?
> IE... like arrays in BASIC $junk(x,y).
> 
> Scott

-- 

-------------------------------------------------------
| TBE: http://tbe.virtualave.net                      |
| * 3:2 Ratio + 100 Free credits! *                   |
| Tim's Chat Doors: http://www.connect.ab.ca/~mundy/  |
-------------------------------------------------------


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

Date: 15 Sep 1999 21:55:51 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Two dimensional array
Message-Id: <slrn7u0n6n.i4j.abigail@alexandra.delanet.com>

Tim (bie@connect.ab.ca) wrote on MMCCVII September MCMXCIII in
<URL:news:37E039C3.103D@connect.ab.ca>:
%% Like a Hash? (%)

No, hashes have nothing to do with multi-dimensional arrays.

And don't post Jeopardy style. That's rude. And so is quoting
signatures. That's rude too. You were rude twice.

Go away.

%% Scott D. Wells wrote:
%% > 
%% > Does PERL have any kind of implimentation of two dimensional arrays?
%% > IE... like arrays in BASIC $junk(x,y).



Abigail
-- 
perl -wlpe '}{$_=$.' file  # Count the number of lines.


  -----------== 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: 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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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 814
*************************************


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