[14065] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1475 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 24 03:10:18 1999

Date: Wed, 24 Nov 1999 00:05:30 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <943430730-v9-i1475@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 24 Nov 1999     Volume: 9 Number: 1475

Today's topics:
    Re: Archive::Tar Sending File to Browser? <rootbeer@redcat.com>
    Re: Best book on Perl (Tad McClellan)
    Re: Charts (Jason L. James)
    Re: Embedding text content into HTML templates with Per (J. Kenton)
    Re: filehandles and access symbols <rick.delaney@home.com>
    Re: filehandles and access symbols <rootbeer@redcat.com>
    Re: HASH Implementation <rootbeer@redcat.com>
    Re: help please, while wont....... <mattking@techie.com>
    Re: Help with understanding syntax (Mark-Jason Dominus)
    Re: How to send CTRL characters over telnet session ? <rootbeer@redcat.com>
    Re: Initialize Variables (Tad McClellan)
    Re: need help with regular expr. <lr@hpl.hp.com>
    Re: newbie PERL question (Martien Verbruggen)
    Re: Outputting "#" in URL for anchoring (Martien Verbruggen)
    Re: Percentages Question <lr@hpl.hp.com>
    Re: Perl used for Oracle? <greg-spare-1@mit.edu>
    Re: Pipe To Script <rootbeer@redcat.com>
    Re: Portuguese Whaling Songs <lr@hpl.hp.com>
    Re: POST in PERL <rootbeer@redcat.com>
        Problem with file locking(?) using Perl 5.005_03, DB_Fi wanix@my-deja.com
    Re: Problem with file locking(?) using Perl 5.005_03, D wanix@my-deja.com
    Re: Q on TPJ #14 smtp article <jkline@one.net>
    Re: Q on TPJ #14 smtp article <lr@hpl.hp.com>
    Re: Reading a here-document? (Abigail)
    Re: relation of cgi scripts and STDOUT (??) <rootbeer@redcat.com>
        stupid user Q <tavi367@attglobal.net>
    Re: Test for eval() without using eval() ?? <rootbeer@redcat.com>
        Understanding goto (was: Re: Help with understanding sy <rootbeer@redcat.com>
    Re: using regex to extract data (Martien Verbruggen)
    Re: using regex to extract data (Tad McClellan)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 23 Nov 1999 23:37:56 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Archive::Tar Sending File to Browser?
Message-Id: <Pine.GSO.4.10.9911232337180.16575-100000@user2.teleport.com>

On Tue, 23 Nov 1999, WDDobbs wrote:

> How do I get the desired filename to be the default in the
> save dialog?  

It sounds as if you want to get a browser to do something. Perhaps you
should search for the docs, FAQs, and newsgroups about browsers. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 23 Nov 1999 18:28:16 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Best book on Perl
Message-Id: <slrn83m8og.c82.tadmc@magna.metronet.com>

On Tue, 23 Nov 1999 16:46:02 -0500, John <jadapturNOSPAM@hotmail.com> wrote:

>What's the best Book to Learn Perl 


   "Learning Perl" (www.ora.com) or "Elements of Programming with Perl"
   (www.manning.com).


> for the web..


   Perl is a general purpose programming language.

   Many (most) of the ones that tie it to learning CGI at
   the same time are of *profoundly* poor quality.


   Get a Perl book to learn Perl.

   Get a CGI book to learn CGI programming.


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


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

Date: Wed, 24 Nov 1999 07:34:59 GMT
From: jasonj@rwdata.co.uk (Jason L. James)
Subject: Re: Charts
Message-Id: <383b948a.155262237@news.demon.co.uk>

You could try GD.pm and GIFgraph.pm, both are avilable 
from cpan.org.  However, there seems to be a bit of a
problem there because the latest version of GD does not
support GIF files, and yet GIFgraph must us GD to draw
it graphs.  If you can get hold of an old version of GD that does
support GIF files that you should have no problems.

Cheers

Jason James
-------------------------------------
jason@jamesjl.demon.co.uk
jasonj@rwdata.co.uk

On 22 Nov 1999 15:08:41 +0000, Tony Curtis <tony_curtis32@yahoo.com>
wrote:

>mirak63@yahoo.com writes:
>
>> Hello, 
>> 
>> Are there any PERL modules that provide for the development of Charts
>> or Graphs?
>> 
>> I've been looking all over and can't find anything.
>
>http://www.cpan.org/
>
>  ->
>
>  http://www.cpan.org/modules/index.html
>
>    -> "by category"
>
>      http://www.cpan.org/modules/00modlist.long.html#18)Images,Pixma
>
>hth
>tony



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

Date: Tue, 23 Nov 1999 08:39:09 -0600
From: brewer@NOSPAM.iastate.edu (J. Kenton)
Subject: Re: Embedding text content into HTML templates with Perl
Message-Id: <brewer-2311990839090001@mac12332.educ.iastate.edu>

Thanks guys.
-- 
J. Kenton - brewer@NOSPAM.iastate.edu


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

Date: Wed, 24 Nov 1999 05:35:35 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: filehandles and access symbols
Message-Id: <383B794B.B7473360@home.com>

[posted & mailed]

Max wrote:
> 
> open(BLAH,"+<blah.txt")  allows me to read but only APPEND the data
> that i write to it

Nonsense.

perldoc -f seek
perldoc perlopentut

> what i am writing to the file is simply a number that will be
> incremented by 1 every time the script is run
> any solutions are gladly welcome

perldoc perlfaq5

I still don't get locking. I just want to increment the number in the
file. How can I do this?

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Tue, 23 Nov 1999 23:44:40 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: filehandles and access symbols
Message-Id: <Pine.GSO.4.10.9911232340380.16575-100000@user2.teleport.com>

On Wed, 24 Nov 1999, Max wrote:

> is there anyway that i can open a file just once to read it and then
> overwrite its contents?

If Perl couldn't do that, it wouldn't be very capable, now would it?

> open(BLAH,"+>blah.txt")   erases the file contents before i even get
> to read it and.....

Yep, that's what you asked it to do.

> open(BLAH,"+<blah.txt")  allows me to read but only APPEND the data
> that i write to it

If that's really the case, your perl binary may be miscompiled or your
system is seriously messed up. But, to be sure, do you know how to use
seek(), as documented in the perlfunc manpage?

> what i am writing to the file is simply a number that will be
> incremented by 1 every time the script is run

Oh, a web counter. Have you tried finding one that already works and
seeing what it's doing right that you're doing wrong? Or you could use the
one from the FAQ, section five.

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 23 Nov 1999 22:39:22 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: HASH Implementation
Message-Id: <Pine.GSO.4.10.9911232238240.16575-100000@user2.teleport.com>

On Tue, 23 Nov 1999, Bill Cox wrote:

> Does Perl basically assign an exclusive name space for each hash then
> just assign variables in that namespace to create elements of the
> array? (To then get all the elements - just return all the variables
> created in that namespace.)  

That's a clever idea, but it's not how it works. In fact, it's roughly the
other way around. Each namespace is a hash, if you look at it squinty.

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 24 Nov 1999 08:39:20 +0100
From: "Matt King" <mattking@techie.com>
Subject: Re: help please, while wont.......
Message-Id: <81g4m7$k06$1@news.uk.ibm.com>

Larry,
>...binmode($File_Handle) at this point...
Sorry, this doesn't work. I have even tried with plain (MSDOS) text file
(autoexec.bat and config.sys). Same exact effect. 0 byte file created with
the name desired in the location desired. The while loop that reads in the
file from the source (web page - external source) does not execute, even if
the file is located on the same machine.

>> You have given little information.  All I can suggest is that you ...
What other information do you need? I really don't know what is needed to
solve this. Through using print {this or that} above, below and in the while
loop, I can see that the while loop does not ever loop, even once. Which
makes this even more difficult to understand. PERL just 'skips' the loop for
whatever reason. Without even one run through it makes it a bit hard to
pinpoint the problem. In C it would normally mean that the file doesn't
exist on the source, the file on the source is 0 bytes, a required lib was
not included or the vars were not (correctly) defined (most popular items
I'm sure there are more).

Any ideas? It's got to be something very simple, the others always stand
out.
Thanks,
Matt




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

Date: Wed, 24 Nov 1999 05:23:00 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Help with understanding syntax
Message-Id: <81fslk$m1m$1@monet.op.net>

In article <m3hfid84vl.fsf@centauri.ajs.com>,
Aaron Sherman  <ajs@ajs.com> wrote:
>mjd@op.net (Mark-Jason Dominus) writes:
>> Yes, but the way `goto' works is by searching the program starting
>> from the beginning.  So it ends up looking at all the nonmatching
>> labels anyway.
>
>I know that I'm a bit out of touch, but wasn't this the case a LONG
>time ago, and that was then fixed when labels became just another type 
>of variable in perl5.000?

The blue camel book, p.538:

	Avoid goto.  It scans outward from your current location for
	the indicated label.

So I wasn't exactly right, but I was right enough for this particular
discussion.  

(This is as of perl 5.003.  As far as I know there haven't been any
big changes to goto since then.  Who would want to bother?  Hardly
anyone ever uses goto.)

>As I recall, this was one of the huge reasons for switching over to
>perl 5,

It's hard to believe that goto could be a huge reason for anyone to
switch to perl 5, because hardly anyone ever uses goto.



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

Date: Tue, 23 Nov 1999 22:34:05 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to send CTRL characters over telnet session ?
Message-Id: <Pine.GSO.4.10.9911232216460.16575-100000@user2.teleport.com>

On Tue, 23 Nov 1999, Pascal Masuit wrote:

> Has anyone got experience in sending control characters to a router
> over a telnet session ?

I'm sure someone does. It's not I....

> If so, I would appreciate it if you could give me an example of the
> print statement !

 ....but the print statement works in the same way whether you're printing
to one filehandle or another. If you're not getting the results you think
you should be getting, well, maybe you should see what a telnet program
does if you type the required control characters.

> FYI: I'm using Expect.pm v1.07, Perl 5.002 on HP-UX 10.20

I don't know about those other version numbers, but that version of Perl
is pretty old. When it was released, some of us were actually looking
forward to seeing Jim Carrey in the then-upcoming movie "The Cable Guy".
It's ooooooolllld. Replace, replace, replace.

> I'm trying to send a CTRL-P to an IBM 2210 router to get in the root
> menu.

Can you do it with a telnet client directly? If you have your program talk
to another telnet program, do you see what you expect to see?

> I've tried everything I could come up with...

Have you seen what perlvar says about the magical $| variable? Don't
forget to see what perlfunc says about the one-arg select, though.

Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 23 Nov 1999 18:43:33 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Initialize Variables
Message-Id: <slrn83m9l5.c9e.tadmc@magna.metronet.com>

On Tue, 23 Nov 1999 21:25:55 GMT, jlsimms@hotmail.com <jlsimms@hotmail.com> wrote:
>Instead of:
>
>> undef($a, $b, $c, @A, @B)
>
>why don't you use something like:
>
>my ($a, $b, $c, @A, @B);


   my() creates *new* variables.

   The original poster already _has_ these variables, and he wants
   to change their values.


>This should do what you want.


   I don't think so.


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


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

Date: Tue, 23 Nov 1999 23:42:08 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: need help with regular expr.
Message-Id: <MPG.12a536ab9163c04298a26e@nntp.hpl.hp.com>

In article <8E87E2A31kbandeshomecom@192.168.123.1> on Wed, 24 Nov 1999 
03:36:08 GMT, Ken Bandes <kbandes@home.com> says...
> venkatmohan@my-deja.com wrote in <81feig$rdv$1@nnrp1.deja.com>:
> >I need to parse out the following string
> >
> >2323I am a 3343perl43progra!mer
> >
> >In this string I want to extract only the white space and alphabets
> >(both lower and upper case).
> 
> >$a="2323I am a 3343perl43progra!mer";
> >$a=~ s/(?![a-zA-Z\s]+)//g;
> That's a negative lookahead - it avoids exactly what you want to
> match, and also is zero-width so it doesn't capture anything.
> 
> You could do
> $a = join '',$a =~ /\s|[a-zA-Z]/g;

You could, but that would be the worst proposal yet, by far (even after 
I improve it by replacing the slower alternation by inclusion in the 
character class).

Benchmark: timing 65536 iterations of Join0, Join1, Sub, Tr...
     Join0: 17 wallclock secs (16.04 usr +  0.00 sys = 16.04 CPU)
     Join1: 13 wallclock secs (12.91 usr +  0.00 sys = 12.91 CPU)
       Sub:  3 wallclock secs ( 2.25 usr +  0.00 sys =  2.25 CPU)
        Tr:  1 wallclock secs ( 0.72 usr +  0.00 sys =  0.72 CPU)

#!perl -w
use strict;
use Benchmark;

my $x = '2323I am a 3343perl43progra!mer';

timethese(1 << (shift || 0), {
  Join0 => sub {  my $y = join "" => $x =~ /\s|[a-zA-Z]/g },
  Join1 => sub {  my $y = join "" => $x =~ /[a-zA-Z\s]/g },
  Sub   => sub { (my $y = $x) =~ s/[^a-zA-Z\s]+//g },
  Tr    => sub { (my $y = $x) =~ tr/a-zA-Z \n\t\r\f//cd },
});

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


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

Date: Wed, 24 Nov 1999 05:48:19 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: newbie PERL question
Message-Id: <D_K_3.524$6Y1.6324@nsw.nnrp.telstra.net>

On Tue, 23 Nov 1999 16:46:14 -0800,
	David Cassell <cassell@mail.cor.epa.gov> wrote:
> Jeff Zucker wrote:
> > 
> > Jonathan Yee wrote:
> > 
> > > Newsgroups:  alt.comp.perlcgi.freelance, alt.perl, comp.lang.perl.misc
> > 
> > It's kind of overkill to post the same question to three newsgroups,
> > even if some of them don't exist.
> 
> Jeff, I don't know how to break it to you, but *all*three*
> of those groups exist.  

Not here they don't :) And I'll be damned before I go to deja to read
any of the ones that aren't available from my newsfeed.

Martien
-- 
Martien Verbruggen              | My friend has a baby. I'm writing
Interactive Media Division      | down all the noises the baby makes so
Commercial Dynamics Pty. Ltd.   | later I can ask him what he meant -
NSW, Australia                  | Steven Wright


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

Date: Wed, 24 Nov 1999 05:44:13 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Outputting "#" in URL for anchoring
Message-Id: <NWK_3.522$6Y1.6324@nsw.nnrp.telstra.net>

On Wed, 24 Nov 1999 04:54:01 GMT,
	Hacka <cau.quach@sympatico.ca> wrote:
> 
> <ether_nut@my-deja.com> wrote in message news:81ejse$77g$1@nnrp1.deja.com...
> ........."........./index.html#AZ\">\n";...............................
> 
> try ...."........./index.html?#AZ".........................

Euhmm.. why?

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | I'm just very selective about what I
Commercial Dynamics Pty. Ltd.   | accept as reality - Calvin
NSW, Australia                  | 


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

Date: Tue, 23 Nov 1999 23:05:45 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Percentages Question
Message-Id: <MPG.12a52e1eebcebfdb98a26b@nntp.hpl.hp.com>

In article <slrn83ms10.m2v.abigail@alexandra.delanet.com> on 23 Nov 1999 
22:53:48 -0600, Abigail <abigail@delanet.com> says...
> Larry Rosler (lr@hpl.hp.com) wrote on MMCCLXXVI September MCMXCIII in
> <URL:news:MPG.12a4e16364478f9098a266@nntp.hpl.hp.com>:

 ...

> //      $avg = do { local $" = '+'; eval("@x")/@x };
> 
> Except for the spacing. There ought to be spaces around binary operators
> and there's a space *before* an opening paren, but *not after*, nor before
> a closing paren. Furthermore, avoid mixed quotes if possible. Hence:
> 
>         $avg = do {local $" = "+"; eval ("@x") / @x};

Well, my Abigail imitation is tuned down to the token level, at any 
rate.  Spacing is as personal a choice as text editors.

I am ambivalent about spacing around the solidus.  Common mathematical 
practice is not to, I think, perhaps in exception to the other 
arithmetic operators.  In my code I tend to use the spaces, but have 
been criticized for weirdness (in other aspects, too :-).

A space between a function name and its parenthesized argument list is 
grotesque.  I am influenced by recollection of a language in which that 
wouldn't even compile (cpp, perhaps).

In this snippet, mixed quotes are a visual-semantic blessing.  The 
second pair works because of interpolation, reinforced by the mnemonic 
$", while the quotes around the '+' are a different beast entirely.

At least neither of us 'airs out' the semicolon, the way Uri Guttman 
does.

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


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

Date: Wed, 24 Nov 1999 07:46:10 GMT
From: Greg Stark <greg-spare-1@mit.edu>
Subject: Re: Perl used for Oracle?
Message-Id: <87pux0pc2j.fsf@HSE-Montreal-ppp19485.qc.sympatico.ca>


> On 23 Nov 1999 19:26:25 PST, NJN <ibm_97@yahoo.com> wrote:
>
>> I will write some perl script to do Oracle admin job. I'm new to Perl. My
>> questions:
>>
>> 1. In perl, how can I call OS(in Unix) command, such as 'sqlplus'?
>> 2. Also, how can I 'select * from v$database' after I enter 'sqlplus' in
>>    perl?

The simplest way for you to use sqlplus as a subprocess will probably be
something like:

open(SQLPLUS, 'sqlplus user/pass@host @script.sql |');
while (<SQLPLUS>) {
 process output
}

However this could be quite hard to do, sqlplus doesn't print particularly
predictable output.

I strongly suggest you spend the time to set up DBI and DBD::Oracle as the
other person suggested.


"rdw2 at mindspring dot com"@test.com (Richard Warkentin) writes:

> Using the "DBI" interface to the Oracle DBD drivers is a more elegant
> solution to your problem.  The DBI & DBD modules are not part of the
> perl distribution so you'll need to download them from CPAN.  I
> normally do my development on an NT system at home and move them to a
> unix system without trouble.

more information can be found at:
        http://www.symbolstone.org/technology/perl/DBI

Mailing list archives are at:
        http://www.rosat.mpe-garching.mpg.de/mailing-lists/PerlDB-Interest/
        http://www.xray.mpe.mpg.de/mailing-lists/#dbi
        http://outside.organic.com/mail-archives/dbi-users/
        http://www.coe.missouri.edu/~faq/lists/dbi.html

And you can subscribe to the mailing list at:
        http://www.isc.org/dbi-lists.html

-- 
greg


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

Date: Tue, 23 Nov 1999 23:40:00 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Pipe To Script
Message-Id: <Pine.GSO.4.10.9911232338560.16575-100000@user2.teleport.com>

On Tue, 23 Nov 1999, Lenny grosso wrote:

> This would work, except for that sendmail won't pipe into the script.

It sounds as if sendmail isn't working right, possibly because some
program isn't running it correctly. Perhaps you should search for the
docs, FAQs, and newsgroups about sendmail. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 23 Nov 1999 23:13:30 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Portuguese Whaling Songs
Message-Id: <MPG.12a52ff59608dca098a26c@nntp.hpl.hp.com>

In article <x77lj8mz6j.fsf@home.sysarch.com> on 23 Nov 1999 20:54:44 -
0500, Uri Guttman <uri@sysarch.com> says...
> >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:

 ...

>   LR> My God!  What were you thinking (and not testing!)?
> 
>   LR>       $msg = join "" => map substr($msg, $_, 1) => 0, 6, 2, 13;
> 
> mea culpa
> 
> it was tested in perldb. i even cut and pasted it from there. but what
> happened is that i changed print to $msg =.

Yeah, yeah.  You are confirming what I thought after I submitted my post 
-- I used the wrong verb in my question.

    s/thin/smo/;

:-)

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


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

Date: Tue, 23 Nov 1999 23:22:18 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: POST in PERL
Message-Id: <Pine.GSO.4.10.9911232320290.16575-100000@user2.teleport.com>

On Tue, 23 Nov 1999, PARIMI RAKESH K wrote:

> I was trying to work on POST methos in Win32::Internet module ,
> REQUEST->SendRequest("userid=xxx&passwd=yyy"). But is ain't seemin' to
> work.

You should fix the bug in your program.

If you'd like help in finding it, you could cut your code down to a small,
stand-alone example program. Ideally, it should use no external files and
be shorter than five or ten lines. Then you can post that here and someone
may be able to see the problem.

If you'd like to ask for help without showing anyone your source code,
call PPAL, the Psychic Perl Assistance Line at 1-900-PSYCHO. $999.99/min,
VISA/AMEX/MC/DISCOVER. Must be 18+ or have parent's permission to call.

> Ph : (518)-438-0939
>     [ Weekdays : Before 9am & After 8pm]
>     [ Weekdays : Email between 9am and 8pm]
>     [ Weenends : Email and phone]

That's too complicated for me to figure out for the benefit of someone
who isn't paying me anything. I think I'll just post.

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 24 Nov 1999 05:08:24 GMT
From: wanix@my-deja.com
Subject: Problem with file locking(?) using Perl 5.005_03, DB_File 1.17 and libdb 2.2.7 via CGI script
Message-Id: <81frs5$4js$1@nnrp1.deja.com>

I'm having a real pain tracking this one down...
seems like a file locking problem because
virtually all my CGI programs are now getting
choked up by a message "Retrying in 1 seconds..."
getting printed prior to the content-type header.
Obviously the web server doesn't like this, but I
can't seem to stop it. It doesn't always get
printed before the header, so some pages will
display correctly (but end up with said message
inside or after the HTML being generated).

The message is being printed right around DB_File
calls (using "tie %database, "DB_File", $db_loc").
The same exact programs (with absolutely no
modification whatsoever) have been working
splendidly on another server for months now. That
old server is being retired in favor of a much
faster one tomorrow morning and this odd message
is the last hangup I have to deal with (and if the
switch is delayed, the CTO has my ass, because
there are serious security issues with the old
one). The previous server is running DB_File 1.17,
but libdb 1.85 and perl 5.004_05.

My feeling is that somewhere within libdb it's
printing an error message to STDOUT, which for my
CGI programs is the web server. If anyone knows a
configure flag that will turn off STDOUT error
messages for libdb (configure --help is of no
help, nor is the README). Or, if you know a way to
effectively trap the messages so they don't get to
the webserver, I would be most appreciative.

I just need to get whatever it is to stop printing
the damn warning message that's keeping my CGI
output from being handled by the web server
correctly.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 24 Nov 1999 05:27:03 GMT
From: wanix@my-deja.com
Subject: Re: Problem with file locking(?) using Perl 5.005_03, DB_File 1.17 and libdb 2.2.7 via CGI script
Message-Id: <81fsv3$5bn$1@nnrp1.deja.com>

Just as a followup.... still having the problem (after downgrading,
upgrading, sidegrading, etc.)... one of the other guys here seems to
think it could be an SSL issue... no reason why he thinks this, though.
We're using OpenSSL 0.9.3a (0.9.4 had some trouble building on this
system) and Net::SSLeay v1.0.5...

I guess I should say also that this is a Linux box (RedHat 6.1).

Any ideas? Thanks much in advance for any help... even if you don't
think you might know the answer, please send me any possible ideas...
we're getting pretty desparate at this point. :/


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 24 Nov 1999 01:19:47 -0500
From: Joe Kline <jkline@one.net>
To: tavi367@attglobal.net
Subject: Re: Q on TPJ #14 smtp article
Message-Id: <383B8383.32AD9F73@one.net>

[posted and mailed]

tavi367@attglobal.net wrote:
><SNIP>
> Can't use string ("To") as a HASH ref while "strict refs" in use at
> /usr/local/lib/perl5/site_perl/5.005/Mail/Mailer.pm line 272.
> 
> I'm new to the mail side of this, any ideas on how to fix this?
> <SNIP>
> # Hash keys are headers in the outgoing mail
> $mailer->open(To => ['you@localhost'],
>               Cc => ['me@localhost'],
>             From => 'me@localhost',
>          Subject => 'Some test mail');
>
In addition to Rick's changes, you might want to also throw some
quotes around your keys. Like:

$mailer->open( 'To' => ['you@localhost'],
               'Cc' => ['me@localhost'],
             'From' => 'me@localhost',
          'Subject' => 'Some test mail');

This should make it clear that 'To' is a hashkey.

joe


  -----------== 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: Tue, 23 Nov 1999 23:23:09 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Q on TPJ #14 smtp article
Message-Id: <MPG.12a532346dd6f3a998a26d@nntp.hpl.hp.com>

In article <383B8383.32AD9F73@one.net> on Wed, 24 Nov 1999 01:19:47 -
0500, Joe Kline <jkline@one.net> says...

 ...

> In addition to Rick's changes, you might want to also throw some
> quotes around your keys. Like:
> 
> $mailer->open( 'To' => ['you@localhost'],
>                'Cc' => ['me@localhost'],
>              'From' => 'me@localhost',
>           'Subject' => 'Some test mail');
> 
> This should make it clear that 'To' is a hashkey.

I would call that anti-advice.  To me, the sequnce of barewords followed 
by quoting-commas makes it clear that those barewords are hash keys.

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


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

Date: 23 Nov 1999 23:08:44 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Reading a here-document?
Message-Id: <slrn83mst0.m2v.abigail@alexandra.delanet.com>

Alan J. Flavell (flavell@mail.cern.ch) wrote on MMCCLXXV September
MCMXCIII in <URL:news:Pine.HPP.3.95a.991123203151.721K-100000@hpplus01.cern.ch>:
'' 
'' I can do it with an otherwise superfluous array, something like
'' 
'' my @special = split /\n/, <<EOD;
'' ...
'' ...
'' EOD
'' 
'' and then
'' 
'' foreach (@special) {  _process_record_ }
'' 
'' but this seems clumsy.
'' 
'' Would some kind soul please help me out, or suggest a more harmonious
'' approach? 


    #!/opt/perl/bin/perl -w

    use strict;

    sub Here::TIESCALAR {bless [$_ [1] =~ /.*\n/g] => $_ [0];}
    sub Here::FETCH     {@{$_ [0]} ? shift @{$_ [0]} : undef;}

    tie my $string_handle => Here => <<EOT;
    This is line one.
    This is line two.
    This is line three.
    EOT

    my ($c, $l) = 0;
    while ($l = $string_handle) {
        print ++ $c, ": $l";
    }

    __END__
    1: This is line one.
    2: This is line two.
    3: This is line three.



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


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


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

Date: Tue, 23 Nov 1999 22:15:33 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: relation of cgi scripts and STDOUT (??)
Message-Id: <Pine.GSO.4.10.9911232213340.16575-100000@user2.teleport.com>

On Sat, 20 Nov 1999, Dimitrios Kremmydas wrote:

> if i close the STDOUT (close(STDOUT)), does the script kill itself ???

I'm not sure what you mean. If a program closes its own output filehandle,
that shouldn't terminate the program. If a program is writing to a pipe
and the reader closes that filehandle, the program will normally receive a
SIGPIPE which (by default) will kill it.

> if yes, how can i make the browser stop waiting for any more input
> from the script while the script will keep running ?

It sounds as if you want to make a browser do something. You should
probably search for the docs, FAQs, and newsgroups about working with
browsers. I'd recommend you start searching for the CGI programming FAQs.

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 24 Nov 1999 00:16:40 -0600
From: <tavi367@attglobal.net>
Subject: stupid user Q
Message-Id: <383b8243_1@news1.prserv.net>

I key the following in at the prompt, and it works just fine.

I get two messages, both with a body and a subject.

------------------------------------------------------------
walter}
walter} rmail -tw tavi@ussenterprise.com
Subject: this is a test
cc: tavi@earthling.net

this should be in the body
 .
walter}
------------------------------------------------------------

I then tried this in Perl...

------------------------------------------------------------
#!/usr/bin/perl -w

my $testMess = 'rmail -tw tavi@ussenterprise.com

Subject: this is a test
cc: tavi@earthling.net

this should be in the body
 .';

my $myResult = `$testMess`;

print $myResult;

#eof
------------------------------------------------------------

The screen just sits there until I do a Cntrl-C.

The message is sent, but only the TO and FROM is there, no Subject nor body.

What obvious thing am I missing here?

Walter





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

Date: Tue, 23 Nov 1999 23:18:28 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Test for eval() without using eval() ??
Message-Id: <Pine.GSO.4.10.9911232242530.16575-100000@user2.teleport.com>

On Tue, 23 Nov 1999 mkruse@netexpress.net wrote:

> My question is for CGI scripts which will be distributed to many
> people. I do not have control over their environment. Telling them to
> install certain tools is not an option. I write code that is designed
> to run without any dependencies at all.

Without any dependencies AT ALL! This is the most amazing thing I've heard
all week, and I've already heard Randal Schwartz proclaim "Today is My
Birthday!" on at least three separate days. (My theory: Compared to last
week, he's at least three years older.)

Since you're posting to a newsgroup about Perl, I can presume that your
code runs properly without being dependent upon a current version of Perl.
In fact, based upon the problem you posted at the start of this thread, it
sounds as if your programs don't even need Perl to be properly installed
so that all of its features are available.

But certainly these programs don't even depend upon Perl at all! Maybe
your programs are coded in some hypermetalanguage which is at the same
time source code and its own binary, so you won't be dependent upon any
compiler nor any interpreter. (And when you print the source/binary out in
132 columns, it makes an ASCII-art wall hanging as a tastefully-done nude
portrait of that girl who does "Sabrina the Teen-Age Witch".)

Wait! If there are no dependencies, then your code must run on Windows and
VMS, as well as Unix and the Mac. (With BeOS and Plan9 support coming in
version 4, in Q2 of '00.) It supports all standard browsers, and the
non-standard ones as well. In fact, the lucky remote user doesn't have to
have a properly-installed browser - your program will upgrade them on the
spot, even if they are using 'telnet 80'.

But surely your program is dependent upon some hardware. I mean, you can
probably emulate a 1024x800 display from a single pixel output device, if
you can get the user to spasmodically twitch and sneeze at the proper sync
frequency. But I'd think that you'd have to worry that, sooner or later,
you'll run out of paper tape for the underlying Turing machine, wouldn't
you? I mean, it is only _theoretically_ infinitely long.

Now, at this point, I can't see how you could possibly be dependent upon
any answers from this newsgroup. But if you ever decide to make slightly
less-capable programs, ones which require some smidgin of a prerequisite,
you might consider requesting that someone either (A) install a working
version of perl, or (B) name what they are using, say, "fake-perl". At
that point, there would be the slightest chance that if a program were to
peek at the $^X variable and see "fake-perl", it could know to abandon all
hope and die with an error message which can be read equally well by a
user fluent in English, Urdu, or Braille.

Hope this helps!

-- Tom, who wonders how well your programs run on a Nintendo GameBoy
powered by a 220v 50Hz diesel generator fueled with corn squeezins.



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

Date: Tue, 23 Nov 1999 23:26:47 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Understanding goto (was: Re: Help with understanding syntax)
Message-Id: <Pine.GSO.4.10.9911232323280.16575-100000@user2.teleport.com>

On 23 Nov 1999, Aaron Sherman wrote:

> > Yes, but the way `goto' works is by searching the program starting
> > from the beginning.  So it ends up looking at all the nonmatching
> > labels anyway.
> 
> I know that I'm a bit out of touch, but wasn't this the case a LONG
> time ago, and that was then fixed when labels became just another type
> of variable in perl5.000?

Labels aren't any type of variable. And I was told that goto worked
differently than that, too, but like you I'm far too apathetic about goto
to look in the perl source and see how it's really done.

> As I recall, this was one of the huge reasons for switching over to
> perl 5, because it also forced some reconciling of the way that return
> worked, which made return attractive for general use.

I can't see how this could be. But maybe that's because I don't understand
what you think was changed. Oh, well!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 24 Nov 1999 05:55:58 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: using regex to extract data
Message-Id: <O5L_3.529$6Y1.6324@nsw.nnrp.telstra.net>

On Tue, 23 Nov 1999 15:37:56 -0800,
	Jason Dreyer <jason.dreyerNOjaSPAM@home.com.invalid> wrote:
> There are many postings regarding how to extract matched lines from a
> log file.  But, I'm having trouble finding info on how to extract
> matched lines AFTER a line containing a specified date.

You could use the flipflop operator:

my @d;
while(<DATA>)
{
	next unless (/^Date and Time: Thu Oct 14 08:12:00 1999/ .. 0);
	push @d, (/^Description\s+:\s(.+)$/);
}

__DATA__
Date and Time: Wed Jul 07 08:07:44 1999

Description       : CuteFTP
Description       : Label Pro 3.0
Description       : WinZip (16-bit)

Date and Time: Thu Oct 14 08:12:00 1999

Description       : CuteFTP
Description       : GoZilla
Description       : WinZip (32-bit)

Date and Time: Thu Oct 28 08:16:00 1999

Description       : VirusScan 4.02
Description       : GoZilla
Description       : WinZip (32-bit)

read more about it in perlop:

# perldoc perlop

Of course, you need to adapt the start and end conditions to whatever
you need (the 0 just makes sure that it never ends, and in this case
that could be done more simply. Just illustrating a way of getting a
range of these things.)

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd.   | make up 3/4 of the population.
NSW, Australia                  | 


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

Date: Tue, 23 Nov 1999 19:51:35 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: using regex to extract data
Message-Id: <slrn83mdkn.ce6.tadmc@magna.metronet.com>

On Tue, 23 Nov 1999 15:37:56 -0800, Jason Dreyer <jason.dreyerNOjaSPAM@home.com.invalid> wrote:

>There are many postings regarding how to extract matched lines from a
>log file.  But, I'm having trouble finding info on how to extract
>matched lines AFTER a line containing a specified date.
>

>I need to be able to extract part of the "Description" lines after "Oct
>14 1999".


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

# skip until the record of interest
while (<DATA>) {
    last if /^Date and Time: Thu Oct 14 08:12:00 1999/;
}

# bail as soon as start of next record is seen
while (<DATA>) {
    chomp;
    next unless length;          # skip blank lines
    last if /^Date and Time:/;
    print "$_\n";                # replace with your processing
}


__DATA__
Date and Time: Wed Jul 07 08:07:44 1999

Description       : CuteFTP
Description       : Label Pro 3.0
Description       : WinZip (16-bit)

Date and Time: Thu Oct 14 08:12:00 1999

Description       : CuteFTP
Description       : GoZilla
Description       : WinZip (32-bit)

Date and Time: Thu Oct 28 08:16:00 1999

Description       : VirusScan 4.02
Description       : GoZilla
Description       : WinZip (32-bit)
-------------------------------------


>Also, I have tried the following code.

>if ($line =~ /Oct 14[^1999]/);
                     ^^^^^^^

   That is exactly equivalent to [^91] you know...

   I don't think Character Classes work the way you think they do.


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


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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

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


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


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