Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: disabling forced line break with format fill mode and long source word (perlform Perl6::Form)

by Anonymous Monk
on Mar 08, 2020 at 23:46 UTC ( [id://11113989]=note: print w/replies, xml ) Need Help??


in reply to disabling forced line break with format fill mode and long source word

Hi,

I don't speak format, perlform is short on examples

so I haven't figured out the answer to your question but I kinda like this

#!/usr/bin/perl -- use strict; use warnings; Main( @ARGV ); exit( 0 ); { use constant +{ qw{ TYPE 0 NAME 1 ACTION 2 } }; ## to undefine globals TYPE/NAME/ACTION outside of this block use namespace::clean; format OFG = @<<<<<<<< @<<<<<<<<<<<<<<<<<<<< @<<<<<< $_[TYPE], $_[NAME], $_[ACTION] . } format THREECHARFORMAT = ^<<~~ $_[0] . sub fwThree { return formatWrite( *STDOUT, "::THREECHARFORMAT", @_ ); } sub formatWrite { use IO::Handle; my $handle = shift; my $format = shift; local @_ = @_; $handle->format_name( $format ); write $handle; } sub Main { fwThree("foobar"); formatWrite( *STDOUT, "::OFG", qw/ TYPE NAME ACTION / ); formatWrite( *STDERR, "::OFG", TYPE(), NAME(), ACTION() ); } __END__ $ perl format.fill.overflow.11113982.pl foo bar TYPE NAME ACTION Undefined subroutine &main::TYPE called at format.fill.overflow.111139 +82.pl line 56.

I would abandon format, switch to Perl6::Form, cause format appears to be one ignored wart (see Perl format line breaking, $FORMAT_LINE_BREAK_CHARACTERS apparently ignored )

Perl6::Form comes with demos, not sure if one fits what you want
https://metacpan.org/source/DCONWAY/Perl6-Form-0.090/demo/demo_break_word.pl
https://metacpan.org/source/DCONWAY/Perl6-Form-0.090/demo/demo_break_width.pl
https://metacpan.org/source/DCONWAY/Perl6-Form-0.090/demo/demo_overflowed_columns.pl

  • Comment on Re: disabling forced line break with format fill mode and long source word (perlform Perl6::Form)
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-19 10:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found