[9837] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3430 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 12 17:08:17 1998

Date: Wed, 12 Aug 98 14: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           Wed, 12 Aug 1998     Volume: 8 Number: 3430

Today's topics:
    Re: A Regexp problem <mjforder@earthling.net>
    Re: A Regexp problem <tchrist@mox.perl.com>
    Re: A Regexp problem (Craig Berry)
    Re: A Regexp problem <mjforder@earthling.net>
    Re: Analyzing HTTP traffic? (Mike)
        ANN:  Perl "FAQ-bot" (a query interface for the Perl FA <marty@solutionsoft.com>
        ANN: O'Reilly Perl Conference 2.0 - BOFs, etc. (Rich Morin)
        ANNOUNCEMENT: Perl HTML Docs available <tchrist@mox.perl.com>
        Calling closure syntax (Matt Knecht)
        CGI on Browser <lawrence_han@post1.com>
    Re: CGI on Browser (Miguel Cruz)
    Re: cgi on harddisk? (Craig Berry)
    Re: cgi <westmj@esvax.dnet.dupont.com>
    Re: changing access (but not modify) timestamp <rootbeer@teleport.com>
        File only for perl-Program writeable <zimmerth@fmi.uni-passau.de>
    Re: File only for perl-Program writeable <ccunning@socrates.mps.ohio-state.edu>
    Re: File::Copy (Gabor)
    Re: Help with HTML::Parser dzuy@my-dejanews.com
    Re: Help with HTML::Parser <aas@sn.no>
        How do I connect to an MS Access database from perl ? <sucheta@nmtec.com>
        How do you disable LWP auto-redirect on 302? <jon@resonate.com>
    Re: How to untaint a directory path? <tchrist@mox.perl.com>
    Re: IE 4.01 and flush to STDOUT or nonparsed Headers <rootbeer@teleport.com>
    Re: long story - fork & multiprocessing problem <jdporter@min.net>
    Re: LWP & 'HTTP/1.0' <aas@sn.no>
        NDBM_File and exists <jspears@usit.net>
        passing a hash to a method <hochgurt@fsl.noaa.gov>
    Re: Perl Style <upsetter@ziplink.net>
        Q: How to read a file piece by piece <pswaters@eos.ncsu.edu>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Wed, 12 Aug 1998 21:17:53 +0200
From: "Matthew J. Forder" <mjforder@earthling.net>
To: Greg Smolyn <smolyn@cs.ubc.ca>
Subject: Re: A Regexp problem
Message-Id: <35D1EA60.A0278F24@earthling.net>

Try this

/\q$OPENTAG\e/
/\q$CLOSETAG\e/

the \q \e are the quote delimiters which tell perl to ignore any metachars.

Matthew Forder


Greg Smolyn wrote:

> Okay, okay, so I'm sure there's enough of them on this group... How
> 'bout I add another. :)
>
> I basically have a program that needs to find open and closing tags in a
> document.  However, these tags can be just about anything (user defined
> in the document).  I put the open and closing tags in strings $OPENTAG
> and $CLOSETAG.  However, if the tags contain special characters (for
> example, /* and */ as open and closing tags respectively), then using
> /$OPENTAG/ or /$CLOSETAG/ to find the tags just doesn't seem to work.
> Is there a way to force /$OPENTAG/ or /$CLOSETAG/ to treat the contents
> as literal and not regexp special characters?
>
> Thanks very much for your help.
>
> --
>  -----------------------------------------------------------------
> |Greg Smolyn (smolyn@cs.ubc.ca)                       \    /      |
> |CSSS International Rep                            \   \  /   /   |
> |University of British Columbia Computing Science   \   \/   /    |
> |Vancouver, BC, Canada                               \  /\  /     |
> |Proud owner of a 75 VW Super Beetle aka Helmut       \/  \/      |
> |                                                 AirKooled Rulez |
>  -----------------------------------------------------------------
>



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

Date: 12 Aug 1998 19:53:46 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: A Regexp problem
Message-Id: <6qsrsa$68m$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, "Matthew J. Forder" <mjforder@earthling.net> writes:
:/\q$OPENTAG\e/
:/\q$CLOSETAG\e/
:
:the \q \e are the quote delimiters which tell perl to ignore any metachars.

That is incorrect.  You need to review perlfaq6 and perlfaq9.

--tom
-- 
With a PC, I always felt limited by the software available.  On Unix, I am
limited by my knowledge.  --Peter J. Schoenster <pschon@baste.magibox.net>


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

Date: 12 Aug 1998 20:27:14 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: A Regexp problem
Message-Id: <6qstr2$4p3$3@marina.cinenet.net>

Matthew J. Forder (mjforder@earthling.net) wrote:
: Try this
: 
: /\q$OPENTAG\e/
: /\q$CLOSETAG\e/
: 
: the \q \e are the quote delimiters which tell perl to ignore any metachars.

No, those need to be capitalized: \Q and \E.  Also, \E is superfluous at
the end of the pattern.  Also also, you can avoid having to do this for
each individual regex by doing

  $OPENTAG = quotemeta $OPENTAG;

and similarly for $CLOSETAG when the two are set.  \Q is basically
shorthand for an on-the-fly in-string call to quotemeta.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Wed, 12 Aug 1998 22:53:25 +0200
From: "Matthew J. Forder" <mjforder@earthling.net>
To: Craig Berry <cberry@cinenet.net>
Subject: Re: A Regexp problem
Message-Id: <35D200C4.8622B46E@earthling.net>

Oops! I apologise...I was working off the top of my head, and I couldn't remember
if the \q and \e needed to be capitilised. I guess that's what I get for leaving
all my books at work eh ;-)

