[11711] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5311 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 6 15:36:50 1999

Date: Tue, 6 Apr 99 12:00:25 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 6 Apr 1999     Volume: 8 Number: 5311

Today's topics:
    Re: $1 is not changed after second search (Karsten Patzwaldt)
    Re: [Q] Help Needed on map <cassell@mail.cor.epa.gov>
    Re: an IDE for perl program developing <cassell@mail.cor.epa.gov>
    Re: Anyone help with reading from data file?  Read here <prochae@diebold.com>
    Re: array question <cassell@mail.cor.epa.gov>
    Re: chmod - setting permissions with perl? <cassell@mail.cor.epa.gov>
    Re: Elegant parsing of HTML title and metatags? <jglascoe@giss.nasa.gov>
    Re: flocking question - worried (Abigail)
    Re: Help required urgently on CGI Perl <upsetter@ziplink.net>
    Re: here docs vs qq quote operator. Just personal prefe <cassell@mail.cor.epa.gov>
    Re: here docs vs qq quote operator. Just personal prefe <cassell@mail.cor.epa.gov>
    Re: How to "my" a file handle <cassell@mail.cor.epa.gov>
    Re: How to handle a ctrl-C interupt ? <jeff@co.mendocino.ca.us>
    Re: How to handle a ctrl-C interupt ? <jglascoe@giss.nasa.gov>
    Re: How to prevent Ctrl-C from <STDIN>? <jglascoe@giss.nasa.gov>
    Re: Internal Timer <eule@halifax.rwth-aachen.de>
    Re: Internal Timer <kueh@uiuc.edu>
    Re: Internal Timer (Larry Rosler)
    Re: Internal Timer (Larry Rosler)
    Re: Is Perl the right tool for the job <cassell@mail.cor.epa.gov>
        Is there any "Perl Editor "? Help t_alter@hotmail.com
    Re: leap year? <jglascoe@giss.nasa.gov>
    Re: Perl Question for generating HTML <cassell@mail.cor.epa.gov>
    Re: Premature end of script headers <ddelikat@protix.com>
    Re: Q: Error: No child processes <aqumsieh@matrox.com>
    Re: Q: Net::FTP, Timeout doesn't seem to work <herh@algonet.se>
    Re: Rand to Whole Number (Mike Wescott)
        Recursion in Perl <naik@omsi.com>
        setting env variables, sourcing, etc. <tom.kralidis@ccrsDotnrcandOtgc.ca>
        Signals Question <jeff@co.mendocino.ca.us>
    Re: Sorting lines. (Larry Rosler)
    Re: Tk.pm not installing properly on NT <tripix@tdi-net.freeserve.co.uk>
    Re: Unpack Question <ddelikat@protix.com>
    Re: Where can i find Net::SMTP for ActivePerl <cassell@mail.cor.epa.gov>
        Which text editor should I use gabriel_john_cohen@my-dejanews.com
    Re: Which text editor should I use (Jordan I. K. McClure)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 6 Apr 1999 19:10:31 +0200
From: kpa@gmx.net (Karsten Patzwaldt)
Subject: Re: $1 is not changed after second search
Message-Id: <slrn7gkg07.oo3.kpa@snerf.local>

In article <1dpqrnb.j95b1h1n14x8gN@p89.tc3.state.ma.tiac.com>, Ronald 
J Kimball wrote:
>You print $1 each time the second match fails.  As documented, $1 et al.
>are only set by a _succcesful_ match.  There's no point in printing $1
>again after an unsuccessful match.

But it is used a third time when its value is assigned to $endtime, and
it is still the same there. Your code didn't fix it, $starttime and
$endtime are still the same.

-- 
Der groesste Feind des Fortschritts ist nicht der Irrtum, sondern die
Traegheit.                                    -=- Henry Thomas Buckle
OpenPGP Key: 4096 / 4138 97ED 3C83 7D94 44CC 6B25 BD9F C12D 72A1 DE6F
erhaeltlich bei hkp://wwwkeys.de.pgp.net -=- OpenPGP-Mail erwuenscht!


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

Date: Tue, 06 Apr 1999 10:11:55 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: [Q] Help Needed on map
Message-Id: <370A405B.1E4CDAEB@mail.cor.epa.gov>

Jonathan Feinberg wrote:
> effie@effierover.com (Effie Rover) writes:
> > I've looked at my Perl books and at some examples online, and can't
> > seem to get my head around the map function.
> 
> Have you read the documentation for map()?
> 
>   perldoc -f map

But to be fair, map() is non-trivial for a lot of people.  Not
everyone has a CS background and experience with lisp.  My advice
is to start with the docs that come with Perl, but then be prepared
to go to DejaNews and look through old c.l.p.m. posts for examples.
The more examples you find [and then play with in the privacy of
your cpu], the better a feel you'll have for map().  And grep(),
for that matter.  But they're worth learning about.

