[12795] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 205 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 20 20:07:25 1999

Date: Tue, 20 Jul 1999 17: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)

Perl-Users Digest           Tue, 20 Jul 1999     Volume: 9 Number: 205

Today's topics:
    Re: about the function "validate" <cassell@mail.cor.epa.gov>
    Re: Appeasing the Java and Perl naming gods (Mike Bristow)
    Re: basename regexp? <laurens@bsqaure.com>
    Re: basename regexp? (elephant)
    Re: basename regexp? (Randal L. Schwartz)
    Re: Calling Oracle Stored Procedures from PERL billpierce@my-deja.com
        Capture command output into list? <dennis.moreno@pop.safetran.com>
    Re: Capture command output into list? (brian d foy)
    Re: Check if 2 dates are in the same week <travis.cox@itron.com>
    Re: Check if 2 dates are in the same week (Anno Siegel)
    Re: Check if 2 dates are in the same week <cassell@mail.cor.epa.gov>
    Re: Future of Perl (Derek Bell)
    Re: getting the decimal portion of a floating point num <travis.cox@itron.com>
    Re: Hashes <cassell@mail.cor.epa.gov>
    Re: LD_LIBRARY_PATH and modules (Garth Sainio)
    Re: newbie question about fork (Anno Siegel)
    Re: Perl and Personal Web Server (Win98) <Webdesigner@NewWebSite.com>
    Re: Perl and Personal Web Server (Win98) <cassell@mail.cor.epa.gov>
        Perl CGI Performance <dortman@my-deja.com>
        Perl Database Question <dortman@my-deja.com>
    Re: Perl Database Question (brian d foy)
        perl on UNICOS <doug.henderson@pss.boeing.com>
    Re: perl's edge -- a beginner's question <keithmur@mindspring.com>
    Re: PGP and Mail (brian d foy)
        Porsche: Perl Programmer Please! (Help Wanted) <gstock@gstockco.com>
    Re: reading from a file and THEN! (Anno Siegel)
    Re: Skipping to next file using angle operator (Neko)
    Re: Unique IP Address Extraction (I R A Darth Aggie)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Tue, 20 Jul 1999 16:29:01 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: about the function "validate"
Message-Id: <3795063D.18D074F3@mail.cor.epa.gov>

bing-du@tamu.edu wrote:
> 
> Greetings all...
> 
> Basically, the following code snippet showed what I wanted to do.
> But seemed to me that the function 'validate' does not like variable.
> 
> #!/usr/local/bin/perl

Should be
  #!/usr/local/bin/perl -w

and you ought to add
  use strict;
as well.

> use File::CheckTree;
> $basedir = "/tmp";
> $warnings += validate( q{$basedir/file -e});

Oops. q// is single-quoting.  No variable interpolation.
Check out qq// instead.
 
> if (!$warnings)
> {
> print "file exists\n";
> } else {
>          print "not exists\n";
>        }
> 
> The outcome of the above code was "/$basedir/file does not exist".
> Obviously it was not correct.
> 
> If I changed to:
>  $warnings += validate( q{/tmp/file -e});
> 
> The outcome was "file exists" which was correct.

Right.  No variable interpolation needed here, which is
convenient when q// won't permit it.
 
HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 20 Jul 1999 23:27:10 GMT
From: mike@fat.dotat.at (Mike Bristow)
Subject: Re: Appeasing the Java and Perl naming gods
Message-Id: <slrn7pa1ed.pl.mike@lindt.fat.dotat.at>

On 20 Jul 1999 13:55:39 -0700, Bill Wohler <wohler@gbr.newt.com> wrote:
[Java vs Perl naming conventions for classes & modules]
>  I'd like to be able to put Bar.pm and Bar.java in the same
>  directory. 

Erm, why?

>  How do you resolve this dilemma? My thoughts would be to
>  follow the Java conventions and use lowercase package names. How
>  "bad" would it be to put Bar.pm in com/newt/foo and invoke it with
>  com::newt::foo?

