Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Remove empty column(s) from unpack template

by duff (Parson)
on Jul 31, 2007 at 19:18 UTC ( #629901=note: print w/replies, xml ) Need Help??


in reply to Re^2: Remove empty column(s) from unpack template
in thread Remove empty column(s) from unpack template

It's not the output so much as it is just recognizing that the data is in a table. Text::Autoformat first has to parse the paragraphs that it's dealing with before it can decide what to do about them. A heuristic could be developed that says "this chunk of data is a table". Once you've got that, if you're going to reformat it, you've got to know where the columns are. The OP's code may be able to serve both purposes. Maybe. :-)

  • Comment on Re^3: Remove empty column(s) from unpack template

Replies are listed 'Best First'.
Re^4: Remove empty column(s) from unpack template
by BrowserUk (Pope) on Jul 31, 2007 at 20:30 UTC

    Ah. I see what you are getting at. Yes, I think it probably could be used for that purpose.

    Mind you, having just taken an extended squint inside Text::Autoformat, i think it would take a very brave person to try and add table inferencing code with all the other things going on in that module.

    I'm not adverse to making full use of the regex engine, and the regexes in there are nicely laid out and commented. But, trying to combine the heuristic in the OPs code, with the various heuristics already used in that module, and come away with something that worked, even for some fairly specific cases let alone the general case, would be quite an achievement.

    For example, imagine trying to extend the POD example of a quoted email/maillist post that has had it's formatting screwed over by re-quoting. What if the original text contained a table with some left and some right justified fields? Combining the heuristics to extract and reformat that would be quite difficult.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      Hey, I didn't say it would be easy :-) I've thought about doing something like this several times over the years but each time, the ratio of code-grok/tuits has always been too high. But I figure if I start planting ideas in other people's heads, perhaps they'll have the appropriate number of tuits to gain some understanding of the code (both Damian's and daseme's) and affect change to Text::Autoformat.

      I could just bug Damian about it until he relents, but somehow I don't think that's the right solution ;)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://629901]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2021-10-23 18:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (88 votes). Check out past polls.

    Notices?