And I won't even mention the dreaded Schwartzian Transform...  :-)

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 06 Apr 1999 11:25:31 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
To: Jin Shunyao <jinsy@iname.com>
Subject: Re: an IDE for perl program developing
Message-Id: <370A519B.F40828B5@mail.cor.epa.gov>

Jin Shunyao wrote:
>
> Hi,
>
> Does there have any tool that can manage perl source code like cscope
> for language C?
 
I believe you can go to www.activestate.com and pay real cash
dollars for an IDE.  But most Perlites are satisfied with a mere
text editor or a programming editor.  Perl doesn't have the 
write-compile-link-curse-debug cycle of C, so some of the 
features of an IDE aren't needed.

> Pls also reply to this email address mailto:jinsy@iname.com :)

Done.

> Thanks,
> 
> Jin.

And thank you for not mucking up your e-mail address.
 
David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 6 Apr 1999 14:43:16 -0400
From: "Ed Prochak" <prochae@diebold.com>
Subject: Re: Anyone help with reading from data file?  Read here.
Message-Id: <7edkmk$j4l57@news.diebold.com>


Easiest would be to read it all in and reverse it:

open (HEADERREAD, "$file3") or die "Unable to open $file3" ;

@lines = <HEADERREAD>;
reverse(@lines);

while ($line = shift(@lines)
{
 . . .

(I think I got all the syntax right.)




Freaky wrote in message <370a2bfe@news.greatbasin.net>...
>Does anyone know how to read a data file in reverse order? I use the format
>open (HEADERREAD, "$file3") or die "Unable to open...
>and it will only read in normal order.  Im just curious if theres a way to
>reverse it.  Thanks.
>
>--
>+++++++++++++++++++++++++++++++++++++++++++++++
>     Freaky - warfreak@nospam.psynet.net
>     Sharing My Opinion To Better Humanity
>     Remove NoSpam In My E-Mail Address To E-Mail Me.
>+++++++++++++++++++++++++++++++++++++++++++++++
>
>




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

Date: Tue, 06 Apr 1999 10:55:49 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: array question
Message-Id: <370A4AA5.55F39A34@mail.cor.epa.gov>

Dmitry Epstein wrote:
> 
> On 6 Apr 1999 05:37:27 GMT, sholden@pgrad.cs.usyd.edu.au (Sam Holden)
> wrote:
> >>$file_extention = /\..*?$/; # (Assuming that $_ is the file name)
> >
> >You sure you just want to set it to 1 if the file has a . in it?
> >
> >If you meant to capture the result then maybe some ()s and a look in
> >$1 would be useful.
> >
> >It's wrong anyway, in that it given the filename 'foo.bar.txt' it matches :
> >'.bar.txt'.
> 
> Oops!  What was I thinking?!  OK, the following works (in both cases):
> 
> ($file_ext) = /\.([^.\/]*)$/;

Or for real convenience [and portability, if that is important]
learn to:

use File::Basename;
 
David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 06 Apr 1999 11:57:51 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: chmod - setting permissions with perl?
Message-Id: <370A592F.1076C27F@mail.cor.epa.gov>

Tom Kralidis wrote:
> 
> You can try
> 
> system("chmod 755 ../test/jpg");

Well, you can *try* it, but you might not like the results.
Perl will read 755 as decimal, not octal.  Put the '0' back
in front of the '755' and Perl (and you) will be happier.
 
> File permissions, AFAIK, are 3 digits (owner, group, public)

Yep.  But they're still octal.
 
> Hope this helps
> 
> ..Tom
> --------------------------------------------------------------------------------------------
> Tom Kralidis                                                    Canada Centre for Remote Sensing
> Geo-Spatial Technologist                                        588 Booth Street , Room 241
> User Systems Development Section                                Ottawa , Ontario K1A 0Y7
> Data Acquisition Division                                       Tel: (613) 947-1828
> mailto:tom.kralidis@ccrs.nrcan.gc.ca                            Fax: (613) 947-1408
> 
>                               http://www.ccrs.nrcan.gc.ca
> --------------------------------------------------------------------------------------------

Yikes!  Your .sig wrapped madly on my newsreader.  That's a bit more
than 72 characters wide, isn't it?  :-)

> 
> Tim Lotz wrote:
> >
> > hi,
> >
> > i'm trying to change the permissions from a file in my www-directory
> > from 0600 to 0755.
> > i tired the following script (plus thousand different scripts):
> >
> > chmod(0755, '../test.jpg');
> > print "done";
> >
> > it doesn't work.
> > does anybody knows why?
> > my book says, that this is the way to do it. does it lie:)?
> >
> > thanx for your help.
> >
> > sunny greetings from hamburg!
> > tim

You might try an absolute path instead of a relative path.  Your
book isn't lying to you.  But on webservers there are other issues.
You might take a look at the hints in the ruthlessly-named-but-
still-quite-useful 
   http://www.perl.com/perl/faq/idiots-guide.html
and see if that helps.
 
David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 06 Apr 1999 13:20:24 -0400
From: Jay Glascoe <jglascoe@giss.nasa.gov>
Subject: Re: Elegant parsing of HTML title and metatags?
Message-Id: <370A4258.EB9FB4E2@giss.nasa.gov>

# wait, let me try that again.

use strict;

my $s = do {
    local ($/, *FH);
    open FH, "< index.html" or die $!;
    <FH>;
};

my ($title) = ($s =~ m{<TITLE>(.*?)<\/TITLE>}is);
my %metas = 
    map { s/^\s*["']?//; s/["']?\s*$//; $_ }
        map { /NAME\s*=(.*?)CONTENT\s*=(.*)/is, ($1, $2) }
            $s =~ m#<META([^>]+)#gis;

print "title: '$title'\n";
print "metas:";
	   
while (my ($k, $v) = each %metas) { print "\t'$k' => '$v'\n" }

	Jay Glascoe


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

Date: 6 Apr 1999 17:33:07 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: flocking question - worried
Message-Id: <7edggj$h7r$1@client2.news.psi.net>

Chris Denman (c-denman@dircon.co.uk) wrote on MMXLIV September MCMXCIII
in <URL:news:3709cc2e.0@glitch.nildram.co.uk>:
== Hi group,
== 
== Something is playing on my mind, and I hope someone out there can put my
== mind at rest.
== 
== I have a simple counter file, which increases by one, and can be increased
== by anyone at any time.

How do you do that? Increasing a file that is.

== The flocking side of things is not a problem, I am just worried what happens
== when a file is locked and the server crashes before the file is unlocked.

If the server shuts down, whether normally or abnormally, everything that
keeps track on which files are locked is gone. And since it's non-persistent
information, it's gone after reboot.

Though I wouldn't be surprised if there's some OS and/or filesystem out
there that has persistent locks.

Note that this isn't a Perl question, but a question specific for the 
system you run Perl on.


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: Tue, 06 Apr 1999 17:22:23 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Help required urgently on CGI Perl
Message-Id: <jprO2.49$i06.6493@news.shore.net>

Arnab Guin <arnab@india.ti.com> wrote:
: I have created a homepage which uses forms extensively .All my scripts
: are in Perl and they work from my directory .However , when I tried to
: upload all my files to Tripod[homepage builder] , I am facing grave
: problems because I do not know about the Perl location there .Can anyone
: advise me what to do about this ?

Do you know for a fact that Tripod allows you to install cgi scripts? 

The first thing to do would be to call or email them and ask them where
perl is installed.

If that doesn't work, try a CGI script like this:

#! /bin/sh

echo "Content-type: text/plain\n";

whereis perl
which perl

: One solution is convert all Perl scripts to Javascript but this hardly
: is a solution I think .

That solution would probably be less than optimal. Good luck.

--Art
-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: Tue, 06 Apr 1999 11:08:45 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: here docs vs qq quote operator. Just personal preference?
Message-Id: <370A4DAD.B6D6ECE9@mail.cor.epa.gov>

Tad McClellan wrote:
> Uri Guttman (uri@home.sysarch.com) wrote:
> : here docs are called that because of their ancestry from sh. there they
> : were documents that were 'here' and not in a file, that were fed into
> : stdin. perl uses them as alternative string quotes and should use a
> : different name. i have seen word/line delimited/quoted strings. any
> : ideas on a better term for them?
> 
>    "there docs"?
> 
>       It is there <pointing>, between the delimiter strings.
> 
>    "their docs"?
> 
>       It is there <pointing>, in someone else's code.
> 
>    "they're docs"?
> 
>       An existential form of quoting.

Or, in light of the frequently-asked questions I have seen lately:

"there're docs???"

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 06 Apr 1999 11:10:50 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: here docs vs qq quote operator. Just personal preference?
Message-Id: <370A4E2A.6414AB03@mail.cor.epa.gov>

Ronald J Kimball wrote:
> 
> David Delikat <ddelikat@protix.com> wrote:
> 
> >Abigail wrote:
> > >
> > <snip>
> > >Abigail
> > >--
> > >perl -wleprint -eqq-@{[ -eqw\\\\- -eJust -eanother -ePerl -eHacker -e\\\\-]}-
> >
> > OK, what's up Abigail, that one didn't work.  I just copy and paste
> > in another X session and it gives me lots of perl errors.
> 
> Too many backslashes again.  Abigail seems to have a bad habit of creating
> clever JAPHs, then posting them without testing the final edits.
> 
> Either that or Abigail has a really weird shell.  :)

Oh.  Thank heavens, I was afraid she was running it through
Python first.  :-)

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 06 Apr 1999 10:18:22 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: How to "my" a file handle
Message-Id: <370A41DE.D5E5B456@mail.cor.epa.gov>

Pedro Garrett wrote:
> I read the FAQ on how to "local" a file handle, but how do I "my" one?  Or
> is there maybe no reason to do this?
> 
> Thanks,

Not only is there 'no reason to do this', but there is an excellent
reason *not* to.  In fact, the documentation clearly says:
  "Only simple scalars or complete arrays and hashes may
   be declared this way."

Do not my() any filehandles, please.  Your example is one of the
few remaining reasons to use local().
 
David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 6 Apr 1999 11:22:48 -0700
From: "Jeff Kirk" <jeff@co.mendocino.ca.us>
Subject: Re: How to handle a ctrl-C interupt ?
Message-Id: <7edjjt$ck6$1@ultra.sonic.net>

Use this:

 $SIG{INT} = \&HandleThis

sub HandleThis {
}

This calls a subroutine you define called HandleThis.  You can place code in
there to handle the file problem.  Optionally you can use $SIG{INT} =
'IGNORE' to ignore the Ctrl-C Signal altogether.

Jeff

Wim Janssen <janssen@caos.kun.nl> wrote in message
news:370A1B17.C6F1A85F@caos.kun.nl...
> Lectori Salutem,
>
> How do I handle an interupt like ctrl-C in a perl-script.
>   In the program a temporary file is opened.
>   When the program is normally ended this file is removed.
>   But if the user types a ctrl-C the excecution is stopped
>   and that temporary file is not removed.
> Thanks for your help !!!
>                                                                   Wim
>
> -
> -----------------------------------------------------------------------
>  University of Nijmegen     Phone: +31(0)24-3653387    *  Wim Janssen  *
>  department:  CAOS/CAMM     Fax:   +31(0)24-3652977    -----------------
>  Toernooiveld 1             E-mail: janssen@caos.kun.nl
>  6525 ED  Nijmegen          URL:    http://www.caos.kun.nl
>  -----------------------------------------------------------------------
>
>
>




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

Date: Tue, 06 Apr 1999 14:24:36 -0400
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Wim Janssen <janssen@caos.kun.nl>
Subject: Re: How to handle a ctrl-C interupt ?
Message-Id: <370A5164.741116C@giss.nasa.gov>

[courtesy copy of post sent to cited author]

Wim Janssen wrote:
> 
> How do I handle an interupt like ctrl-C in a perl-script.

see perlfaq8: "How do I trap control characters/signals?"

	Jay Glascoe


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

Date: Tue, 06 Apr 1999 14:24:34 -0400
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Fu Chin Liu <fuchin@mail.nwos.lucent.com>
Subject: Re: How to prevent Ctrl-C from <STDIN>?
Message-Id: <370A5162.35D5B1D5@giss.nasa.gov>

[courtesy copy of post sent to cited author]

Fu Chin Liu wrote:
> 
> Hi, how can we prevent users from using CTRL-C to quit perl program when
> it is
> waiting for users' input from <STDIN>?

see perlfaq8: "How do I trap control characters/signals?"

	Jay Glascoe


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

Date: Tue, 06 Apr 1999 18:56:32 +0200
From: joe <eule@halifax.rwth-aachen.de>
Subject: Re: Internal Timer
Message-Id: <370A3CC0.2679D5B7@halifax.rwth-aachen.de>

Alvin Yong wrote:
> 
> Hi,
>    I need some urgent help in perl...I wonder if I cld use an internal timer
> function or code one so I can execute my main program every 5 mins, do I
> have resort to writing a very large loop
I solved the same problem some days ago with a short loop using time():

$Time = time;
while((time - $Time) <= 5)  #5 == 5 sec.
 {
 }

It's not nice, but it works. I'm still searching for a better solution
 ...

Joe


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

Date: Tue, 6 Apr 1999 12:33:20 -0500
From: "Tony Kueh" <kueh@uiuc.edu>
Subject: Re: Internal Timer
Message-Id: <7edgj0$dik$1@vixen.cso.uiuc.edu>

Try:

wait 5; (or is it pause 5;) forgot. ;)