Well, it depends on the reasons why you want to - personally
I can see no benefit for com.newt.foo.Bar and Com::Newt::Foo::Bar
to have their .java and .pm files in the same directoy.  But there
must be a reason - I just don't know what it is ;-)

And I can't see why Com.Newt.Foo.Bar shouldn't be a class name, either,
but I'm not a java guru  (IIRC the nameing convention was chosen to 
try and avoid namespace clashes and is based on the DNS owned by the
originating organisation: DNS is case insensitive so capitilizing the
class name elements won't cause problems).

-- 
Mike Bristow, Geek-At-Large.                GK/RM0501
one tequila - two tequila - three tequila - FLOOR !!!


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

Date: Tue, 20 Jul 1999 14:59:36 -0700
From: "Lauren Smith" <laurens@bsqaure.com>
Subject: Re: basename regexp?
Message-Id: <7n2rgt$40i$1@brokaw.wa.com>


Randal L. Schwartz wrote in message ...
>>>>>> "Lauren" == Lauren Smith <laurens@bsqaure.com> writes:
>
>Lauren> /([^\\]+)$/; #
>

> $scriptname = $1;


>No.  Never use $1 unless you've also checked the success or failure of
>the match that you think is matching.

>if your filename in $_ is "/foo/bar/", you've
>just sent the user on a debugging trip trying to figure out why $1 is
>some random string.

Maybe my perspective is OS centric, but my shell (Windows) won't let me name
files with slashes.  Slashes are directory (or flag) delimiters and the
shell gives a syntax error if I try to use them in a filename.  $0 should
never have a slash at the end.  Thus, the filename CAN'T be "/foo/bar/"
because it is not a valid filename.  "/foo/bar" is valid and
"/foo/bar/a.txt" is valid, but a valid filename never ends with a directory
delimiter.

This is not to say that I don't totally agree that I should be testing for
success, because I do.  But in this case, unless someone's been futzing
around with the contents of $0, the previous regex should work fine
(assuming of course that the regex is altered for the correct directory
delimiter).

Perhaps it could be better said:
$0 =~ /([^\\]+)$/;
$scriptname = $1;
print scriptname;

>Lauren> and if I'm unwilling to check my own code, then I am lost too.
>
>Better doublecheck next time. :)

Checked and tested and double checked and tested again.  (And soon I'll have
a foot in my mouth, I'm sure.  :-)

Lauren




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

Date: Wed, 21 Jul 1999 09:34:57 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: basename regexp?
Message-Id: <MPG.11ffb2ad61105cd5989b56@news-server>

Lauren Smith writes ..
>Perhaps it could be better said:
>$0 =~ /([^\\]+)$/;
>$scriptname = $1;
>print scriptname;
>
>Checked and tested and double checked and tested again.  (And soon I'll have
>a foot in my mouth, I'm sure.  :-)

how did you know ? .. you left the '$' off scriptname in your print 
statement .. aren't you able to copy-and-paste ?

-- 
 jason - remove all hyphens for email reply -


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

Date: 20 Jul 1999 17:02:56 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: basename regexp?
Message-Id: <m13dyix427.fsf@halfdome.holdit.com>


PLEASE don't mangle your From address. <sigh>
That's considered offensive to those of us trying to carry on a conversation.

>>>>> "Lauren" == Lauren Smith <laurens@bsqaure.com> writes:

Lauren> Randal L. Schwartz wrote in message ...
>>>>>>> "Lauren" == Lauren Smith <laurens@bsqaure.com> writes:
>> 
Lauren> /([^\\]+)$/; #
>> 

>> $scriptname = $1;


>> No.  Never use $1 unless you've also checked the success or failure of
>> the match that you think is matching.

>> if your filename in $_ is "/foo/bar/", you've
>> just sent the user on a debugging trip trying to figure out why $1 is
>> some random string.

Lauren> Maybe my perspective is OS centric, but my shell (Windows)
Lauren> won't let me name files with slashes.  Slashes are directory
Lauren> (or flag) delimiters and the shell gives a syntax error if I
Lauren> try to use them in a filename.  $0 should never have a slash
Lauren> at the end.

For this known data, you're right.  But people cut-n-paste code like
that into unknown places, and WILL GET BURNED.  A *general* basename
routine cannot presume that the pathname does not end in /.  That's
why I spoke up.  I'm rarely speaking to the poster, because the poster
almost always knows better. :)

Also remember, on Unix, $0 is arbitrary, having nothing at all to
do with the name of the program, except by convention.

So, perhaps you *are* OS centric. :)

