[32928] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4205 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 2 06:09:31 2014

Date: Fri, 2 May 2014 03:09:04 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 2 May 2014     Volume: 11 Number: 4205

Today's topics:
    Re: How do I get the text that is found by a regular ex <news@todbe.com>
    Re: IO::Socket  client <hjp-usenet3@hjp.at>
    Re: IO::Socket  client <news@todbe.com>
    Re: IO::Socket  client <news@todbe.com>
    Re: IO::Socket  client <hjp-usenet3@hjp.at>
    Re: IO::Socket  client <news@todbe.com>
    Re: IO::Socket  client <hjp-usenet3@hjp.at>
    Re: IO::Socket  client <news@todbe.com>
    Re: More general programming than perl... <whynot@pozharski.name>
    Re: More general programming than perl... <justin.1401@purestblue.com>
    Re: More general programming than perl... <justin.1401@purestblue.com>
    Re: More general programming than perl... <stevem_@nogood.com>
    Re: More general programming than perl... <justin.1401@purestblue.com>
    Re: More general programming than perl... <rweikusat@mobileactivedefense.com>
    Re: More general programming than perl... <justin.1401@purestblue.com>
    Re: More general programming than perl... <stevem_@nogood.com>
    Re: More general programming than perl... <stevem_@nogood.com>
    Re: More general programming than perl... <whynot@pozharski.name>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 30 Apr 2014 21:22:08 -0700
From: "$Bill" <news@todbe.com>
Subject: Re: How do I get the text that is found by a regular expression?
Message-Id: <ljsi5h$9dp$1@dont-email.me>

On 4/30/2014 11:51, scottcabit@gmail.com wrote:
>
>    Here is the subroutine I am calling each time the File::Find finds a word document for me to check:
>
> sub rTxt {
>
>      # We only want .doc files (no links...)
>      return unless /\.doc$/ && -f && ! -l;
>
>      # Open document
>      my $doc = $MSWord->Documents->Open({FileName=>$File::Find::name});
>
>      # Exit nicely if we couldn't open doc
>      return unless $doc;
>
>      my $content=$doc->Content;
>      my $find=$content->Find;
>
> # The following pattern finds all document numbers
>      $find->{Text} = m/(\d{3}-\d{4}-\d{3})/;

The m// is working on $_ - I assume there's something in $_ like the file name ?
Are you looking for doc #s in the file name or file content ?
What's in {Text} or are you trying to put something in there ?
If you had all of the doc text in $_ that would give you a list of them in {Text}.
if $content contains the data with the doc #s, you want to use that instead of $_:

	my @docnums = $content =~ /(\d{3}-\d{4}-\d{3})/gs;

would give you all the doc #s in the file.

> if ($find->Execute()) {
>      print "The search text was found in $File::Find::name\n";
>      printf TextFile ("%s\n", $File::Find::name);
>      printf TextFile ($1."\n");
>    } else {
>      print ".";
>    }
>      # Close document
>      $doc->Close();
> }
>
>    Is there any easy way to search the whole document for every occurrence that matches my pattern? Do I have to copy the whole document text first and then search it?
>
> Thanks
>


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

Date: Thu, 1 May 2014 08:05:19 +0200
From: "Peter J. Holzer" <hjp-usenet3@hjp.at>
Subject: Re: IO::Socket  client
Message-Id: <slrnlm3p11.4bf.hjp-usenet3@hrunkner.hjp.at>

On 2014-05-01 04:01, $Bill <news@todbe.com> wrote:
> On 4/30/2014 02:38, George Mpouras wrote:
>> -- hey client, I am going to send you a file so big
>> ++ ok server
>
> You should be able to just send the file with a proper header saying what it is.
>
>> -- now lets exchange some small control messages
>> ++ ok server
>
> Again, you don't have to tell the server what you're going to do,
> just prepend a header saying what it is.

What's the difference between "telling the server what you are going to
do" and "prepending a header saying what it is"? 

        hp


-- 
   _  | Peter J. Holzer    | Fluch der elektronischen Textverarbeitung:
|_|_) |                    | Man feilt solange an seinen Text um, bis
| |   | hjp@hjp.at         | die Satzbestandteile des Satzes nicht mehr
__/   | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel


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

Date: Thu, 01 May 2014 02:46:41 -0700
From: "$Bill" <news@todbe.com>
Subject: Re: IO::Socket  client
Message-Id: <ljt55v$6i0$1@dont-email.me>