-Tony

joe <eule@halifax.rwth-aachen.de> wrote in message
news:370A3CC0.2679D5B7@halifax.rwth-aachen.de...
> Alvin Yong wrote:
> >
> > Hi,
> >    I need some urgent help in perl...I wonder if I cld use an internal
timer
> > function or code one so I can execute my main program every 5 mins, do I
> > have resort to writing a very large loop
> I solved the same problem some days ago with a short loop using time():
>
> $Time = time;
> while((time - $Time) <= 5)  #5 == 5 sec.
>  {
>  }
>
> It's not nice, but it works. I'm still searching for a better solution
> ...
>
> Joe




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

Date: Tue, 6 Apr 1999 10:38:44 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Internal Timer
Message-Id: <MPG.1173e67d684bf4da989849@nntp.hpl.hp.com>

In article <370A3CC0.2679D5B7@halifax.rwth-aachen.de> on Tue, 06 Apr 
1999 18:56:32 +0200, joe <eule@halifax.rwth-aachen.de> says...
> Alvin Yong wrote:
> >    I need some urgent help in perl...I wonder if I cld use an internal timer
> > function or code one so I can execute my main program every 5 mins, do I
> > have resort to writing a very large loop
> 
> I solved the same problem some days ago with a short loop using time():
> 
> $Time = time;
> while((time - $Time) <= 5)  #5 == 5 sec.
>  {
>  }
> 
> It's not nice, but it works. I'm still searching for a better solution