print "Just another Perl hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Tue, 20 Jul 1999 22:28:14 GMT
From: billpierce@my-deja.com
Subject: Re: Calling Oracle Stored Procedures from PERL
Message-Id: <7n2t5e$adt$1@nnrp1.deja.com>

In article <7l68fr$fqu$1@grolsch.cse.psu.edu>,
  groenvel@cse.psu.edu (John D Groenveld) wrote:
> Oraperl.pm is a Perl5 module which provides
emulation for Kevin Stock's
> long-dead Perl4 extension oraperl. Oraperl.pm
actually uses DBI/DBD::Oracle.
> New versions of DBD::Oracle not only support
SPs, but also cursor variables.
>
I do not have the latest version, so my version
has NO documentation on how to call a procedure;
Particularly in/outs that are not scalars is this
possible? For example I want to run an oracle
proc and provide an input that then provides an
array as output?


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


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

Date: Tue, 20 Jul 1999 22:24:43 GMT
From: dennis <dennis.moreno@pop.safetran.com>
Subject: Capture command output into list?
Message-Id: <3794F730.6CCB797@pop.safetran.com>

I'm attempting to capture the output from the "groups" command and
compare each value one at a time.
When I run this code, the foreach loop is only run once and $g is
printed as a single string of group names.

#!/usr/local/bin/perl
    $name = "guest";
    @groups = (`/usr/bin/groups $name`);
    chomp(@groups);
    foreach $g (@groups) {
	if ($g eq "nobody") {
    	    print "$name is a member of $g\n";
	}
    }

What am I doing wrong??

Dennis


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

Date: Tue, 20 Jul 1999 18:38:40 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Capture command output into list?
Message-Id: <brian-ya02408000R2007991838400001@news.panix.com>

In article <3794F730.6CCB797@pop.safetran.com>, dennis <dennis.moreno@pop.safetran.com> posted:

> I'm attempting to capture the output from the "groups" command and
> compare each value one at a time.
> When I run this code, the foreach loop is only run once and $g is
> printed as a single string of group names.
> 
> #!/usr/local/bin/perl
>     $name = "guest";
>     @groups = (`/usr/bin/groups $name`);
>     chomp(@groups);
>     foreach $g (@groups) {
>         if ($g eq "nobody") {
>             print "$name is a member of $g\n";
>         }
>     }
> 
> What am I doing wrong??

you're making a list of one element and assigning it to groups.
you need to split up the result of backticks, perhaps using split().

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: Tue, 20 Jul 1999 15:26:34 -0700
From: "TravisC" <travis.cox@itron.com>
Subject: Re: Check if 2 dates are in the same week
Message-Id: <7n2sos$e3g$1@bayer.itron.com>


>> In article <7n2fjs$4f0$1@nnrp1.deja.com>,
>>   skyfaye@my-deja.com wrote:
>> > $old_mon=11; $old_day=27; $old_year=1998; #Dec 27, 1998
>> > $new_mon=0; $new_day=8; $new_year=1999;   #Jan 8,  1999
>> >
>> > I need to find out if 2 dates are in the same week, one week apart,
>2
>> > weeks apart, and s
>> > o on.  For me, Monday is the beginning of the week.
>> > I know how to find the number of days between 2 dates but that
>doesn't
>> > help this problem.

If you can find out how many days there are between 2 dates then just have
2 subroutines where one is for $num_days > 6 and the other one is for
$num_days <= 6

>> >
>> > Thanks,
>> > Hung
>> >





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