On 4/30/2014 23:05, Peter J. Holzer wrote:
> On 2014-05-01 04:01, $Bill <news@todbe.com> wrote:
>> On 4/30/2014 02:38, George Mpouras wrote:
>>> -- hey client, I am going to send you a file so big
>>> ++ ok server
>>
>> You should be able to just send the file with a proper header saying what it is.
>>
>>> -- now lets exchange some small control messages
>>> ++ ok server
>>
>> Again, you don't have to tell the server what you're going to do,
>> just prepend a header saying what it is.
>
> What's the difference between "telling the server what you are going to
> do" and "prepending a header saying what it is"?

One msg instead of 2 or 3 ?





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

Date: Thu, 01 May 2014 02:49:23 -0700
From: "$Bill" <news@todbe.com>
Subject: Re: IO::Socket  client
Message-Id: <ljt5b1$6i0$2@dont-email.me>

On 5/1/2014 02:46, $Bill wrote:
> On 4/30/2014 23:05, Peter J. Holzer wrote:
>> On 2014-05-01 04:01, $Bill <news@todbe.com> wrote:
>>> On 4/30/2014 02:38, George Mpouras wrote:
>>>> -- hey client, I am going to send you a file so big
>>>> ++ ok server
>>>
>>> You should be able to just send the file with a proper header saying what it is.
>>>
>>>> -- now lets exchange some small control messages
>>>> ++ ok server
>>>
>>> Again, you don't have to tell the server what you're going to do,
>>> just prepend a header saying what it is.
>>
>> What's the difference between "telling the server what you are going to
>> do" and "prepending a header saying what it is"?
>
> One msg instead of 2 or 3 ?

Plus maybe some extra unnecessary state information that the
server has to keep track of.  Instead of sending control msgs,
you just send the data or a request for data - much simpler if
the scenario allows for it.




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

Date: Thu, 1 May 2014 13:26:23 +0200
From: "Peter J. Holzer" <hjp-usenet3@hjp.at>
Subject: Re: IO::Socket  client
Message-Id: <slrnlm4bqv.nam.hjp-usenet3@hrunkner.hjp.at>

On 2014-05-01 09:46, $Bill <news@todbe.com> wrote:
> On 4/30/2014 23:05, Peter J. Holzer wrote:
>> On 2014-05-01 04:01, $Bill <news@todbe.com> wrote:
>>> On 4/30/2014 02:38, George Mpouras wrote:
>>>> -- hey client, I am going to send you a file so big
>>>> ++ ok server
>>> You should be able to just send the file with a proper header saying
>>> what it is.
>>>
>>>> -- now lets exchange some small control messages
>>>> ++ ok server
>>>
>>> Again, you don't have to tell the server what you're going to do,
>>> just prepend a header saying what it is.
>>
>> What's the difference between "telling the server what you are going to
>> do" and "prepending a header saying what it is"?
>
> One msg instead of 2 or 3 ?

Nobody said that you have to "tell the server what you are going to do"
in a separate message. And the concept of "message" in a stream-based
protocol is a bit hazy, anyway. 

If an HTTP server sends something like this

    200 OK
    Content-Type: text/html
    Size: 1234

    <html>...

is this one message (a file with a prepended header) or two (the first
one tells the client "I'm going to send to you an HTML file with 1234
bytes", the second contains the file)? I don't see the difference. In
any case, after reading the header the client knows what the server is
going to do (or at least promised to do).

        hp


-- 
   _  | Peter J. Holzer    | Fluch der elektronischen Textverarbeitung:
|_|_) |                    | Man feilt solange an seinen Text um, bis
| |   | hjp@hjp.at         | die Satzbestandteile des Satzes nicht mehr
__/   | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel


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

Date: Thu, 01 May 2014 18:06:59 -0700
From: "$Bill" <news@todbe.com>
Subject: Re: IO::Socket  client
Message-Id: <ljur3i$tnd$1@dont-email.me>

On 5/1/2014 04:26, Peter J. Holzer wrote:
>
> Nobody said that you have to "tell the server what you are going to do"
> in a separate message. And the concept of "message" in a stream-based
> protocol is a bit hazy, anyway.
>
> If an HTTP server sends something like this
>
>      200 OK
>      Content-Type: text/html
>      Size: 1234
>
>      <html>...
>
> is this one message (a file with a prepended header) or two (the first
> one tells the client "I'm going to send to you an HTML file with 1234
> bytes", the second contains the file)? I don't see the difference. In
> any case, after reading the header the client knows what the server is
> going to do (or at least promised to do).

If you do it with a single msg, it's easier than with 2 or 3 msgs.
You don't have to keep state information on the socket (or keep the same
socket open for that matter).