It's especially not nice if there are other programs competing for a 
portion of the CPU.

perldoc -f sleep

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


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

Date: Tue, 6 Apr 1999 11:25:56 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Internal Timer
Message-Id: <MPG.1173f193d5d3156298984b@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7edgj0$dik$1@vixen.cso.uiuc.edu> on Tue, 6 Apr 1999 12:33:20 
-0500, Tony Kueh <kueh@uiuc.edu> says...
> Try:
> 
> wait 5; (or is it pause 5;) forgot. ;)

No, it isn't either of those.  I posted what it is.

You have three options before posting:

1.  Test what you are about to post.
2.  Read the documentation for what you are about to post.
3.  Don't post.

Any of the three would have saved the Usenet some bandwidth and the 
University of Illinois at Urbana-Champaign some embarrassment.

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


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

Date: Tue, 06 Apr 1999 11:39:07 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Is Perl the right tool for the job
Message-Id: <370A54CB.B362E8E3@mail.cor.epa.gov>

William Sanns wrote:
>
> I've just come from a "microsoft" shop

nice escape!

>                                        and am now managing a web based
> remote data entry system.  We have a Java front end and Oracle (V7.3.4)
> on the back end.  We are currently running on AIX

Oh.  Sorry.  Maybe I was premature...

>                                                   but will migrate to
> Linux within the next 3 months.