Date: 20 Jul 1999 23:22:46 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Check if 2 dates are in the same week
Message-Id: <7n30c6$qvk$1@lublin.zrz.tu-berlin.de>

 <skyfaye@my-deja.com> wrote in comp.lang.perl.misc:
>I did check the FAQ before posting but no help.
>
>- Hung
>
>In article <7n2ljk$771$1@nnrp1.deja.com>,
>  shawnporter@my-deja.com wrote:
>> Check the FAQ...
>>
>> -> http://language.perl.com/newdocs/pod/perlfaq4.html#Data_Dates
>>
>> --
>> Shawn Porter
>>
>> --
>> In article <7n2fjs$4f0$1@nnrp1.deja.com>,
>>   skyfaye@my-deja.com wrote:
>> > $old_mon=11; $old_day=27; $old_year=1998; #Dec 27, 1998
>> > $new_mon=0; $new_day=8; $new_year=1999;   #Jan 8,  1999
>> >
>> > I need to find out if 2 dates are in the same week, one week apart,
>2
>> > weeks apart, and s
>> > o on.  For me, Monday is the beginning of the week.
>> > I know how to find the number of days between 2 dates but that doesn't
>> > help this problem.

Oh, but it does.  Let's say you have a subroutine such that
days_between( $date0, $date1) gives the (signed) number of days
between the dates.  All else you need is one particular date
$some_monday that falls on a Monday.  You may then define

sub week_number {
  int ( $days_between( $some_monday, shift) / 7)
}

Two dates are in the same week when they have the same week number.

Not that this has anything to do with Perl.

Anno


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

Date: Tue, 20 Jul 1999 16:33:11 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Check if 2 dates are in the same week
Message-Id: <37950737.ED55D9FB@mail.cor.epa.gov>

skyfaye@my-deja.com wrote:
> 
> I did check the FAQ before posting but no help.

But you apparently failed to notice the references to Date::Calc
and Date::Manip .  If you download a copy of Date::Calc and read
its docs, you'll see that it has a Monday_of_Week() function,
as well as a Week_Number() function.  Either one will get you
there.  For example, you can get Monday_of_Week for both dates,
subtract to get the difference, and divide by 7 to get the diff
in weeks.  Piece of cake.

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


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

Date: 20 Jul 1999 23:07:54 +0100
From: dbell@maths.tcd.ie (Derek Bell)
Subject: Re: Future of Perl
Message-Id: <7n2rvq$s4u@salmon.maths.tcd.ie>

rjk@linguist.dartmouth.edu (Ronald J Kimball) writes:
>Hey now, this comparison to Winnie the Pooh is inappropriate.  Pooh
>actually accepted his lack of grey matter, and he certainly never
>resorted to profanity.

	You mean "bother" *isn't* profanity?? :-)

	Derek
-- 
Derek Bell  dbell@maths.tcd.ie                |   Socrates would have loved
WWW: http://www.maths.tcd.ie/~dbell/index.html|            usenet.
PGP: http://www.maths.tcd.ie/~dbell/key.asc   |    - Jo@bluejo.demon.co.uk


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

Date: Tue, 20 Jul 1999 15:00:51 -0700
From: "TravisC" <travis.cox@itron.com>
Subject: Re: getting the decimal portion of a floating point number
Message-Id: <7n2r8d$daq$1@bayer.itron.com>


anna@water.ca.gov wrote in message <7n2n1s$7t0$1@nnrp1.deja.com>...
>Hi,
>
>Is there a way in Perl or in a module of getting the decimal portion of
>a floating point number?  I have already tried using the format_picture
>method of Number::Format, but that doesn't work.
>
>For example, if I have a number, 12345.6789 and I want to be able to
>return the portion .6789, how do I go about that?
>
>Thanks in advance for your reply,
>Anna
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.

I usually just split the number at the decimal point. Works for me.
($tmp,$dec) = split(/\./,$number);
$tmp will now contain the decimal portion. Sometimes you have to look
at numbers as strings and vice versa.




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

