[17250] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4672 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 20 06:10:33 2000

Date: Fri, 20 Oct 2000 03:10:17 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <972036617-v9-i4672@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 20 Oct 2000     Volume: 9 Number: 4672

Today's topics:
        list of exit codes <kingsley@skymarket.get.co.rid..uk>
    Re: manipulating data files <bart.lateur@skynet.be>
    Re: matching balanced text (Robert C. Helling)
        Matching patterns in PDF? <sba@ocegr.fr>
    Re: Matching patterns in PDF? <krahnj@acm.org>
    Re: Matching patterns in PDF? <tward10@jaguar.com>
    Re: Object destructors not working properly? <lesley@natric.demon.co.uk>
    Re: Perl & mySql <bart.lateur@skynet.be>
        Perl Bin Path <livewire@enetis.net>
    Re: Perl Bin Path (Bernard El-Hagin)
    Re: Perl Bin Path <xzrgpnys@yvtugubhfrovm.pbz>
        POST into an other cgi script <jorgen@bos.nl>
    Re: POST into an other cgi script nobull@mail.com
    Re: POST into an other cgi script <jorgen@bos.nl>
        Posting from perl to "cgi" aviachili@my-deja.com
    Re: Regex and end of line wierdness <bart.lateur@skynet.be>
    Re: Rijndael in Perl <runu.knips@gmx.de>
        Stripping non-contents from HTML snippet <sba@ocegr.fr>
        table of contents newbie question <auday@mindspring.com>
    Re: table of contents newbie question (Gwyn Judd)
    Re: table of contents newbie question <bart.lateur@skynet.be>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 20 Oct 2000 10:26:16 +0100
From: "Kingsley Tart" <kingsley@skymarket.get.co.rid..uk>
Subject: list of exit codes
Message-Id: <CcUH5.140$bL1.5003@news6-win.server.ntlworld.com>

Does anyone know where I can get a list of exit codes? I'm forking
subprocesses and some of them are terminating with exit code 11 and showing
up as below when doing "ps aux" ("proggy" is the name of the program):

17:00   0:00 [proggy <defunct>]
17:00   0:00 [proggy <defunct>]
17:00   0:00 [proggy <defunct>]

This isn't the only exit code that is being strange, so a list would be
handy. However, this is the most important one at this stage. I've tried
searching the 'net for "exit code 11" but all I get is loads and loads of
irrelevant stuff :-(

--
Cheers,
Kingsley
Skymarket Ltd.
ICQ: 91927904






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

Date: Fri, 20 Oct 2000 09:20:11 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: manipulating data files
Message-Id: <a730vsg735a71m5ujed7trve87c0up0ln8@4ax.com>

Randy Harris wrote:

>> O.J. Simpson is innocent.
>>
>You never know.

This is very OT, but Godzilla mentioned this before. Well, according to
this BBC tv programma I've recently seen, it is extremely likely that
O.J.Simpson was framed, by certain members of the police. After all, the
evidence most have been tampered with: a lot of the blood samples found
at the scene of the crime, contained preservatives (intended for blood)!

That doesn't mean that O.J.Simpson is innocent. But it surely didn't go
the way the official version would like you to believe.

-- 
	Bart.


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

Date: 20 Oct 2000 08:15:45 GMT
From: helling@x4u2.desy.de (Robert C. Helling)
Subject: Re: matching balanced text
Message-Id: <slrn8uvvpg.2n2sj.helling@x4u2.desy.de>

In article <39EF4684.AFE5C96D@ipac.caltech.edu>, Tim Conrow wrote:
>There's an example in the write-up on the '(?>' assertion, but it's very
>limited. Probably you can do cool stuff with the (?{code}) and
>(?(condition)yes-pattern|no-pattern) assertions too, but in the end you're
>better off just getting the Text::Balanced module from CPAN, unless what you
>want is to play around with cutting edge REs.

Actually, I am not going to use it ;-). This is about a bet with a friend.
When we read those announcements, (they just said: Perl5.6 can handle
balanced expressions) we asked ourselves if the implementation would
be good enough also to handle escapes correctly, like not counting 
 ..something\) as close but ..something\\).