nice escape!

>                                  Java is working fine for most of the
> client work, but there are many instances where I would just like to
> present the user with a "report" from the database in html format (I
> would have used ASP in my "previous life").  From what I've seen, Perl
> looks like its easy to pick up, but is it capable of creating a "dynamic
> length" html page (the page would have anywhere from 0 to n number of
> records returned to the user based on their selections).  We are
> considering PHP, but Perl seems more widely supported.

I would recommend looking into Perl's DBI module.  You'll find that
it [and the Oracle DBD] allows you to interface with Oracle and get the
output in a convenient, fast manner.  Then Perl can handle a dynamic
web page.  Check out Lincoln Stein's CGI.pm module.  These are free
at CPAN.  For serious speed, you might want to look into Apache's
mod_perl too...

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 06 Apr 1999 18:34:09 GMT
From: t_alter@hotmail.com
Subject: Is there any "Perl Editor "? Help
Message-Id: <7edk30$bgk$1@nnrp1.dejanews.com>

Hi All;

I am learning Perl. I am wasting too much time to write the page layout in
html. I wanted to know if there is any Perl Editor like Visual InterDev is for
ASP?

Thanks for your time.
Please inform at t_alter@hotmail.com

Tom

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 06 Apr 1999 13:35:29 -0400
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: du_bing@my-dejanews.com
Subject: Re: leap year?
Message-Id: <370A45E1.4BD00D70@giss.nasa.gov>

[cc'd cited author]

du_bing@my-dejanews.com wrote:
> 
> How to judge if the current year is a leap year or not in Perl?  There should
> be a formula.  Unfortunately I forgot.

use Time::Local;

sub is_a_leap_year {
    # based upon Abigail's profound idea that a 
    # year is a is a leap year if, and only if,
    # February is 29 days long
    my $year = shift() - 1900;
    (localtime timelocal 0,0,0,29,1,$year)[4] == 1;
}

	hth,
	;^)
	Jay Glascoe


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

Date: Tue, 06 Apr 1999 10:03:04 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Perl Question for generating HTML
Message-Id: <370A3E48.5EFE5C8C@mail.cor.epa.gov>