Date: Tue, 20 Jul 1999 16:25:09 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: 05317@stblaw.com
Subject: Re: Hashes
Message-Id: <37950555.E0D5FC09@mail.cor.epa.gov>

[courtesy cc emailed, assuming this is a legit return address]

05317@stblaw.com wrote:
> 
> In using Hashes, every once in a while I get, Odd number of elements in
> hash.  What am I doing wrong ?
> 
> these hashes have at least 4500 items in them.

Well, 4500 isn't an odd number of elements for a hash.  But 4501
would be.  This error message typically means that you managed to
give a hash a bunch of key-value pairs, plus one.  Arrays don't
care about their size, but hashes ought to come in key-value
pairs.

One way to avoid this if you're just typing stuff in, is to use
the arrow => instead of the comma between the key and the value.
That way you can see how things line up.

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


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

Date: Tue, 20 Jul 1999 19:33:09 -0400
From: modred@shore.net (Garth Sainio)
Subject: Re: LD_LIBRARY_PATH and modules
Message-Id: <modred-2007991933100001@gniqncy-s01-024.port.shore.net>

In article <37944814.3CED7EF0@eka.ericsson.se>, ekabjm@eka.ericsson.se wrote:

!! Hello!
!! 
!! I am trying to develope a perl module using another
!! dynamiaclly linked library. If I first set the =
!! 
!! LD_LIBRARY_PATH to the affected libraries my modules
!! work fine.
!! 
!! But when I use my script in a web-server I can not set the
!! LD_LIBRARY_PATH and have tried to figure out if it is possible
!! to tell perl where to find the libraries from my script.
!! 
!! I hoped that the following code should do the trick but I still get
!! the ld.so.1 error that it can not find my libraries.
!! 
!! BEGIN {
!!     $ENV{'LD_LIBRARY_PATH'} =3D '/tools/prim_api/lib.SunOS_5';
!! }
!! 
!! use Admin;   # my module that uses the library above
!! 
!! Can this be fixed from my script?
!! 
<snip>

This sounds like a problem that many people have had before (usually seen
when trying to access various databases). Take a look on DejaNews
(www.deja.com) in comp.lang.perl.misc with a search keyword of
LD_LIBRARY_PATH. 

What is happening is that the modules are loaded before anything else in
the script is executed, so you can set the environment but it will never
be evaluated before the use statements. You need to change the environment
for the perl interpreter not the perl script.

One solution is to add a symlink in /usr/lib to the library you need to
load. Another is the following "shebang" line (courtesy of a Remco Wouts
post that should be found on DejaNews but that I don't have an exact
reference for)

#!/bin/sh -- # -*- perl -*-
eval 'exec env LD_LIBRARY_PATH=whatever /usr/bin/perl $0 ${1+"$@"}'
if $running_under_some_shell;
#follow with the rest of your script


Personally, I'd go for the symlink if it were at all possible.

HTH,

Garth

-- 
Garth Sainio               "Finishing second just means you were the 
modred@shore.net            first to lose" - anonymous


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

Date: 20 Jul 1999 22:13:14 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: newbie question about fork
Message-Id: <7n2s9q$qp3$1@lublin.zrz.tu-berlin.de>

Joshua Harr  <josh@titan.byu.edu> wrote in comp.lang.perl.misc:
>I need to spawn another program from with my script and wait for
>it to complete before continuing.  system() returns success/failure etc.
>
>of the spawned process but I need the PID also - and I need it before
>the child process terminates.

Yes.  After the process is gone its pid is pretty much useless.

>                               How do I get the PID after spawning a
>process (w/o losing the system call return value)? 

perldoc -f fork.  The second line tells you that fork() returns the
kid's pid to the parent.

>                                                   Do I need a need to
>use wait or waitpid somehow?

perldoc -f waitpid.  The fourth line tells you that the status is captured
in the $? variable.

Anno


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