All I'm saying is it's cleaner to keep the msgs to a minimum and eliminate
most control msgs.  If you feel differently - fine - we all have opinions.




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

Date: Fri, 2 May 2014 11:03:26 +0200
From: "Peter J. Holzer" <hjp-usenet3@hjp.at>
Subject: Re: IO::Socket  client
Message-Id: <slrnlm6nqu.92q.hjp-usenet3@hrunkner.hjp.at>

On 2014-05-02 01:06, $Bill <news@todbe.com> wrote:
> On 5/1/2014 04:26, Peter J. Holzer wrote:
>> Nobody said that you have to "tell the server what you are going to do"
>> in a separate message. And the concept of "message" in a stream-based
>> protocol is a bit hazy, anyway.
>>
>> If an HTTP server sends something like this
>>
>>      200 OK
>>      Content-Type: text/html
>>      Size: 1234
>>
>>      <html>...
>>
>> is this one message (a file with a prepended header) or two (the first
>> one tells the client "I'm going to send to you an HTML file with 1234
>> bytes", the second contains the file)? I don't see the difference. In
>> any case, after reading the header the client knows what the server is
>> going to do (or at least promised to do).
>
> If you do it with a single msg, it's easier than with 2 or 3 msgs.

You haven't answered any of my points. Neither have you given a reason
why "telling the server what you are going to do" would have to be in a
separate message, nor have you answered whether the above is one message
or two (or five). And for the latter question I would like to see a
better reason than "because rfc 2616 says so".

> You don't have to keep state information on the socket (or keep the same
> socket open for that matter).

How does the state information needed to read the HTTP response above
change whether you view it as one or two (or five) messages?

> All I'm saying is it's cleaner to keep the msgs to a minimum and eliminate
> most control msgs.  If you feel differently - fine - we all have opinions.

No, that's not my point at all. My point is that you are making
assumptions which aren't founded in anything written before in this
thread.

        hp


-- 
   _  | Peter J. Holzer    | Fluch der elektronischen Textverarbeitung:
|_|_) |                    | Man feilt solange an seinen Text um, bis
| |   | hjp@hjp.at         | die Satzbestandteile des Satzes nicht mehr
__/   | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel


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

Date: Fri, 02 May 2014 03:01:24 -0700
From: "$Bill" <news@todbe.com>
Subject: Re: IO::Socket  client
Message-Id: <ljvqdm$8sd$1@dont-email.me>

On 5/2/2014 02:03, Peter J. Holzer wrote:
>
> You haven't answered any of my points. Neither have you given a reason
> why "telling the server what you are going to do" would have to be in a
> separate message, nor have you answered whether the above is one message
> or two (or five). And for the latter question I would like to see a
> better reason than "because rfc 2616 says so".

Sure I did.  Using more than 1 msg necessitates state info and probably
maintaining an open socket.

>> You don't have to keep state information on the socket (or keep the same
>> socket open for that matter).
>
> How does the state information needed to read the HTTP response above
> change whether you view it as one or two (or five) messages?

You don't need state info if there's only 1 msg.

>> All I'm saying is it's cleaner to keep the msgs to a minimum and eliminate
>> most control msgs.  If you feel differently - fine - we all have opinions.
>
> No, that's not my point at all. My point is that you are making
> assumptions which aren't founded in anything written before in this
> thread.

I think you just want to argue.  I was responding to George's scenario:

	when you want complex things like.

	-- hey client, I am going to send you a file so big
	++ ok server
	-- now lets exchange some small control messages
	++ ok server
	-- now get a big serialized data structure
	++ not everything is defined
	-- ops client I did not like your answer, wait for three messages for me

Like I said earlier - if you want to interpret that differently than I - go ahead,
but it seemed overly complex to me.  OAO





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

Date: Thu, 01 May 2014 12:29:52 +0300
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: More general programming than perl...
Message-Id: <slrnlm450g.3fq.whynot@orphan.zombinet>

with <be373b-kaa.ln1@zem.masonsmusic.co.uk> Justin C wrote:

*SKIP*
> I need to prepare a "Latest Products" document, the ...

Please, define "document".

*CUT*

-- 
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom


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