The example in perlre.pod does not treat this and I cannot think of
a neat implementation that is not a full parser by itself. (OT: This
always reminds me of a TeX faq: Is it possible to tell if a TeX
file has correct syntax? Ansewer: You have to implements the whole
typesetting system for that because of examples like

if witdh_of_box( some material ) > 100pt 
    exchange the meaning (i.e. catcodes) of \ and {
else
    exchange the meaning of { and }
endif

in pseudo code.

Robert

-- 
 .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oO
Robert C. Helling        Albert Einstein Institute Potsdam
                         Max Planck Institute For Gravitational Physics
                         and
                         2nd Institute for Theoretical Physics
                         DESY / University of Hamburg
                         Email helling@x4u2.desy.de  Fon +49 40 8998 4706      
			 <href=http://www.aei-potsdam.mpg.de/~helling>



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

Date: Fri, 20 Oct 2000 09:33:38 +0200
From: Stephane Barizien <sba@ocegr.fr>
Subject: Matching patterns in PDF?
Message-Id: <39EFF552.1FEF8763@ocegr.fr>

Hi,

I have an entire PDF file in $str, and would like to check if it
contains some patterns.

After some surfing I haven't been able to find a Perl module that would
"simply extract the text" from that PDF stream for me to m/// against.

Any clue?

TIA


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

Date: Fri, 20 Oct 2000 01:44:33 -0700
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Matching patterns in PDF?
Message-Id: <39F005F1.DD59F907@acm.org>

Stephane Barizien wrote:
> 
> I have an entire PDF file in $str, and would like to check if it
> contains some patterns.
> 
> After some surfing I haven't been able to find a Perl module that would
> "simply extract the text" from that PDF stream for me to m/// against.

You don't have to extract the text to use m// on the PDF file. Regular
expressions are not restricted to just text characters.

John


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

Date: Fri, 20 Oct 2000 10:17:56 +0100
From: "Trevor Ward" <tward10@jaguar.com>
Subject: Re: Matching patterns in PDF?
Message-Id: <8sp2k4$b2r11@eccws12.dearborn.ford.com>

PDF files use compression so you cannot check for normal text.

Also they use various control characters and layout format so if you want to
search the file this is possible but you have to specifically specify the
characters in the compressed form.

Oh yes there are various compressions including noene which can be used so
be aware that one search of the file will not resolve on all files.

but as this is probably not the answer your looking for sorry but can't do
anything about that
Stephane Barizien <sba@ocegr.fr> wrote in message
news:39EFF552.1FEF8763@ocegr.fr...
> Hi,
>
> I have an entire PDF file in $str, and would like to check if it
> contains some patterns.
>
> After some surfing I haven't been able to find a Perl module that would
> "simply extract the text" from that PDF stream for me to m/// against.
>
> Any clue?
>
> TIA




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

Date: Fri, 20 Oct 2000 10:18:44 +0100
From: "lesley withall" <lesley@natric.demon.co.uk>
Subject: Re: Object destructors not working properly?
Message-Id: <972033502.17625.0.nnrp-14.9e989efa@news.demon.co.uk>

Well the problem is it doesn't go wrong in a simple script...

this is essentially what I have (although this works)

package One;
use ObjectTemplate;
@ISA = qw(ObjectTemplate);

attributes qw(SubOne SubTwo);

sub DESTROY
{
my $self = shift;
print "in One DESTROY " . $self->SubOne->Testone;
}
package Two;
use ObjectTemplate;
@ISA = qw(ObjectTemplate);

attributes qw(SubThree);

sub DESTROY
{
my $self = shift;
print "in Two DESTROY" . $self->SubThree->Testone;
}
package Subone;
use ObjectTemplate;
@ISA = qw(ObjectTemplate);

attributes qw(Testone);

package main;

my $one = new One;
my $two = new Two;
$one->SubOne(Subone->new);
$two->SubThree($one->SubOne);

$one->SubTwo($two);
$one->SubOne->Testone("ONE");

print $one->SubOne->Testone;
print $two->SubThree->Testone;
print $one->SubTwo->SubThree->Testone;

On the actual system (which is large and complex) when it gets to the
equivalent of my package Two DESTROY method, the reference to the Subone
object has gone and I can't find anything that gets rid of it explicitly. It
feels like a timing problem to me... hence my original question... has
anyone else had problems? and should references to contained objects still
be around by the time it gets to the Destroy method of the container?

Thanks for your help.

"Darren Dunham" <ddunham@redwood.taos.com> wrote in message
news:lvHH5.683$YR.41630@news.pacbell.net...
> lesley withall <lesley@natric.demon.co.uk> wrote:
> > Has anyone had problems with object destructors? According to the
excellent
> > 'Programming Perl' - 'When the last reference to an object goes away,
the
> > object is automatically destroyed. '
>
> > My experience is that the object is destroyed when the first reference
is
> > deleted. I don't know how to debug this.. any ideas?
>
> We don't know what you're doing.  Perhaps a short example that
> demonstrates what you're having trouble with would help.  Could you post
> one?
>
> --
> Darren Dunham                                           ddunham@taos.com
> Unix System Administrator                    Taos - The SysAdmin Company
> Got some Dr Pepper?                           San Francisco, CA bay area
>       < Please move on, ...nothing to see here,  please disperse >




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

Date: Fri, 20 Oct 2000 08:12:09 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl & mySql
Message-Id: <nbvvuskp035fp6hjckjlvq6ckr87vvh36i@4ax.com>

John Plaxton wrote:

>Anyone got any good tutorials, books, recommendation etc. for using Perl
>with Mysql

This book seems to have been very well received:

	MySQL
	Paul Dubois
	New Riders

    <http://www.newriders.com/books/title.cfm?isbn=0735709211>


As for a short basic intro, there's the tutorial on WebMonkey:

<http://hotwired.lycos.com/webmonkey/backend/databases/tutorials/tutorial1.html>

-- 
	Bart.


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

Date: Fri, 20 Oct 2000 01:02:07 -0700
From: "Wade \"Boomer\" VanderBoom" <livewire@enetis.net>
Subject: Perl Bin Path
Message-Id: <39efeec3@news.enetis.net>

Still trying to resolve a problem with path directives for perl scripts on
Activestate perl.  I can run scripts if I change the path before hand; set
path=%perl%c:\perl\bin

But have to do that everytime to run from DOS prompt.  I was told to add
path=%perl%c:\perl\bin to autoexec.bat, didnt work, tried to add to
config.sys, didnt work.  Any suggestions as to how to set path so it will
re-direct to the c:\perl\bin?

typing set path=%perl%c:\perl\bin, only screws the loading of windows, can't
find the windows.com file then from conflict.

Suggestions are appreciated.




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

Date: 20 Oct 2000 07:19:41 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Perl Bin Path
Message-Id: <slrn8uvsii.28m.bernard.el-hagin@gdndev25.lido-tech>

On Fri, 20 Oct 2000 01:02:07 -0700, Wade \"Boomer\" VanderBoom
<livewire@enetis.net> wrote:
>Still trying to resolve a problem with path directives for perl scripts on
>Activestate perl.  I can run scripts if I change the path before hand; set
>path=%perl%c:\perl\bin
      ^^^^^^

Shouldn't that read:

path=%path%;c:\perl\bin 

>But have to do that everytime to run from DOS prompt.  I was told to add
>path=%perl%c:\perl\bin to autoexec.bat, didnt work, tried to add to
      ^^^^^^
And here-^

>config.sys, didnt work.  Any suggestions as to how to set path so it will
>re-direct to the c:\perl\bin?
>
>typing set path=%perl%c:\perl\bin, only screws the loading of windows, can't
>find the windows.com file then from conflict.

If you just made a typo (or three :) in this e-mail and are setting the
paths correctly then I don't understand where the problem lies. But if
those are the settings you tried to use in autoexec.bat correct them and
try again.

Cheers,
Bernard
--
perl -le'
($B,$e,$r,$n,$a,$r,$d)=q=$B$e$r$n$a$r$d==~m;
\$(.);xg;print$B.$e.$r.$n.$a.$r.$d;'


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

Date: 20 Oct 2000 07:24:01 GMT
From: kevin metcalf <xzrgpnys@yvtugubhfrovm.pbz>
Subject: Re: Perl Bin Path
Message-Id: <39EFF392.9DB1755B@yvtugubhfrovm.pbz>

Wade \"Boomer\" VanderBoom wrote:
> 
> Still trying to resolve a problem with path directives for perl scripts on
> Activestate perl.  I can run scripts if I change the path before hand; set
> path=%perl%c:\perl\bin
> 
> But have to do that everytime to run from DOS prompt.  I was told to add
> path=%perl%c:\perl\bin to autoexec.bat, didnt work, tried to add to
> config.sys, didnt work.  Any suggestions as to how to set path so it will
> re-direct to the c:\perl\bin?
> 
> typing set path=%perl%c:\perl\bin, only screws the loading of windows, can't
> find the windows.com file then from conflict.
> 
> Suggestions are appreciated.

For starters, you need to change %perl% to %PATH% unless you are first
executing a statement such as 'SET PERL=%PATH%.  Second, you need a
semicolon between %path% and c:\perl\bin.  Third, you cannot add this to
the config.sys, as this is an batch (reed cli interpreted) command.  You
must add it to the autoexec.bat.  If this is not working, you are not
adding it to the correct autoexec.bat.  Depending on what version of
winblows you are running, you may have to change C:\autoexec.bat, or
c:\windows\autoexec.bat or c:\autoexec.dos, or c:\windows\autoexec.dos,
or c:\windows\autoexec.xxx if you are using some types of virus checkers
or certain versions of norton.  I have acctually run into occurances of
each of these scenerios in the past.  Assuming you are running on
something build since 97, this should do the trick.  Add the following
line to c:\autoexec.bat:
set path=%PATH%;c:\perl\bin

WARNING: This is assuming the bin path of perl is in c:\perl\bin.  In
the event is it somewhere else, USE THAT PATH.

Kevin



--
To reply to email, untie the nots.  ;)


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

Date: Fri, 20 Oct 2000 09:53:00 +0200
From: "Jørgen Teunis" <jorgen@bos.nl>
Subject: POST into an other cgi script
Message-Id: <972028355.906517@proxy.bos.nl>

Hello,

I need to do a post into an other script. (kind of fake post)
Like i've a form and i post the value's into a script on another server like
this:

 form -> myscript -> other script

Then i want to write the page i get from the post into the other script.

Can anybody give me an example on how to do this?????????? PLEASE

Thanks,

Jørgen




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

Date: 20 Oct 2000 08:56:13 +0100
From: nobull@mail.com
Subject: Re: POST into an other cgi script
Message-Id: <u91yxbq4an.fsf@wcl-l.bham.ac.uk>

"Jørgen Teunis" <jorgen@bos.nl> writes because he's too lazy to read:

> I need to do a post into an other script. (kind of fake post)

This question is asked here every [expletive-deleted] day.  Sometimes
more often.

perldoc lwpcook

Please see also, the answers that were given to this question
yesterday, or the day before, or the day before that, or the day
before that...

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 20 Oct 2000 11:29:43 +0200
From: "Jørgen Teunis" <jorgen@bos.nl>
Subject: Re: POST into an other cgi script
Message-Id: <972034158.535136@proxy.bos.nl>


<nobull@mail.com> schreef in bericht news:u91yxbq4an.fsf@wcl-l.bham.ac.uk...
> "Jørgen Teunis" <jorgen@bos.nl> writes because he's too lazy to read:
>
> > I need to do a post into an other script. (kind of fake post)
>
> This question is asked here every [expletive-deleted] day.  Sometimes
> more often.
>
> perldoc lwpcook
>
> Please see also, the answers that were given to this question
> yesterday, or the day before, or the day before that, or the day
> before that...

Thanks mate....... but.... i don't think you read it yourself but only read
the word POST and toke you're own conclusions or i didn't ask my question
the right way...

Anyway.. want i want to do is let users post some data into myscript.cgi (my
script)
Then i want my script to do something with the data..... and then post that
data to a script wich isn't mine...

Understand? And i know how to do it using a get. But i want to submit it
trough a POST.

Like this:
user->"data"->myscript->"some manipulation"->SUBMIT with a POST into a
script, i didn't make or can't change..

GET THE IDEA???? I didn't saw a question of this type....

Thanks for helping

Greetz Jørgen




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

Date: Fri, 20 Oct 2000 08:13:14 GMT
From: aviachili@my-deja.com
Subject: Posting from perl to "cgi"
Message-Id: <8souqn$ksu$1@nnrp1.deja.com>

Hi,

Using a form, I am posting this to my perl
proggie:
user=michel&password=miriam
In perl I check the user and password for
validation BEFORE I sent the data over to the
excisting cgi.
Now the thing is, the second "CGI" does expect a
posted form. It uses PHP to take the values
posted and process them.
Now, HOW do you post from perl.
I nstead of calling a cgi like this: test.cgi?
username=blah&password=pass I want it to be
POSTED.

thanks,

Michel
info@netstyle.nl


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


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

Date: Fri, 20 Oct 2000 06:46:17 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Regex and end of line wierdness
Message-Id: <2aqvus03vrvl6bo2rhlalgva4e8qldsb07@4ax.com>

Matthew Enger wrote:

>$ip = "202.77.181.194\n";
>print CheckIP($ip);
>
>sub CheckIP {
>    my $ip = $_[0];
>    if ($ip =~ /^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/) {
>        return 1;
>    }
>    else {
>        return 0;
>    }
>}
>
>	I have noticed that the value in $ip is getting through and this is returning 0. Should this be happening?

You mean that it returns 1. Yes, it's annoying, and the only ways around
it are:

 * Make sure that your string doesn't contain a newline. For example,
you can test for /\n/.

 * Replace '$' with '\z', which *really* means end of string, not "end
of line".

That annoyance is the reason for which an RFC has been submitted for
Perl 6, to make the //s switch change '$' so that it only matches end of
string. Then, there's a way to make '$' behave. But not yet. Maybe not
ever.

-- 
	Bart.


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

Date: Fri, 20 Oct 2000 09:48:13 +0200
From: Runu Knips <runu.knips@gmx.de>
Subject: Re: Rijndael in Perl
Message-Id: <39EFF8BD.9B632D6@gmx.de>

those who know me have no need of my name wrote:
> <1eipo5k.cqrn9u17tsqe1N%tony@svanstrom.com> divulged:
> 
> >Anyone that knows if Rijndael exists in Perl yet and/or if someone's
> >working on it?
> 
> ummm.  how would one protect the plaintext?

I've no clue what you're actually asking. The plaintext is guarded
by transforming it to ciphertext using some encryption routine, for
example Rijndael. But the simple fact that you know what 'plaintext'
is means you already know that.

So what do you want to know ???


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

Date: Fri, 20 Oct 2000 09:32:25 +0200
From: Stephane Barizien <sba@ocegr.fr>
To: Gisle Aas <gisle@aas.no>
Subject: Stripping non-contents from HTML snippet
Message-Id: <39EFF509.37DB5AD6@ocegr.fr>

Hi,

I have an entire HTML page in $str.

I want to detect if $str contains some patterns, but NOT within
"non-contents", like lists, comments, etc.

Concrete case: I have  the contents of
http://www.ddj.com/articles/2000/0010/0010toc.htm in $str, and I don't
want to find "Compression" within the "GO TO..." listbox in the upper
right.

I've tried Gisle Aas's HTML::FormatText but as it doesn't support tables
(yet) and that page (for instance) is just a big table, that won't do...

Any clue?

TIA


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

Date: Fri, 20 Oct 2000 00:16:56 -0400
From: "Nuey" <auday@mindspring.com>
Subject: table of contents newbie question
Message-Id: <8sogvm$qij$1@slb1.atl.mindspring.net>

Hello,

I have skimmed a dozen CGI books and hope this question is not too annoying.

I have a .doc file that is like a large flat file database.  It is a well
structured tab-delimited text file that exports from an Access database. Its
size is 800 pages in 8.5x11 format.  It has about 15000 records (or
paragraphs).  Each record has three fields.  The entire file is about 3 MB.

On my web site I will have a table of contents for this document.  The table
of contents has about 1000 entries.  Each table of contents entry correspond
to a group of several adjacent records in the flat file that comprise a
small "chapter".

Since downloading large html pages is slow, and in order to save the time of
my web-visitors, I imagine that each entry in the table of contents can be a
hyperlink that connects via cgi-perl to the flat file and quickly outputs a
"chapter" to the browser.

My ISP supports Perl scripts.  (I have installed a freeware hit counter
script and it works).  I have been searching the web for a script that
performs the above table of contents function.  Maybe this project is too
simple even for a script.  Does anyone know of a simple solution?

Thanks very much,
Nuey








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

Date: Fri, 20 Oct 2000 04:49:28 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: table of contents newbie question
Message-Id: <slrn8uvjml.4p3.tjla@thislove.dyndns.org>

I was shocked! How could Nuey <auday@mindspring.com>
say such a terrible thing:
>Hello,
>
>I have skimmed a dozen CGI books and

Oh Good!

> hope this question is not too annoying.

No I just *live* to answer posts like yours.

>I have a .doc file that is like a large flat file database.  It is a well
>structured tab-delimited text file that exports from an Access database. Its

Hell, sounds like the program will just write itself, doesn't it?

>size is 800 pages in 8.5x11 format.  It has about 15000 records (or
>paragraphs).  Each record has three fields.  The entire file is about 3 MB.
>
>On my web site I will have a table of contents for this document.  The table
>of contents has about 1000 entries.  Each table of contents entry correspond
>to a group of several adjacent records in the flat file that comprise a
>small "chapter".
>
>Since downloading large html pages is slow, and in order to save the time of
>my web-visitors, I imagine that each entry in the table of contents can be a

Now if Microsoft will just come up with that ESP Visual basic extension,
you wouldn't need Perl at all would you?

>hyperlink that connects via cgi-perl to the flat file and quickly outputs a
>"chapter" to the browser.

I suppose so, but I think you should go with the "everything in one
page" solution. After all, if it was hard to write, it should be hard to
read too. This will help weed out the users that aren't really
interested in what you have to offer from those who are the true
fanatics.

>My ISP supports Perl scripts.  (I have installed a freeware hit counter
>script and it works).

No it doesn't. Whoops, wrong thread!

>I have been searching the web for a script that performs the above
>table of contents function.  Maybe this project is too simple even for
>a script.  Does anyone know of a simple solution?

Hire a programmer.

-- 
Gwyn "bored as usual" Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Old minds are like old horses; you must exercise them if you wish to
keep them in working order.
-John Quincy Adams


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

Date: Fri, 20 Oct 2000 07:14:29 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: table of contents newbie question
Message-Id: <boqvus87ol485cpksob78v8rqof9v9uhht@4ax.com>

Nuey wrote:

>I have a .doc file that is like a large flat file database.  It is a well
>structured tab-delimited text file that exports from an Access database. Its
>size is 800 pages in 8.5x11 format.  It has about 15000 records (or
>paragraphs).  Each record has three fields.  The entire file is about 3 MB.

That doesn't sound like a .doc file. Oh well, you're free to choose
whatever file extension you like.

>On my web site I will have a table of contents for this document.  The table
>of contents has about 1000 entries.  Each table of contents entry correspond
>to a group of several adjacent records in the flat file that comprise a
>small "chapter".

Is your tab delimited text file exported in a sorted order? CChapters
grouped together?

That's one of the nice things of tab delimited text files vs. real
databases: you only have to set the order only once, when generating
this file. There's no reason to sort it again and again every time your
program reads the data; especially if the order is always the same.

>Since downloading large html pages is slow, and in order to save the time of
>my web-visitors, I imagine that each entry in the table of contents can be a
>hyperlink that connects via cgi-perl to the flat file and quickly outputs a
>"chapter" to the browser.

Been there, done that. Are you generating the HTML file on the fly from
this "database file"? Because there actually is no need. It's not like
the content is very dynamic, is it?

You can use a perl script to generate both the table of contents, and a
html file for each of the chapters. Nobody in the world will ever know
that your data consists of hundreds of files, instead of just one
database file. But it sure helps improving the speed. You don't even
need CGI: static pages are enough!

>I have been searching the web for a script that
>performs the above table of contents function.  Maybe this project is too
>simple even for a script.  Does anyone know of a simple solution?

It's not really "simple". I don't think a generic script can be made, or
that it's worth bothering, because what it should do depends strongly on
the structure of your records, and on the HTML you want outputted.

This is a relatively simple thing to write for a moderately experienced
Perl scripter. But you don't seem to be a programmer in any way, let
alone a Perl programmer, so it looks to me like it will be too difficult
for you to do. I won't even bother with giving too much details.

What you'd need to do is read this file into memory -- possibly in
chunks if it's too big for your computer, but make sure it's presorted
then; for example using the Text::CSV or Text::CSV_XS file. Sort and
group it according to chapter, and output a HTML file for each chapter,
and keep a list of the chapters. Finally, generate another HTML file for
the TOC. Upload the output files to your ISP server.

-- 
	Bart.


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

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


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