Date: Tue, 20 Jul 1999 22:01:27 GMT
From: Floyd Morrissette <Webdesigner@NewWebSite.com>
Subject: Re: Perl and Personal Web Server (Win98)
Message-Id: <7n2rjf$9qe$1@nnrp1.deja.com>

In article
<7923EB0022F15F9C.BF8D2D80A9CD3D3D.2A5409A348243B23@lp.airnews.net>,
  Kent Perrier <kperrier@blkbox.com> wrote:

> They can most definately be found in the newsgroup that deals with
Windows
> based web servers, such as comp.infosystems.www.servers.ms-windows


Thank you. I have done numerous searches and never saw that group. I
wish more people were as helpful as you.




--
Get your web site from http://www.NewWebSite.com
Consultation is always free.
Help with cgi scripts.


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


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

Date: Tue, 20 Jul 1999 16:36:55 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Perl and Personal Web Server (Win98)
Message-Id: <37950817.A8061EA6@mail.cor.epa.gov>

Floyd Morrissette wrote:
> 
> In article
> <7923EB0022F15F9C.BF8D2D80A9CD3D3D.2A5409A348243B23@lp.airnews.net>,
>   Kent Perrier <kperrier@blkbox.com> wrote:
> 
> > They can most definately be found in the newsgroup that deals with
> Windows
> > based web servers, such as comp.infosystems.www.servers.ms-windows
> 
> Thank you. I have done numerous searches and never saw that group. I
> wish more people were as helpful as you.

Uh-oh.  A *helpful* response.  I guess we'll have to send Kent back
to the Abigail School For Abrupt And Obfuscated Replies.

And I thought he was working out so well too...

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


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

Date: Tue, 20 Jul 1999 23:04:31 GMT
From: Dave Ortman <dortman@my-deja.com>
Subject: Perl CGI Performance
Message-Id: <7n2v9n$b7u$1@nnrp1.deja.com>

Question,

I've typically worked with server side Java to generate web pages; and
have found them to be satisfactory with regards to speed and
resources.  However, I've now working on a web site that was written in
Perl, which I have had no previous experience with.

I always had the understanding that CGI proved to be a less than
perfect tool to implement web site with any decent amount of traffic;
due to the spawning of additional threads for each and every page
request.  Is this an issue in reality?

Along that same line, what does mod perl offer?  Does it offer some of
the same qualities that other server side technologies might offer?
(i.e. ASP, JSP, Java Servlets)

I have done a little reading on mod perl.  Am I correct that it is only
available with Apache.  Also, it seems that migrating a decent sized
project to mod perl would a less than trivial task?

Can somebody offer me some information regarding these items?  If it's
quicker to point me to a URL, please do so.

Thanks in advance,
-Dave


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


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

Date: Tue, 20 Jul 1999 22:53:02 GMT
From: Dave Ortman <dortman@my-deja.com>
Subject: Perl Database Question
Message-Id: <7n2uk9$b0e$1@nnrp1.deja.com>

Pardon my seemingly ignorant question,

I've been given the task of connecting a web site written in Perl to an
Oracle 8 Database.  I've been looking at various documentation; and
have found the Oraperl, DBD, and DBI modules.  I was hoping somebody
could help me understand the difference between these three modules; or
at least point me in the direction of documentation that might further
explain the three modules.  Is DBI the interface, and DBD are simply
the modules for each particular database?  What about Oraperl?

There will be some connection pooling involved; if that makes a
difference.

Thanks in advance for your reply.

-Dave


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


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

Date: Tue, 20 Jul 1999 19:42:41 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Perl Database Question
Message-Id: <brian-ya02408000R2007991942410001@news.panix.com>

In article <7n2uk9$b0e$1@nnrp1.deja.com>, Dave Ortman <dortman@my-deja.com> posted:

> I've been given the task of connecting a web site written in Perl to an
> Oracle 8 Database.  I've been looking at various documentation; and
> have found the Oraperl, DBD, and DBI modules.  I was hoping somebody
> could help me understand the difference between these three modules;

Oraperl is dead.