Date: Thu, 1 May 2014 12:43:02 +0100
From: Justin C <justin.1401@purestblue.com>
Subject: Re: More general programming than perl...
Message-Id: <6jo93b-qt1.ln1@zem.masonsmusic.co.uk>

On 2014-04-30, George Mpouras <gravitalsun@hotmail.foo> wrote:
> it does not look very difficult task.
> You need some sql queries through DBI and create the documents using e.g 
> the html template .

Thank you for not answering the question. Telling me what I already 
know is very profitable use of both your time and mine. Thank you 
for your lack of assistance in this matter.


   Justin.

-- 
Justin C, by the sea.


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

Date: Thu, 1 May 2014 12:49:45 +0100
From: Justin C <justin.1401@purestblue.com>
Subject: Re: More general programming than perl...
Message-Id: <pvo93b-qt1.ln1@zem.masonsmusic.co.uk>

On 2014-04-30, gamo <gamo@telecable.es> wrote:
> El 30/04/14 13:29, Justin C escribió:
>> I will be coding this in perl, but I can't yet get my head
>> around how I'm going to achieve what I want, maybe people
>> here can offer suggestions on how I might proceed -
>> obviously in broad terms, code is a way off at the moment
>> I think.
>>
>> I need to prepare a "Latest Products" document, the
>> contents are coming from a database, I've got to fill the
>> document with the latest and stop when the document is 24
>> pages, however, the document runs chronologically from
>> oldest to newest. I'm trying to work out how I can decide
>> which item/date to put at the start of the document, so I
>> don't run out of data before 24 pages, or over-run 24
>> pages.
>>
>> Information is broken up into date sections (listing new
>> products for that day), there are varying amounts of data
>> for each date, from a few lines to more than a page. There
>> is a section heading which is larger than a line of data,
>> and there is a vertical space between sections, so how
>> many lines I can fit on a page depends on how many
>> sections there will be.
>>
>> Every page starts with a section/date heading regardless
>> of whether it's a continuation of the section on the
>> previous page or not.
>>
>> Any suggestions one how I might, programatically, decide
>> where I should begin my document?
>>
>>
>>
>>     Justin.
>>
>
> I assume you can produce 100 pages.
>
> Just produce 25 pages and then do 'intelligent' cuts, like
> based on section length, recentness, etc. until it fits in
> 24 pages.


Yes, I can see that's an option. It doesn't seem very 
economical though, I can foresee a time when I could 
produce 10,000 pages and my CPU and RAM would be occupied 
for an unnecessary length of time.

I could run it this way once, and then record where the 
cut falls, and refer to that position as my start point
for next time. Then remove the oldest and record a new
cut/starting point.

Thank you for the suggestion.


   Justin.

-- 
Justin C, by the sea.


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

Date: Thu, 01 May 2014 08:04:12 -0700
From: Steve May <stevem_@nogood.com>
Subject: Re: More general programming than perl...
Message-Id: <Nnt8v.91497$Pk4.2982@fx28.iad>

On 04/30/2014 04:29 AM, Justin C wrote:
> I will be coding this in perl, but I can't yet get my head
> around how I'm going to achieve what I want, maybe people
> here can offer suggestions on how I might proceed -
> obviously in broad terms, code is a way off at the moment
> I think.
>
> I need to prepare a "Latest Products" document, the
> contents are coming from a database, I've got to fill the
> document with the latest and stop when the document is 24
> pages, however, the document runs chronologically from
> oldest to newest. I'm trying to work out how I can decide
> which item/date to put at the start of the document, so I
> don't run out of data before 24 pages, or over-run 24
> pages.
>
> Information is broken up into date sections (listing new
> products for that day), there are varying amounts of data
> for each date, from a few lines to more than a page. There
> is a section heading which is larger than a line of data,
> and there is a vertical space between sections, so how
> many lines I can fit on a page depends on how many
> sections there will be.
>
> Every page starts with a section/date heading regardless
> of whether it's a continuation of the section on the
> previous page or not.
>
> Any suggestions one how I might, programatically, decide
> where I should begin my document?
>
>
>
>     Justin.
>

Seems like this approach might work:

Fill a list with records (hash-refs)  sorted new to old. Limit to some 
reasonable number knowing that you can always add a few more if needed.

Trial print the list while tracking the record count and page count to 
determine how many records you can print from the list.

Take a slice from the list based on how many records needed (above), and 
reverse it.

Print.

hth,

Steve


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

