.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Coy 3pm" .TH Coy 3pm "2022-11-19" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" .Vb 1 \& Coy \- like Carp only prettier .Ve .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& # In your application: \& # ==================== \& \& use Coy; \& \& warn "There seems to be a problem"; \& \& die "Looks like it might be fatal"; \& \& \& # You can add vocab in the $HOME/.coyrc file: \& # =========================================== \& \& noun RESET; # REMOVE EXISTING noun VOCAB \& # WORKS FOR OTHER SPECIFIERS TOO \& \& noun { \& wookie => \& { \& category => [ Sentient ], \& sound => [ "roars", "grunts", "bellows" ], \& act => \& { \& sits => { location => Arborial }, \& \& fights => { minimum => 2, \& association => "argument", \& }, \& }, \& }, \& \& }; \& \& category { \& Sentient => \& { \& act => \& { \& quarrels => \& { \& associations => "argument", \& location => Terrestrial, \& minimum => 2, \& synonyms => [qw(bickers argues)], \& }, \& laughs => \& { \& associations => "happy", \& location => Terrestrial, \& non_adjectival => 1, \& }, \& }, \& } \& }; \& \& personage "R2D2"; \& personage "Darth Vader"; \& \& place "Mos Eisley"; \& place "the Death Star"; \& \& tree "Alderaan mangrove"; \& fruit_tree "Wookie\-oak"; \& \& \& # You can also select a different syllable counter via .coyrc \& # =========================================================== \& \& use Lingua::EN::Syllables::syllable; \& syllable_counter "Lingua::EN::Syllables::syllable"; \& \& # or \& \& use Lingua::EN::Syllables::syllable; \& syllable_counter \e&Lingua::EN::Syllables::syllable; \& \& # or \& \& syllable_counter sub { return 1 }; # FAST BUT INACCURATE .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" .Vb 3 \& Error messages \& strewn across my terminal. \& A vein starts to throb. \& \& Their reproof adds the \& injury of insult to \& the shame of failure. \& \& When a program dies \& what you need is a moment \& of serenity. \& \& The Coy.pm \& module brings tranquillity \& to your debugging. \& \& The module alters \& the behaviour of C and \& C (and C and C). \& \& It also provides \& C and C \-\- two \& Zen alternatives. \& \& Like Carp.pm, \& Coy reports errors from the \& caller\*(Aqs point\-of\-view. \& \& But it prefaces \& the bad news of failure with \& a soothing haiku. \& \& The haiku are not \& "canned", but are generated \& freshly every time. \& \& Once the haiku is \& complete, it\*(Aqs prepended to \& the error message. \& \& Execution of \& the original call to \& C or C resumes. \& \& Haiku and error \& message strew across my screen. \& A smile starts to form. .Ve .SH "EXTENDING THE VOCABULARY" .IX Header "EXTENDING THE VOCABULARY" .Vb 3 \& Any code placed in \& "$ENV{HOME}/.coyrc" \& runs at compile\-time. \& \& You can use that file \& to extend Coy.pm\*(Aqs \& vocabulary. \& \& The "SYNOPSIS" at \& the start of this POD shows how \& you might set it up. \& \& (Eventually \& this section will detail the \& full mechanism.) .Ve .SH "CHANGING THE SYLLABLE COUNTER" .IX Header "CHANGING THE SYLLABLE COUNTER" .Vb 3 \& Real haiku often
\& have imperfect syllable
\& counts. \& \& The deficiencies of
\& Coy\*(Aqs inbuilt counter are thus
\& artistic virtues. \& \& But some connoisseurs
\& demand their syllable counts
\& be always exact. \& \& So if you don\*(Aqt like
\& the syllable counter, Coy
\& let\*(Aqs you replace it. \& \& Coy provides a sub \& called C for \& that very purpose. \& \& It is passed a sub \& reference. That sub is then used \& to count syllables. \& \& You can also pass \& the sub\*(Aqs I (that is, pass a \& symbolic reference). \& \& The new counter sub \& should take a string and return \& its syllable count. \& \& C \& can be called from your code, or \& from .coyrc. .Ve .SH "BUGS AND LIMITATIONS" .IX Header "BUGS AND LIMITATIONS" .Vb 3 \& In its current form, \& the module has four problems \& and limitations: \& \& * Vocabulary: \& The list of nouns and verbs is \& too small at present. \& \& This limits the range \& of topics that the haiku \& produced can cover. \& \& That in turn leads to \& tell\-tale repetition (which \& fails the Turing test). \& \& Extending the range \& of words Coy.pm can \& use is no problem \& \& (though finding the time \& and the creativity \& required may be :\-). \& \& Users of Coy are \& encouraged to add their own \& vocabulary. \& \& (See the "SYNOPSIS", \& and also "EXTENDING THE \& VOCABULARY"). \& \& \& * Associations: \& The vocabulary has \& too few topic links. \& \& Hence it\*(Aqs often not \& able to find relevant \& words for a message. \& \& This leads to haiku \& utterly unrelated \& to the error text. \& \& Again, there is no \& technical difficulty \& in adding more links: \& \& Defining enough \& associations isn\*(Aqt \& hard, just tedious. \& \& User\-specified \& vocabularies can solve \& this problem as well. \& \& \& * Limited grammar: \& The number of syntactic \& templates is too small. \& \& This leads to haiku \& that are (structurally, at \& least) monotonous. \& \& Yet again, this needs \& no technical solution, \& just time and effort. \& \& Of course, such enhanced \& templates might require richer \& vocabulary. \& \& For example, verb \& predicates would need extra \& database structure: \& \& Each verb entry would \& have to be extended with \& links to object nouns. \& \& \& * Syllable counting: \& This is perhaps the major \& problem at present. \& \& The algorithmic \& syllable counter is still \& being developed. \& \& It is currently \& around 96% \& accurate (per word). \& \& This means that correct \& syllable counts for haiku \& can\*(Aqt be guaranteed. \& \& Syllable counts for \& single words are correct to \& plus\-or\-minus 1. \& \& In a multi\-word \& haiku these errors cancel \& out in most cases. \& \& Thus, the haiku tend \& to be correct within one \& or two syllables. \& \& As the syllable \& counter slowly improves, this \& problem will abate. \& \& Alteratively, \& you can choose to use your own \& syllable counter. \& \& (See above in the \& section titled "CHANGING THE \& SYLLABLE COUNTER".) .Ve .SH "AUTHOR" .IX Header "AUTHOR" .Vb 3 \& The Coy.pm \& module was developed by \& Damian Conway. .Ve .SH "COPYRIGHT" .IX Header "COPYRIGHT" .Vb 4 \& Copyright (c) 1998\-2000, Damian Conway. All Rights Reserved. \& This module is free software. It may be used, redistributed \& and/or modified under the terms of the Perl Artistic License \& (see http://www.perl.com/perl/misc/Artistic.html) .Ve