Matt  =:-0

Craig Berry wrote:

> Matthew J. Forder (mjforder@earthling.net) wrote:
> : Try this
> :
> : /\q$OPENTAG\e/
> : /\q$CLOSETAG\e/
> :
> : the \q \e are the quote delimiters which tell perl to ignore any metachars.
>
> No, those need to be capitalized: \Q and \E.  Also, \E is superfluous at
> the end of the pattern.  Also also, you can avoid having to do this for
> each individual regex by doing
>
>   $OPENTAG = quotemeta $OPENTAG;
>
> and similarly for $CLOSETAG when the two are set.  \Q is basically
> shorthand for an on-the-fly in-string call to quotemeta.
>
> ---------------------------------------------------------------------
>    |   Craig Berry - cberry@cinenet.net
>  --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
>    |      Member of The HTML Writers Guild: http://www.hwg.org/
>        "Every man and every woman is a star."
>



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

Date: 12 Aug 1998 19:39:45 GMT
From: schutzmd@SPAMFREEjmu.edu (Mike)
Subject: Re: Analyzing HTTP traffic?
Message-Id: <6qsr21$mqq$1@lark.jmu.edu>

wayne.pierce@usa.net wrote:
>  What I have to do is scan all HTTP traffic on our network at the firewall
> (running BSD) and create log files for each domain.  In the log file for that
> domain it will have all the hosts that went there, total number of accesses,
> etc. (I haven't been told the full details yet).

Why add a middleman?  Your web server should already be making log files
(most can be configured to create seperate logs for seperate domains
hosted, to the best of my knowledge).  Instead of making an extra set of
log files, I would recommend using the ones that already exist, and use
Perl to generate the reports that you want.

- mike -


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

Date: Wed, 12 Aug 1998 12:02:43 -0700
From: Marty Ford <marty@solutionsoft.com>
Subject: ANN:  Perl "FAQ-bot" (a query interface for the Perl FAQs)
Message-Id: <35D1E6D3.4078@solutionsoft.com>

Hi,

I'd like to make everyone here aware of the new Perl "FAQ-bot"
now available at: http://www.querybot.com/faqbot.

The FAQ-bot lets you enter a question in your own words and 
then get an answer from the FAQ. We currently provide a
query interface for the General Perl FAQ, the Perl for Windows
FAQ and the Perl CGI Programming FAQ. We also support some of 
major FAQ's for HTML and JavaScript.

We hope the FAQ-bot will be of use--especially to the "Newbies"
who often overwhelm the newsgroups with questions that are
already answered in the FAQ. 

The system is designed to track performance and learn from
experience, so we expect that the accuracy of the interface will
get better as more people make use of it.

The FAQ-bot is supported by Querybot Corp., a new company focused
on natural language query interfaces, and Solutionsoft, the makers
of Perl Builder.

If you have any questions, suggestions or other feedback on the
FAQ-bot, please let me know.

Thanks,

Marty Ford
Solutionsoft

URL: http://www.querybot.com/faqbot

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

Try a 30-day evaluation copy of Perl Builder: 
The Visual Development Environment for Perl.
http://www.solutionsoft.com/perl.htm


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

Date: Wed, 12 Aug 1998 12:50:44 -0700
From: rdm@cfcl.com (Rich Morin)
Subject: ANN: O'Reilly Perl Conference 2.0 - BOFs, etc.
Message-Id: <rdm-1208981250460001@140.174.42.30>

Several BOFs (Birds-of-a-Feather Sessions) have been scheduled for the
evenings of the Perl Conference, and more will probably be announced on-
site.   http://conference.perl.com/pace/conf/confdocs/bof.html lists:

  Tuesday, August 18 

    7:00pm  Perl Mongers 
    8:00pm  San Francisco Perl Users Group 
            CPAN Testers
    9:00pm  #Perl 

  Wednesday, August 19 

    8:00pm  MacPerl
            Win32PRK
            Netscape (Directory Management with Perl)
    9:00pm  The Perl Institute
            Upcoming ActiveState Tools

Members of the Perl community are welcome to attend these events, which
will be held in meeting rooms of the Fairmont Hotel, in downtown San Jose.
(The Fairmont is about a block north of the San Jose Convention Center,
at 170 S. Market Street. It is well served by the Light Rail System.)  Ask
for the O'Reilly Perl Conference area, then look for BOF information.

Some other evening events are listed on the Perl Mongers' web page
(http://www.pm.org/ora_conf.html):

  Monday Night With Randal Schwartz
  (Monday, 8/17, ~7 pm; Tied House Brewery and Cafe, 65 N. San Pedro St)

  Fireside Chat With Jon Orwant
  (Tuesday, 8/18, ~8 pm; meet in the front of the hotel lobby,
   then follow the crowd, ~8-8:15 pm)

  Social Hour With Chip Salzenberg
  (Wednesday, 8/19, ~8 pm; meet in the front of the hotel lobby,
   then follow the crowd, ~9-9:15 pm)

-- 
Canta Forda Computer Laboratory       | Prime Time Freeware - quality 
UNIX consulting, training, & writing  | freeware at affordable prices
+1 415-873-7841                       | +1 408-433-9662   -0727 (Fax)
Rich Morin, rdm@cfcl.com              | www.ptf.com, info@ptf.com


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

Date: 12 Aug 1998 19:42:45 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: ANNOUNCEMENT: Perl HTML Docs available
Message-Id: <6qsr7l$68m$1@csnews.cs.colorado.edu>

In 12-48 hours, CPAN and its clones around the world will be updated with
a new HTML document tree for the complete (and I *really* mean complete)
Perl documentation.  Meanwhile, you can see what's available at

    http://www.perl.com/perl/newdocs/

Note that all subdirectories have complete index pages, like

    http://www.perl.com/perl/newdocs/lib/IO/
    http://www.perl.com/perl/newdocs/lib/CGI/

The "newdocs" component will be updated to the standard
paths as soon as CPAN propagates.

--tom

-- 
    last|perl -pe '$_ x=/(..:..)...(.*)/&&"'$1'"ge$1&&"'$1'"lt$2'
    That's gonna be tough for Randal to beat...  :-)
            --Larry Wall in  <1991Apr29.072206.5621@jpl-devvax.jpl.nasa.gov>


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

Date: Wed, 12 Aug 1998 20:17:54 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Calling closure syntax
Message-Id: <SLmA1.144$5P.868404@news2.voicenet.com>


In my current quest to try and grok OO programming, I'm at an annoying
point with closures.

I have a few instances of sub refs.  To generate them, I say something
like:

$code_ref = &gen_code_ref; # Need the & so $code_ref gets access to @_

To call it I say:

&$code_ref($arg1, $arg2);

Which, to me, is pretty ugly looking.  Is there a way to clean up this
syntax?  I'd like to get some first class treatment with my code refs
and be able to say:

$code_ref($arg1, $arg2);

Which, of course, will (hopefully) evolve into $obj_ref->code().  But I
want to take this one step at a time.

-- 
Matt Knecht - <hex@voicenet.com>


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

Date: Thu, 13 Aug 1998 02:29:47 +0800
From: Lawrence Han <lawrence_han@post1.com>
Subject: CGI on Browser
Message-Id: <35D1DF1B.4C1DD819@post1.com>

Hi there,

I am a new perl programmer.
I am able to run my perl 5.0 on win95. Consider the following:

print "Content-type: text/html\n\n";
print "<html><head><title>Nil</title></head>\n";
print "<body bgcolor=black text=white>\n";
print "<br>Hello World!</br></body></html>\n";

When I run on my DOS prompt C:\perl\perl hello.cgi, things seems to be
running smoothly. However when I launched my Netscape browser with the
URL pointing to the hello.cgi on my hard disk, the browser doesn't seem
to execute anything. I get the entire perl code printed out instead.
Please help.

lawrence_han@post1.com :)



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

Date: 12 Aug 1998 19:35:41 GMT
From: mnc@diana.law.yale.edu (Miguel Cruz)
Subject: Re: CGI on Browser
Message-Id: <6qsqqd$hrh$1@news.ycc.yale.edu>

Lawrence Han  <lawrence_han@post1.com> wrote:
> When I run on my DOS prompt C:\perl\perl hello.cgi, things seems to be
> running smoothly. However when I launched my Netscape browser with the
> URL pointing to the hello.cgi on my hard disk, the browser doesn't seem
> to execute anything. I get the entire perl code printed out instead.

CGI runs on servers, not on browsers. You need to come up with a web server
program (I do not know if the little one that comes with Windows 95 is
capable of CGI), tell it about Perl, and point your browser to your machine by
host address rather than file path.

miguel


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

Date: 12 Aug 1998 20:09:45 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: cgi on harddisk?
Message-Id: <6qssq9$4p3$1@marina.cinenet.net>

j (j@f.l) wrote:
: Is it possible to try cgi-script on my hard disk instead of on an online
: server?

Yes.

: If yes, please tell me how.

Run it from your command line rather than via your server.  Seriously,
it's that easy.  You'll want to set up the environment and/or command line
to simulate being in the server environment, of course.  If you use
CGI.pm, this becomes trivial.  You can examine the output produced to
confirm proper operation, or capture it to a file (e.g., via redirection)
and then view the resulting file with a browser.  In the latter case, you
may wish to manually trim the Content-type header first, or suppress its
generation until you go 'live' on a server.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 12 Aug 1998 20:04:51 GMT
From: Mike West <westmj@esvax.dnet.dupont.com>
Subject: Re: cgi
Message-Id: <6qssh3$fh9@topgun.es.dupont.com>

In article <6qds78$d00$1@perki.connect.com.au> Dean McDonald, 
dean@connect.com.au writes:

>sub output{
> open (FINGER,"finger $username|")||die "finger died\n"; while
> (<FINGER>){print;}
> }
>

Isn't that a security problem?  

http://www.w3.org/Security/Faq/www-security-faq.html


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

Date: Wed, 12 Aug 1998 19:01:03 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: changing access (but not modify) timestamp
Message-Id: <Pine.GSO.4.02.9808121158220.10161-100000@user2.teleport.com>

On Wed, 12 Aug 1998, Luis Bernardo wrote:

> I know how to modify timestamps with utime($atime,$mtime,"file"). But
> what I would like to do is to change the access timestamp without
> changing the modify timestamp.

Use stat() to get the previous values, then use the value you want to
keep. Hope this helps!

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



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

Date: Wed, 12 Aug 1998 22:29:37 +0100
From: Thomas Zimmermann <zimmerth@fmi.uni-passau.de>
Subject: File only for perl-Program writeable
Message-Id: <35D20941.D74812C0@fmi.uni-passau.de>

Hello!

I want to write a perl program which should write information into a
file on a web server (unix). But only the perl program should be able to
write it. How can I manage this?
Is it possible that I change the owner of the file to wwwrun and make it
only user writeable?

Thomas

--
Thomas Zimmermann, http://www.uni-passau.de/~zimmerth/
Cats: http://www.uni-passau.de/~zimmerth/mcp/
Comics: http://www.uni-passau.de/~zimmerth/comics/
StarTrek: http://www.uni-passau.de/~zimmerth/startrek/




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

Date: Wed, 12 Aug 1998 16:40:08 -0400
From: Chad Cunningham <ccunning@socrates.mps.ohio-state.edu>
To: Thomas Zimmermann <zimmerth@fmi.uni-passau.de>
Subject: Re: File only for perl-Program writeable
Message-Id: <35D1FDA7.2544317@socrates.mps.ohio-state.edu>



Thomas Zimmermann wrote:

> Hello!
>
> I want to write a perl program which should write information into a
> file on a web server (unix). But only the perl program should be able to
> write it. How can I manage this?
> Is it possible that I change the owner of the file to wwwrun and make it
> only user writeable?
>

Yep. On our server, the web server runs as the user www. If yours is wwwrun,
then use that. Just chown it and chmod 700 it.

> Thomas
>
> --
> Thomas Zimmermann, http://www.uni-passau.de/~zimmerth/
> Cats: http://www.uni-passau.de/~zimmerth/mcp/
> Comics: http://www.uni-passau.de/~zimmerth/comics/
> StarTrek: http://www.uni-passau.de/~zimmerth/startrek/





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

Date: 12 Aug 1998 20:55:36 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: File::Copy
Message-Id: <slrn6t40bt.7ap.gabor@guava.vmunix.com>

In comp.lang.perl.misc, Russ Allbery <rra@stanford.edu> wrote :
# Peredina <peredina@progress.com> writes:
# 
# > Using this module, is there a way to copy the correct permissions,
# > particularly the executable?
# 
# Nope.  You need to read them in from the source file and reapply them to
# the destination, and I don't know of a platform-independent way of doing
# that.  For Unix, you'd do something like:

If you use File::NCopy, it will do it for you.  Plus it can recursively
copy directories or more than one file to a directory.


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

Date: Wed, 12 Aug 1998 19:14:05 GMT
From: dzuy@my-dejanews.com
Subject: Re: Help with HTML::Parser
Message-Id: <6qspht$91p$1@nnrp1.dejanews.com>

In article <slrn6t1ie3.mdl.maurice@we-24-130-48-83.we.mediaone.net>,
  maurice@hevanet.com (Maurice Aubrey) wrote:
> On Tue, 11 Aug 1998 20:51:22 GMT, dzuy@my-dejanews.com <dzuy@my-dejanews.com>
> wrote:
> >Suppose I have the following chunk in my html file:
> >...
> ><select>
> ><option value=option1> This is option 1
> ><option value=option2> This is option 2
> ><option value=option3> This is option 3
> ></select>
> >...
> >
> >which displays an option menu with option 1, option 2, and option 3.
> >How can I use HTML::Parser or other module to parse the label "This is option
> ><n>" after the option tag?  Or how can I associate the label with each option
> >tag?  What I'm trying to do is to verify proper label to proper tag without
> >using the browser.
> >
> >I've looked at HTML::Parser's start, end and text methods.  I can get all
> >attr within the <> of the start and end tag.  I examine the value passed into
> >the text method and it seems to be a chunk of mixed text and tags which I
> >can't use.
>
> The string passed to text() should not contain any tags.  Have you tried
> it with just the snippet of HTML you provided above?
>
> You should be able to just create a subclass, and do something like this:
>
> sub start {
>   my $self = shift;
>   my($tag, $attr, $attrseq, $origtext) = @_;
>
>   $self->{is_option} = ($tag eq 'option' ? 1 : 0);
> }
>
> sub text {
>   my $self = shift;
>   my $text = shift;
>
>   if ($self->{is_option}) {
>     ... do something with the text
>   }
> }
>
	Yes, I've tried something similar to this and examined the $text passed
	in.  The problem is because I use parse_file method which calls parse
	and pass chunks of 2048 bytes of the html file, one at a time.  In some
	instance, the text is truncated because of the chunk just happens to
	end there.  I'm thinking of writing a method that parses out only
	the chunk which contains my tag info, then pass it to the parse method.
	I would then have to read the file, but so does parse_file.

> If there's the possibility of tags within the option strings, then you'll
> need to modify all of the methods to keep track of the current state,
> and build up the entire string.
>
	I don't mind overriding methods such as start, end, text, but overriding
	parse kind of defeats the purpose of inheriting Parser.

	Thanks for the tip.  I enjoyed the discussion.
> --
> Maurice Aubrey <maurice@hevanet.com>
>
> You think you know when you learn, are more sure when you can write,
> even more when you can teach, but certain when you can program.
>   - Alan Perlis
>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 12 Aug 1998 21:49:41 +0200
From: Gisle Aas <aas@sn.no>
Subject: Re: Help with HTML::Parser
Message-Id: <m31zqmq8tm.fsf@furu.g.aas.no>

dzuy@my-dejanews.com writes:

> In article <slrn6t1ie3.mdl.maurice@we-24-130-48-83.we.mediaone.net>,
>   maurice@hevanet.com (Maurice Aubrey) wrote:
> > On Tue, 11 Aug 1998 20:51:22 GMT, dzuy@my-dejanews.com <dzuy@my-dejanews.com>
> > wrote:
> > >Suppose I have the following chunk in my html file:
> > >...
> > ><select>
> > ><option value=option1> This is option 1
> > ><option value=option2> This is option 2
> > ><option value=option3> This is option 3
> > ></select>
> > >...
> > >
> > >which displays an option menu with option 1, option 2, and option 3.
> > >How can I use HTML::Parser or other module to parse the label "This is option
> > ><n>" after the option tag?  Or how can I associate the label with each option
> > >tag?  What I'm trying to do is to verify proper label to proper tag without
> > >using the browser.

The HTML-Parser-2.20 distribution contains a new parser module called
HTML::TokeParser.  It can solve your problem like this:

#!/usr/bin/perl
use HTML::TokeParser;
$p = HTML::TokeParser->new("file.html") || die;

while (my $op = $p->get_tag("option")) {
    my $label = $p->get_trimmed_text;
    print "$op->[1]{value}: $label\n";
}

-- 
Gisle Aas


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

Date: Wed, 12 Aug 1998 12:17:53 -0700
From: Sucheta Khot <sucheta@nmtec.com>
Subject: How do I connect to an MS Access database from perl ?
Message-Id: <35D1EA61.51E9@nmtec.com>

Could anybody please advice me on how do I connect to an Access database
from my perl scipt? 

Thanks,
Sucheta


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

Date: 12 Aug 1998 20:33:01 GMT
From: "Jon C. Hodgson" <jon@resonate.com>
Subject: How do you disable LWP auto-redirect on 302?
Message-Id: <35D1FBFE.65A4@resonate.com>

(I sent this before but it didn't appear to go thru... sorry)

How do you disable LWP auto-redirect on 302?

It appears to do this if a redirect response comes back & there is no
message body.

Thanks,

Jon


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

Date: 12 Aug 1998 19:58:25 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to untaint a directory path?
Message-Id: <6qss51$68m$3@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Tom Phoenix <rootbeer@teleport.com> writes:
:> I usually use $directory =~ /^(.*)$/;  Am I paranoid?
:    ($directory) = ($directory =~ /^(.*)$/);
:
:That makes sure that the name doesn't have a newline (if that's what you
:want to do). If the pattern fails to match, $directory will be undef,
:which is fine by me. Hope this helps!

I'm sure that the caret and dollar up there must mean something important
to you, but I for the life of me can't figure it out.  I think you should
leave them out.  And if you were paranoid, you'd be using /s.

--tom
-- 
    When in doubt, parenthesize.  At the very least it will let some
    poor schmuck bounce on the % key in vi.
            --Larry Wall in the perl man page 


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

Date: Wed, 12 Aug 1998 19:02:53 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: IE 4.01 and flush to STDOUT or nonparsed Headers
Message-Id: <Pine.GSO.4.02.9808121202200.10161-100000@user2.teleport.com>

On Wed, 12 Aug 1998, Michael Skj=F8tt Kj=E6r wrote:

> Can anybody tell me why this doesn't work in IE 4.01 and why it works
> in Netscape????

If you're following the proper protocol but some browser or server doesn't
cooperate, then it's the other program's fault. If you're not following
the protocol, then it's your fault. If you aren't sure about the protocol,
you should read the protocol specification. If you've read it and you're
still not sure, you should ask in a newsgroup about the protocol.

Hope this helps!

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



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

Date: Wed, 12 Aug 1998 15:11:24 -0400
From: John Porter <jdporter@min.net>
Subject: Re: long story - fork & multiprocessing problem
Message-Id: <35D1E8DC.5EB2@min.net>

Debbie Whitten wrote:
> 

Some tips: since time is so critical, avoid forking whenever
possible.  This includes calling system().  In your code I find:

> `date`;
> `ls -t $from`;
> system "mkdir -p $dir3_name";
> system "mv $from\/$file $dest_file 2>/dev/null";
> system "gzip -qf1 $dest_file 2>/dev/null";

All but the last of these can and should be replaced by the
equivalent perl code.
And that's true even if speed isn't important!


> But the system load went up to 18! 

What's wrong with a high load?  High load is only bad for
other people trying to use the system, and hopefully
no one is.  Dedicate 100% of your processing power to this 
task, if you can.


> ##
> ## Will be writing to a log file so turn on auto-flushing.
> ##
> 
> $| = 1;

Um, you are setting STDOUT to autoflush.  That's probably
what you want, but the comment is confusing, considering
you then open a log file for writing.


>     $lastfile = shift @files;
>     chomp ($lastfile);
>     foreach $file (@files) {
>         chomp ($file);

You can save a little time by chomping the list, rather
than each item as it comes off:

	chomp @files;
	$lastfile = shift @files;
	foreach $file ( @files ) {

I would suggest also spending a little effort on
optimizing your regexes (for speed).  I haven't looked
at yours closely, so maybe they're o.k.; but they
can get slow quick. (:-)

>	$dir2_name = $dir1_name . "\/" . $dir2;

You don't need to backwhack slashes in normal strings:

	$dir2_name = $dir1_name . "/" . $dir2;

-- 
John Porter


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

Date: 12 Aug 1998 21:24:59 +0200
From: Gisle Aas <aas@sn.no>
Subject: Re: LWP & 'HTTP/1.0'
Message-Id: <m3emumuho4.fsf@furu.g.aas.no>

"Jon C. Hodgson" <jon@resonate.com> writes:

> I'm using LWP to retrieve HTTP docs, but I've found that some servers
> require the HTTP version for the 'GET' header:
> 
> GET /path/file.html HTTP/1.0
>                     ^^^^^^^^
> 
> LWP's Request method does not add this (or I can't figure it out).

How did you figure out that LWP did not add this?
I can tell you that it does.  If you add a like like the following:

  use LWP::Debug '+';

to you script then you can watch the conversation that takes place on
the wire too.  You should be able to spot it there.

> How can I get the HTTP/1.0 to appear in the GET?

It is much harder to make it not appear.

-- 
Gisle Aas


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

Date: Wed, 12 Aug 1998 15:48:40 -0400
From: Jason Spears <jspears@usit.net>
Subject: NDBM_File and exists
Message-Id: <35D1F198.FC49CE94@usit.net>

I feel that I'm missing something fundamental, but...
The NDBM_File module (which appears to use Tie::Hash) does not define
an 'exists' method, nor, it seems, does ODBM_File, etc.

The documentation in 'the camel book' suggests that the 'exists'
method should be implemented for any tied hash implementation.

Help?

Jason Spears


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

Date: Wed, 12 Aug 1998 13:50:43 -0700
From: Brian <hochgurt@fsl.noaa.gov>
Subject: passing a hash to a method
Message-Id: <35D20023.DEF2912D@fsl.noaa.gov>



Greetings:

I'm trying to pass a hash to a method in an OO perl program I am
writing.
Once I pass the hash to the method, the $key and the $Tokens{$key}
values appear to be switched (so that the $key var has the actual value
of  what $Tokens{$key} should have).  I can't seem to figure out why,
but I suspect
that it has to do with an object in PERL being a hash as well.  I have
tried to pass by reference without much luck.

I am using ObjectTemplate.pm that was part of the code included
with the Advanced Perl Programming book.

Here's the program:

#!/usr/local/bin/perl

use CGI;

require("Test.pl");

use CGI qw(:cgi-lib :standard);
&ReadParse(*SubTokens);

$atmos = Form->new();

$Language = "en";

$atmos->lang($Language);
$atmos->user($ENV{'REMOTE_USER'});

print "Content-type: text/html\n\n";
$atmos->printout(%SubTokens);

here are  my methods:

package Form;
use ObjectTemplate;
@ISA = qw(ObjectTemplate);
attributes qw(user lang);

sub printout {

  local(%Tokens) = @_; #tried my as well

  foreach $key (keys %Tokens)
  {
 #$key prints out the value of $Tokens{$key}
 # $Tokens{$key} prints out the value for $key.
 # Confusing eh?
 print "Key:$key  $Tokens{$key} <BR>";
  }

}

I think I'm doing something very basic wrong,  and I'm wondering if
there's a trick to passing a hash into a method.

I'd appreciate any feedback.

Thanks,
Brian




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

Date: 12 Aug 1998 19:08:44 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Perl Style
Message-Id: <6qsp7s$akn@fridge.shore.net>

Tom Christiansen <tchrist@mox.perl.com> wrote:

: That doesn't mean all ways are equally desirable. And exchanging
: all symbolic notation for namby-pamby wordies isn't one of the
: desirable ways.

So is Perl broken because it includes such a wimpy syntax?

: Why don't you just kill file me instead of continuing your whining?

I was about to ask you the same thing!

--Art

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


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

Date: Wed, 12 Aug 1998 15:22:15 -0400
From: TeXaS <pswaters@eos.ncsu.edu>
Subject: Q: How to read a file piece by piece
Message-Id: <Pine.SOL.3.96.980812150809.29406A-100000@cc02du.unity.ncsu.edu>

I have setup a Perl script that will allow someone to download a directory
or few via HTTP as a tgz or zip file.  One problem that I have hit is that
I don't know of a way to load the tgz or zip file piece by piece as it is
being delivered to keep the entire file from being loaded into memory
all at once.   I have included this section of code so anyone can make
suggestions on what to do.  Thanks

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

sub Send_As_tgz {
   system("$TAR -C $Rwhere -czf /tmp/tar-em.pl.$pid.tgz $who");
   open (TEMPFILE, "/tmp/tar-em.pl.$pid.tgz");
   unlink ("/tmp/tar-em.pl.$pid.tgz");
   print "Content-Type: application/zip\n";
   print "Content-Disposition: attachment;  filename=\"$file_name.tgz\"\n\n";
   print <TEMPFILE>;
   close (TEMPFILE);
}

Comments for code:
  $TAR is set to location of tar
  $Rwhere is set to the directory where stuff is being retrieved from
  $who is set to what files/directories are requested
  $file_name.tgz is set to requested.tgz
--
  First I tar the requested stuff, open the file (which loads the entire
thing into memory - what I want to avoid) and then deletes the file.
Lastly the file is sent.  The reason I delete the file before sending it
is so that it will be deleted even if the user hits cancel before
downloading.

And to make everyone happy, security measures have been taken, they are
implemented before this subroutine is called.

Thank you for any help.

+-----------------------------------------------------------------------+
 Trey Waters                                       pswaters@eos.ncsu.edu
                  "Never meddle in the affairs of dragons
                 for you are crunchy and good with ketchup."
+-----------------------------------------------------------------------+



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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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