Date: Thu, 1 May 2014 15:25:30 +0100
From: Justin C <justin.1401@purestblue.com>
Subject: Re: More general programming than perl...
Message-Id: <q32a3b-iec.ln1@zem.masonsmusic.co.uk>

On 2014-05-01, Eric Pozharski <whynot@pozharski.name> wrote:
> with <be373b-kaa.ln1@zem.masonsmusic.co.uk> Justin C wrote:
>
> *SKIP*
>> I need to prepare a "Latest Products" document, the ...
>
> Please, define "document".

I am not sure it is relevant to the question I asked, but my
document is actually an Excel spreadsheet which will be printed 
as a PDF.

The reason is that historically this document has always come 
from an Excel file, and now we no longer wish to maintain the
document and instead are putting the data into a DB and intend
to work from that instead. Maybe, at a later date, I'll bypass
the Excel file if it turns out no one actually wants it in that
format, and go straight to PDF.

   Justin.

-- 
Justin C, by the sea.


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

Date: Thu, 01 May 2014 16:30:40 +0100
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: More general programming than perl...
Message-Id: <874n19y0rj.fsf@sable.mobileactivedefense.com>

Steve May <stevem_@nogood.com> writes:

[...]

> Seems like this approach might work:
>
> Fill a list with records (hash-refs)  sorted new to old. Limit to some
> reasonable number knowing that you can always add a few more if
> needed.

As I already wrote: The pages can be build backwards while accumlating
records. That is, for each new record, the size including a possible
leading 'day sections header' is calculated. If it still fits in front
of the most recently added record on the current page, it is added to
that, otherwise, it becomes the first entry on the next page. This
process is repeated until 24 pages of output have been accumulated.

In case there are less than 24 pages, a 2nd pass can be used to pull
'entries to preceeding pages' so that the last page ends up being
'partially filled' instead of the first page.