DBI is what you want to use.  DBD is part of DBI.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: Tue, 20 Jul 1999 21:53:02 GMT
From: Doug Henderson <doug.henderson@pss.boeing.com>
Subject: perl on UNICOS
Message-Id: <3794EFBE.EC7BA4CA@pss.boeing.com>

Hi all,

Has anyone out there ever experienced performance problems with
perl on UNICOS?  I know this is a very general question.  Any
information anyone has, or pointers to information, about perl
performance on UNICOS would be appreciated.

Thanks!


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

Date: Tue, 20 Jul 1999 17:01:07 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: perl's edge -- a beginner's question
Message-Id: <3794F1A3.5973F60A@mindspring.com>

Daniel Ulrich wrote:
> 
> Keith G. Murphy <keithmur@mindspring.com> wrote in message
> news:378CFB14.FCFAE781@mindspring.com...
> > Tad McClellan wrote:
> > >
> > > Fernando Morais Dasilva (fmd@wam.umd.edu) wrote:
> > >
> > > : i'm just getting started on learning perl.  i wanted an example of
> > > : something that perl can do easier that c, c++ would take a lot more
> > > : effort.
> > >
> > >    Go write a dos2unix line-ending convertor in C or C++.
> > >    ( I have never heard of the c and c++ languages that
> > >      you refer to...)
> > >
> > >    Then compare it to Perl:
> > >
> > >       perl -p -i -e 's/\r//g' filenames...
> > >
> > That's hardly fair.  perl *is* that dos2unix line-ending converter,
> > written in C.  It just has a lot of other stuff, too...  ;-)
> > --
> > ... if the problem persists ... get  a  3.5  ft ... length of sucker rod
> > and have a chat with the user in question.
> >                 -- Linux System Administration,
> >                    SYSLOGD (8), page 7
> >                    (Dealing with DOS attacks exploiting SYSLOGD)
> 
> No, you have it all wrong. 

Huh?  What do I have wrong?  (And why quote my sig?)

> PERL like its name implies (Practical Extraction
> and Report Language) is unlike any other language out there. Instead of
> working fast with numbers (like c and c++) it works fast with words. The
> only real use for PERL is when you are sifting or shifting huge amounts of
> textual data. 

The only real use?  Really?

> This makes it ideal for the internet where you need to be able
> to parse the environmental variables. 

If that's your idea of huge amounts of textual data, um, I guess this
reply is gargantuan.

