Advice for the young writer JJ Merelo @hoborg_novel http://search.cpan.org/~jmerelo/ Perl DevRoom, FOSDEM 2014
About the speaker
#perlnovel
2
Do you want to be a writer? #perlnovel
3
You probably are already! #perlnovel
4
Because... One writes to be loved Bryce Echenique
#perlnovel
5
But, writing, finishing and publishing are different kettles of fish
#perlnovel
6
“Write it. Shoot it. Publish it. Crochet it, sauté it, whatever. MAKE.” ― Joss Whedon
#perlnovel
7
What do you need to start MAKEing? #perlnovel
8
Great hair! #perlnovel
9
Lazyness, impatience and hubris #perlnovel
10
“The scariest moment is always just before you start” ― Stephen King #perlnovel
11
My last book #perlnovel
12
“Reflects the chaos of modern life” ― Hipster reader #perlnovel
13
“You never know what's going to hit you next with” ― Surprised reader #perlnovel
14
“The authors go full circle with this book” ― Geometrical reader #perlnovel
15
A few lines of code $digits=~ s/999999/" the one and only six contiguous digits, which happen to be no less than six nines ".random_plural()." "/eg; for my $i (qw( 5 4 3 2) ) { for my $j ( 0.. 9 ) { my $re = $j."{".$i."}"; $digits =~ s/$re/$name_of_digits[$i]." ". $name_of_digits[$j]."s ".random_plural()/eg; } } for my $j ( 0.. 9 ) { $digits =~ s/$j/"one ".$name_of_digits[$j] ." ".random_singular()/eg; } say $digits;
#perlnovel
16
The book: http://amzn.com/B00I08UZM2 The code: http://git.io/Pi #perlnovel
17
Don't write a book
#perlnovel
Generate it
18
LoveBible.pl my $chain = Algorithm::MarkovChain::->new(); $chain->seed(symbols => \@symbols, longest => 6); print "About to spew ...\n"; print "---\n\n"; foreach (1 .. 20) { my @newness = $chain->spew(length => 40, complete => [qw( the )]); print join (" ", @newness), ".\n\n"; } #perlnovel
19
Read the classics And then rewrite them!
#perlnovel
20
Which is a perfectly respectable activity
#perlnovel
21
Walking a fine line... ...Between Pierre MĂŠnard, author of the Quixote and the author of the first Chinese translation
#perlnovel
22
Writing Tsalakkayn, the Space Adventurer 1.Obtain plain text from http://gutenberg.org 2.Extract geographical and character names 3.Measure word frequencies 4.Generate regular expressions for mapping names and generate new ones. 5.Replace most frequent words or word groups.
#perlnovel
23
The gist of the matter my @sorted_sust = sort { length( $b->[0] ) <=> length( $a->[0] ) } @sustituciones; my @nombres = read_file($procesa_file); for my $n (@nombres) { chop $n; my $newspeak = lcfirst $n; for my $s (@sorted_sust) { $newspeak =~ s/$s->[0]/$s->[1]/gee; } say "$n ".ucfirst($newspeak); }
#perlnovel
http://git.io/classics 24
Lesson learned: Don't mess with copyright law #perlnovel
25
Open source your novel!
#perlnovel
26
GitHub is a great tool for writers
Only they haven't realized yet
#perlnovel
27
Use git hooks for automatic publishing POST_COMMIT { my ($git) = @_; my $branch = $git->command(qw/rev-parse --abbrev-ref HEAD/); if ( $branch =~ /master/ ) { my $changed = $git->command(qw/show --name-status/); $git->command(qw/checkout gh-pages/); for my $f ( @mds ) { $git->command( 'checkout', 'master', '--', $f ); # do stuff with $f and... $git->command('add', $f ); # and more stuff } $git->command('commit','-a', '-m', "Sync $f from master to gh-pages"); }
#perlnovel
28
Manuel, the Magnificent Mechanical Man
Available at http://goo.gl/mdluou for your enjoyment and enlightment
#perlnovel
29
You don't have to test everything to destruction just to see if you made it right 窶年eil Gaiman #perlnovel
Great hair!
30
Oh, but you do!
Or cpan will not let you install it.
#perlnovel
31
Writing is like developing software
Editing == Continuous integration
#perlnovel
32
Continous integration is... 1.Git push 2.CI site provisions environment and checks out at latest commit. 3.CI site runs tests 4. #success or #fail
#perlnovel
33
There Are Two Typos Of People In This World: Those Who Can Edit And Those Who Can’t – Jarod Kintz $speller->add_dic("$dir/words.dic"); my @words = split /\s+/, $hoborg->text; my $word_re = qr/([\w\'áéíóúÁÉÍÓÚñÑ]+)/; for my $w (@words) { my ($stripped_word) = ( $w =~ $word_re ); ok( $speller->check( $stripped_word), "Checking $stripped_word in text") if ( $stripped_word ) ; }
#perlnovel
34
How much? Does it suck?
https://travis-ci.org/JJ/hoborg #perlnovel
35
The sin of hubris
http://amzn.to/1n1IjsB #perlnovel
36
cpan Text::Hoborg perldoc Text::Hoborg::Manuel
#perlnovel
37
Don't leave yet, there's more! ●
●
●
Net::Lujoyglamour is an URL shortener which includes the PDF of another novel (in Spanish) in the test dir. Kindle direct publishing reports suck Excellently. Excel::KDP::Royalties massages it. (Not Perl) http://hoborg-jjmerelo.rhcloud.com/ serves MD directly.
#perlnovel
38
Can Perl write your novel?
But maximize I mean, No yes. your hubris by doing it yourself #perlnovel
39
â&#x20AC;Ś Helped by Perl and Github, of course
#perlnovel
40
Any questions? Time to git clone git@github.com:JJ/hoborg.git
or cpan Text::Hoborg or Buy the book http://amzn.to/1fr7DaE #perlnovel
41