Tad McClellan wrote:
> 
> trimbleman@hotmail.com wrote:
> 
> : >    That is not a Perl question.
> : >    There is another newsgroup for discussing HTML:
> : >-   comp.infosystems.www.authoring.html
> 
> : thanks..i will cross post there..
> 
>    Don't do that.
> 
>    You should crosspost when your article is on-topic for
>    *all* of the crossposted newsgroups.
> 
>    HTML stuff is not on-topic for clp.misc, and so should not
>    be posted here at all.
> 
>    Perl stuff in not on-topic for ciwah, and so should not
>    be posted there at all.
> 
>    Post HTML questions to the HTML newsgroup.
> 
>    Post Perl questions to the Perl newsgroup.
> 
>    Post CGI questions to the CGI newsgroup.
> 
>    Simple (provided you can figure out what "kind" of question
>            you have)
> 
> : >    But if whitespace in HTML does matter, I'm still fairly
> : >    certain you can get what you want without formats.
> : > : >    print() with a here-doc is handy for outputting a block
>                           ^^^^^^^^
>                           ^^^^^^^^
> 
> : >    here-docs are just another form of quoting like single/double quotes.
> : >    Go read about it if you want to know about it.
> : Where do i go to read about it ??
> 
>    In the standard Perl docs that are already installed on your
>    hard drive.
> 
>    That is why I was careful to spell it in such a way that
>    you would find it when you looked for it.
> 
>    You aren't going to find it if you don't look though  :-)
> 
> grep here-doc *.pod
> 
> or, if you are on an impoverished system without grep:
> 
> perl -ne 'print "$ARGV: $_" if /here-doc/' *.pod
> 
> perldata.pod:A line-oriented form of quoting is based on the shell "here-doc"
> perldiag.pod:If you're getting this error from a here-document, you may have
> perldiag.pod:wish to use an empty line as the terminator of the here-document.
> 
>    Looks like perldata.pod talks about here-docs...

And that means that you'll want to read the perldata section that
came with your Perl installation [unless your sysadmin messed up].
At a command window, type 'perldoc perldata'.  Or if you have the
html docs and you prefer those, just scroll through the perldata
section until you get to here-docs.  Also, any dead-tree Perl 
reference worth its salt ought to cover this thoroughly.

HTH,
David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 06 Apr 1999 12:11:19 -0500
From: David Delikat <ddelikat@protix.com>
Subject: Re: Premature end of script headers
Message-Id: <370A4037.446B@protix.com>