> So it is not better or worse it just
> has a different application.(just don't try to do graphics in it).

Ever heard of PerlMagick?  And you say *I* have it all wrong?


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

Date: Tue, 20 Jul 1999 18:27:40 -0400
From: brian@pm.org (brian d foy)
Subject: Re: PGP and Mail
Message-Id: <brian-ya02408000R2007991827400001@news.panix.com>

In article <lk6l3.663$ui4.212722@news.shore.net>, Scratchie <upsetter@ziplink.net> posted:

> brian d foy <brian@pm.org> wrote:
> :>         $ret_val = open (PGP, "|$pgpprog -fea +VERBOSE=0 \"tony
> :> <tony\@tony.co.uk>\" > $pgptmp");
> 
> : i recommend using IPC::Open3.  i recently posted an example in either
> : this forum or comp.infosystems.www.authoring.cgi.
> 
> Could someone explain in a nutshell what the advantages are to using
> IPC::Open3 rather than open?

open can't do the same things IPC::Open3 can.  that's it in a nutshell.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: Tue, 20 Jul 1999 23:35:16 GMT
From: "Brian Tully" <gstock@gstockco.com>
Subject: Porsche: Perl Programmer Please! (Help Wanted)
Message-Id: <UI7l3.4429$J35.200286@newshog.newsread.com>

Looking for Perl programmer(s)/web developers to help write/edit CGI scripts
for Porsche's web sites.  mSQL a big plus.  Exciting opportunity.  Flexible
arrangements.

Please e-mail gstock@gstockco.com or call Brian Tully @ (914) 276-2700 if
interested.

Thanks!


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

Date: 20 Jul 1999 23:57:37 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: reading from a file and THEN!
Message-Id: <7n32dh$r2d$1@lublin.zrz.tu-berlin.de>

Eric The Read  <emschwar@rmi.net> wrote in comp.lang.perl.misc:
>"K. Posern" <posern@informatik.uni-marburg.de> writes:

>> And at this point I wondered if it is SOMEHOW possible (in perl) to
>> NOTICE that the "old" logfile was zipped and moved away and to close and
>> reopen the filehandle, so that is now attached to the "new" logfile
>> (with the same name in the same directory, but starting at size 0).
>
>I can't think of anything offhand-- you'll get EOF after it's moved, of
>course, but unless you can count on your logfile being updated on a
>regular basis, that won't necessarily tell you anything.

He might monitor the size of the file (not the filehandle) and
re-open when it shrinks.  Here's a sketch:

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

my $logfile = '/tmp/x';
open( LOG, $logfile ) or die "Can't open $logfile: $!\n";

while ( 1 ) {
  my $size = -s $logfile; # Use the filename, not the handle
  while ( <LOG> ) {
    print;
  }
  sleep 1;
  my $newsize = -s $logfile || 0; # $logfile may temporarily not exist
  if ( $newsize < $size ) {
    until ( open( LOG, $logfile) ) {
      sleep 1;
    }
  }
}

>Why not have whatever program that archives the logfile stop and restart
>the monitoring perl program?  It seems the easiest solution.

Why not indeed.  

Anno


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

Date: 20 Jul 1999 23:54:21 GMT
From: tgy@chocobo.org (Neko)
Subject: Re: Skipping to next file using angle operator
Message-Id: <7n327d$g7l$0@216.39.141.200>

On Tue, 20 Jul 1999 22:59:36 GMT, Stephen Rasku <srasku@my-deja.com> wrote:

>Is there a way to skip to the next file using the angle operator.  I am
>searching for keywords in a list of files.  Once the keyword is found,
>it is no longer necessary to process the rest of the file.  This is what
>I am looking for:
>
>while( <> )
>{
>    next FILE if ( m/keyword/ )

    close ARGV if /keyword/;

>    die "keyword not found" if ( eof );
>}

-- 
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=


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

Date: 20 Jul 1999 22:06:55 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: Unique IP Address Extraction
Message-Id: <slrn7p9ss6.mhr.fl_aggie@thepentagon.com>

On Tue, 20 Jul 1999 21:01:17 GMT, wired2000@my-deja.com
<wired2000@my-deja.com>, in <7n2o2k$8cc$1@nnrp1.deja.com> wrote:

+ My idea would be to use a hash table and store each IP inside, but I
+ don't believe this would be the most efficient way.

I don't see why not? It's more efficient than a list in terms of
managing -- you don't have to constantly check to see if you have that
IP already.

$ip_hash{$ip_number}=1;

Once you've processed the files, you can do something like:

@ip_list=keys %ip_hash; # further manipulation

# or just:

foreach $key (keys %ip_hash) {
  print $key,"\n";
}

+ As well, what's the most efficient way of reading line by line from the
+ text file (remember, file is 4-10 megs)? open the whole thing and put
+ it in memory or read line by line?

You might be able to get away with that...

+ If reading line-by-line, how can I do that?

*boggle* You haven't seen

open(INPUT, 'some_file') or die "some_file: $!";
while(<INPUT>) {
     chomp; # input is now in the magical $_ var, minus any nast EoR marks
     [manipulations here]
}
close(INPUT); # I suppose I should check the success/failure...

before?

+ If anyone knows a better way to do this with grep/egrep/any other linux
+ command, your input is definitely appreciated.

I don't know about better, but different. You could use cut (1) and sort (1)
to do what you want. You're data looks like:

+ date/time;;;pageURL;;;IPaddress

Something like:

% cut -f 7 -d \; /path/to/log/file | sort -u > unique_ip

*might* do the trick. Completely and thoroughly UNtested. Read your
man pages on these commands.

James


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

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


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