This is not really difficult provide one can overcome the notion that
'stuff has to happen forwards' (something even "well known OSS
celebrities" reportedly find difficult :->) and that 'the size' must be
calculated in one go instead of incrementally.


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

Date: Thu, 1 May 2014 16:47:14 +0100
From: Justin C <justin.1401@purestblue.com>
Subject: Re: More general programming than perl...
Message-Id: <2t6a3b-s9i.ln1@zem.masonsmusic.co.uk>

On 2014-05-01, Steve May <stevem_@nogood.com> wrote:
> On 04/30/2014 04:29 AM, Justin C wrote:
>> I will be coding this in perl, but I can't yet get my head
>> around how I'm going to achieve what I want, maybe people
>> here can offer suggestions on how I might proceed -
>> obviously in broad terms, code is a way off at the moment
>> I think.
>>
>> I need to prepare a "Latest Products" document, the
>> contents are coming from a database, I've got to fill the
>> document with the latest and stop when the document is 24
>> pages, however, the document runs chronologically from
>> oldest to newest. I'm trying to work out how I can decide
>> which item/date to put at the start of the document, so I
>> don't run out of data before 24 pages, or over-run 24
>> pages.
>>
>> Information is broken up into date sections (listing new
>> products for that day), there are varying amounts of data
>> for each date, from a few lines to more than a page. There
>> is a section heading which is larger than a line of data,
>> and there is a vertical space between sections, so how
>> many lines I can fit on a page depends on how many
>> sections there will be.
>>
>> Every page starts with a section/date heading regardless
>> of whether it's a continuation of the section on the
>> previous page or not.
>>
>> Any suggestions one how I might, programatically, decide
>> where I should begin my document?
>>
>>
>>
>>     Justin.
>>
>
> Seems like this approach might work:
>
> Fill a list with records (hash-refs)  sorted new to old. Limit to some 
> reasonable number knowing that you can always add a few more if needed.
>
> Trial print the list while tracking the record count and page count to 
> determine how many records you can print from the list.
>
> Take a slice from the list based on how many records needed (above), and 
> reverse it.
>
> Print.

That sounds quite reasonable. Yes, I like that. Thank you Steve.

   Justin.

-- 
Justin C, by the sea.


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

Date: Thu, 01 May 2014 15:44:59 -0700
From: Steve May <stevem_@nogood.com>
Subject: Re: More general programming than perl...
Message-Id: <M7A8v.687927$YO.115544@fx03.iad>

On 05/01/2014 08:30 AM, Rainer Weikusat wrote:
> Steve May <stevem_@nogood.com> writes:
>
> [...]
>
>> Seems like this approach might work:
>>
>> Fill a list with records (hash-refs)  sorted new to old. Limit to some
>> reasonable number knowing that you can always add a few more if
>> needed.
>
> As I already wrote: The pages can be build backwards while accumlating
> records. That is, for each new record, the size including a possible
> leading 'day sections header' is calculated. If it still fits in front
> of the most recently added record on the current page, it is added to
> that, otherwise, it becomes the first entry on the next page. This
> process is repeated until 24 pages of output have been accumulated.
>
> In case there are less than 24 pages, a 2nd pass can be used to pull
> 'entries to preceeding pages' so that the last page ends up being
> 'partially filled' instead of the first page.
>
> This is not really difficult provide one can overcome the notion that
> 'stuff has to happen forwards' (something even "well known OSS
> celebrities" reportedly find difficult :->) and that 'the size' must be
> calculated in one go instead of incrementally.
>


Yes, though it was not immediately clear to me what you were suggesting 
(sometimes I'm a bit thick).

Too, differing explanations/perspectives on solutions are often useful.

At any rate, it seems the OP has some ideas to play with now.

\s


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

Date: Thu, 01 May 2014 15:50:50 -0700
From: Steve May <stevem_@nogood.com>
Subject: Re: More general programming than perl...
Message-Id: <fdA8v.278595$MG6.161005@fx04.iad>

On 05/01/2014 08:47 AM, Justin C wrote:
> On 2014-05-01, Steve May <stevem_@nogood.com> wrote:
>> On 04/30/2014 04:29 AM, Justin C wrote:
>>> I will be coding this in perl, but I can't yet get my head
>>> around how I'm going to achieve what I want, maybe people
>>> here can offer suggestions on how I might proceed -
>>> obviously in broad terms, code is a way off at the moment
>>> I think.
>>>
>>> I need to prepare a "Latest Products" document, the
>>> contents are coming from a database, I've got to fill the
>>> document with the latest and stop when the document is 24
>>> pages, however, the document runs chronologically from
>>> oldest to newest. I'm trying to work out how I can decide
>>> which item/date to put at the start of the document, so I
>>> don't run out of data before 24 pages, or over-run 24
>>> pages.
>>>
>>> Information is broken up into date sections (listing new
>>> products for that day), there are varying amounts of data
>>> for each date, from a few lines to more than a page. There
>>> is a section heading which is larger than a line of data,
>>> and there is a vertical space between sections, so how
>>> many lines I can fit on a page depends on how many
>>> sections there will be.
>>>
>>> Every page starts with a section/date heading regardless
>>> of whether it's a continuation of the section on the
>>> previous page or not.
>>>
>>> Any suggestions one how I might, programatically, decide
>>> where I should begin my document?
>>>
>>>
>>>
>>>      Justin.
>>>
>>
>> Seems like this approach might work:
>>
>> Fill a list with records (hash-refs)  sorted new to old. Limit to some
>> reasonable number knowing that you can always add a few more if needed.
>>
>> Trial print the list while tracking the record count and page count to
>> determine how many records you can print from the list.
>>
>> Take a slice from the list based on how many records needed (above), and
>> reverse it.
>>
>> Print.
>
> That sounds quite reasonable. Yes, I like that. Thank you Steve.
>
>     Justin.
>

YVW.

Forgot one thing: depending of formatting and exactly how the line 
breaks work out, it IS possible that 24 pages forward will turn into 25 
(or 23) pages reversed. You might want to double check the final output 
page count.

\s


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

Date: Fri, 02 May 2014 10:05:43 +0300
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: More general programming than perl...
Message-Id: <slrnlm6gu7.efm.whynot@orphan.zombinet>

with <q32a3b-iec.ln1@zem.masonsmusic.co.uk> Justin C wrote:
> On 2014-05-01, Eric Pozharski <whynot@pozharski.name> wrote:
>> with <be373b-kaa.ln1@zem.masonsmusic.co.uk> Justin C wrote:

>>> I need to prepare a "Latest Products" document, the ...
>> Please, define "document".
> I am not sure it is relevant to the question I asked, but my
> document is actually an Excel spreadsheet which will be printed 
> as a PDF.

"Document", being defined, defines "page".  From your conversations with
others I'm glad to find out that your "document" looks more like
text/plain (wrapped in application/pdf) then application/pdf itself.
You don't need Excel for this.  Or perl -- Excel would be closer to
pages than perl.

*CUT*

-- 
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom


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

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


Administrivia:

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

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 V11 Issue 4205
***************************************


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