Larry Rosler wrote:
> 
> [Posted and a courtesy copy mailed.]
> 
> In article <m1zp4mad7k.fsf@halfdome.holdit.com> on 05 Apr 1999 15:56:31
> -0700, Randal L. Schwartz <merlyn@stonehenge.com> says...
> > >>>>> "Larry" == Larry Rosler <lr@hpl.hp.com> writes:
> >
> > Larry> Can you point to a use of P[eE][rR][lL] as an acronym in any of the
> > Larry> official Perl docs?  I know it isn't in perlfaq1.
> >
> > You're gonna scream when you see how easy it is to answer you!
> >
> >     perldoc perl =>
> >
> >     NAME
> >          perl - Practical Extraction and Report Language
> >     [...]
> >          Perl actually stands for Pathologically Eclectic Rubbish
> >          Lister, but don't tell anyone I said that.
> 
> SCREEEEAM!!!!!   (But sssh -- it's a secret :-)
> 
> Now I'm frantically searching the Web and my bookshelf for anyplace
> where The Real Larry disavows that.  Help, anyone???
> 
> (The Blue Camel, p. 555, implies that it is a retro-acronym from
> 'Pearl', which is quite believable.  Basic is obviously such a beast,
> while Cobol and Fortran obviously are not.  And then there is C.  :-)
> 

my old perl 4 book mentioned all of the above.
apparently pearl was taken, so he used perl instead.

-dav

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

-- 
<((((><
Consultant: Internet, Database, Business Systems
Unix/Linux, Windows95/NT
mailto:david-delikat@usa.net / http://obj.webjump.com/


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

Date: Tue, 6 Apr 1999 11:20:59 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
To: anna@water.ca.gov
Subject: Re: Q: Error: No child processes
Message-Id: <x3ypv5hojvo.fsf@tigre.matrox.com>


[posted and CCed]

anna@water.ca.gov writes:

> Here's the snippet of code:
> --------------------------
> 
>   system "/usr/bin/lp -d$dest $fullfile > /dev/null 2>&1";  if ($?) {  print
> "<h1>? ! ?</h1> The print command returned an error number $?. This may be
> the problem: $!<br>\n";  print "Print command: /usr/bin/lp -d$dest
> $fullfile<br>\n";
> 
> 
> Here's the error output:
> ------------------------
> 
> ? ! ?
> 
> The print command returned an error number -1. This may be the problem: No
> child processes Print command: /usr/bin/lp -dhydroq1
> /db2/iodir/PRECIPSUM.1999

I am not exactly an expert here, but a look at the system()
documentation shows:

-------
=item system LIST
 
Does exactly the same thing as "exec LIST" except that a fork is done
first, and the parent process waits for the child process to complete.
-------

Checking the manpage of fork(), we can find the following reasons for
failure: 

-------
ERRORS
     fork() fails and no child process are created if one or more
     of the following is true:
 
     EAGAIN         There are two conditions that will  cause  an
                    EAGAIN error.
 
                    The system-imposed limit on the total  number
                    of processes under execution by a single user
                    would be exceeded.
 
                    The total amount of system  memory  available
                    is temporarily insufficient to duplicate this
                    process.
 
     ENOMEM         There is not enough swap space
-------

Any of these reasons could be applicable to you?

HTH,
Ala



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

Date: Tue, 06 Apr 1999 19:59:18 +0200
From: Reine =?iso-8859-1?Q?H=E5lldin?= <herh@algonet.se>
Subject: Re: Q: Net::FTP, Timeout doesn't seem to work
Message-Id: <370A4B75.12E93794@algonet.se>

Hi,
I realy have no ide what so ever what to do about your problem with FTP
sorry.
But the reason I joined this list was that I am thinking of writing a small
perl scrip for to use on my home page, that would alowe me to download a
file of my choose to my /home on the server and eventualy send it via FTP
to my ftp server at home.
Just to utilize the bandwith usage.
No I might just ask you if you think this is possible?

Regards Reine Helldin

Kurt Gray wrote:

> I've written a simple perl FTP script that runs from Apache as a CGI.
> It uses the Net::FTP module to transfer files to a remote host.
>
> I have this problem: If the remote host does not respond
> to the FTP login request then the CGI script waits
> and waits then eventually dies.
>
>



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

Date: 06 Apr 1999 14:46:10 -0400
From: wescott@cygnus.ColumbiaSC.NCR.COM (Mike Wescott)
Subject: Re: Rand to Whole Number
Message-Id: <x44smtr3il.fsf@cygnus.ColumbiaSC.NCR.COM>

In article <19990405195240.06482.00002926@ng152.aol.com> immot5@aol.com (Immot5) writes:
> Excuse my ignorance, but is there anyway I can make the result of rand be a
> whole number between 1 and 1000?

Assuming that the range given is inclusive, what's wrong with

	$random_value = int(rand(1000.0)) + 1;

-- 
	-Mike Wescott
	 mike.wescott@ColumbiaSC.NCR.COM


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

Date: Tue, 06 Apr 1999 11:21:24 -0700
From: "Sameer G. Naik" <naik@omsi.com>
Subject: Recursion in Perl
Message-Id: <370A50A4.B858BD4C@omsi.com>

Hello Friends,

	Is it possible to have recursion in Perl ?
	I want to traverse directory tree recursively.
	Or is there any function which would traverse
	the given node and return all the filenames
	( like C function FTW ) ?

Thanks,
Sameer G. Naik.
naik@omsi.com


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

Date: Tue, 06 Apr 1999 14:32:41 -0400
From: Tom Kralidis <tom.kralidis@ccrsDotnrcandOtgc.ca>
Subject: setting env variables, sourcing, etc.
Message-Id: <370A5349.DBFC7D1C@ccrsDotnrcandOtgc.ca>

Hi, 

I have made a script to create a directory structure for day-to-day lab
operations.  It works fine, however, I tried setting an environment
variable in one of the directories, and when executing the script, I
received an error message.  I tried this with a simple 

system("cd tables;setenv TABLES $cwd");

and was not successful.

Does anyone know why this won't happen, or is there a better way to do
this?  Note that the env variable is for a directory generated by the
script itself.

Any advice is much appreciated

 ..Tom

--------------------------------------------------------------------------------------------
Tom Kralidis				      			Canada Centre for Remote Sensing
Geo-Spatial Technologist		      			588 Booth Street , Room 241 
User Systems Development Section	      			Ottawa , Ontario K1A 0Y7
Data Acquisition Division		      			Tel: (613) 947-1828
mailto:tom.kralidis@ccrs.nrcan.gc.ca    			Fax: (613) 947-1408
	              
                              http://www.ccrs.nrcan.gc.ca
--------------------------------------------------------------------------------------------


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

Date: Tue, 6 Apr 1999 11:26:29 -0700
From: "Jeff Kirk" <jeff@co.mendocino.ca.us>
Subject: Signals Question
Message-Id: <7edjqp$ckh$1@ultra.sonic.net>

Hi,

I have written a script for menuing on our applications box.  This keeps our
users away from the shell prompt and allows them access to their programs.
I can handle Ctrl-C signals, but my script will die if it recieves a Ctrl-Z.
How can I control this particular signal?  Thanks...

Jeff





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

Date: Tue, 6 Apr 1999 10:44:54 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Sorting lines.
Message-Id: <MPG.1173e7f14ced59f698984a@nntp.hpl.hp.com>

In article <370A3CAA.78EBB519@mail.cor.epa.gov> on Tue, 06 Apr 1999 
09:56:10 -0700, David L. Cassell <cassell@mail.cor.epa.gov> says...
 ...
> Answer #2: what you're really doing wrong is not using the Perl
> docs to their fullest.  Type 'perldoc -q sort' and get some fast
> guidance on sorting.. plus a URL to tchrist's guide to Far More 
> Than Everything You Ever Wanted To Know about sorting anything
> on anything.
 ...
> Umm, maybe I'll pass and let Larry or Sam or Tad comment on this code.

I did one week ago:

You should learn more about how to sort efficiently (i.e., not repeating 
the processing of each operand every time it is compared to another 
operand, but once each only).  After you have devoured the documentation 
at `perldoc -f sort`, continue with perlfaq4:  "How do I sort an array 
by (anything)?"

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


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

Date: Tue, 6 Apr 1999 18:54:00 +0100
From: "Wayne Keenan" <tripix@tdi-net.freeserve.co.uk>
Subject: Re: Tk.pm not installing properly on NT
Message-Id: <7edi7b$jip$1@news4.svr.pol.co.uk>


erm, this is really a perl question, however,
I had a similar problem, kept 'secretly' failing downloads; there was an
empty zip at the end

go to www.activestate.com/packages/zips






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

Date: Tue, 06 Apr 1999 12:29:35 -0500
From: David Delikat <ddelikat@protix.com>
Subject: Re: Unpack Question
Message-Id: <370A447F.794B@protix.com>

Jason Hissong wrote:
> 
> David Delikat wrote:
> 
> > using unpack to comunicate with C can be stessfull.
> >
> >
> > good luck
> >
> > -dav
> >
> > --
> > <((((><
> > Consultant: Internet, Database, Business Systems
> > Unix/Linux, Windows95/NT
> > mailto:david-delikat@usa.net / http://obj.webjump.com/
> 
> David,
> 
> Thanks for your information.  Assuming that the first 16 bits are the first
> unsigned short, and the next 32 bits were the long in my example structure,
> how would I access the sub-elements of that unsigned short?  i.e., I only
> want the first 5 bits in a scaler, the next 5 in another scaler, and then
> the last 6 bits in another scalar.  These bits are numbers:
> 
> 00011  00010 000111
> 
> The first set would be the number 3
> The second set would be the number 2
> The third set would be the number 7
> 
> I am wondering if I need to unpack them as binary bits:
> 
> "b5 b5 b6"
> 
> and then pack them somehow into something meaningful...
> 
> Your right, it can be stressful  :)
> 
> thanks
> 
> Jason


first, if there are bits in between, then you have to account 
for those in your unpack string.  every bit of information
MUST be accounted for save any trailing info you dont care about.

if your data looks like this:

0001100010000111

then 'b5 b5 b6' will do fine.

but if it looks like this:

00011XX00010X000111

then you need 'b5 b2 b5 b1 b6' and then ignore the 
ones you don't want.  At this point I'll say that
you should be careful if you are not taking your
data apart tha same way you put it together.  that
is, if you put unsigned shorts and longs, then
you should get unsigned shorts and longs back.
unless you are writing out network byte order, you
will not be portable if you try to grab only the
interesting 'bits' of information.

does this help?

-dav

-- 
<((((><
Consultant: Internet, Database, Business Systems
Unix/Linux, Windows95/NT
mailto:david-delikat@usa.net / http://obj.webjump.com/


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

Date: Tue, 06 Apr 1999 11:19:53 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Where can i find Net::SMTP for ActivePerl
Message-Id: <370A5049.9CE2673D@mail.cor.epa.gov>

agniora@usa.net wrote:
> To send emails through perl i need the Net::SMTP module, but it doesnt come
> with the standard distribution, does anyone know where i can find it ?
> agniora

You can find it at CPAN.  Go to www.perl.org and you'll get to the CPAN
multiplexer.  If you're running win32 Perl and you're worried about building
modules on your machine, go to www.activestate.com first.

BTW, you can find more info if you type 'perldoc -q CPAN'.  I bet
you're embarrassed that you forgot to check that first...  :-)

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 06 Apr 1999 18:07:47 GMT
From: gabriel_john_cohen@my-dejanews.com
Subject: Which text editor should I use
Message-Id: <7edihd$a47$1@nnrp1.dejanews.com>

Hello,

I'm trying to learn PERL on a linux machine.  Which text editor should I use?

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 6 Apr 1999 18:55:06 GMT
From: jimcclur@ews.uiuc.edu (Jordan I. K. McClure)
Subject: Re: Which text editor should I use
Message-Id: <7edlaa$h3s$1@vixen.cso.uiuc.edu>

gabriel_john_cohen@my-dejanews.com wrote:
: Hello,
: 
: I'm trying to learn PERL on a linux machine.  Which text editor should I use?

Appleworks.

-- 
I'm writing a book.  I've got the page numbers done.  -- Stephen Wright


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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 V8 Issue 5311
**************************************

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