| 1 | package Acme::Glue; | ||
| 2 | |||
| 3 | use utf8; | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | |||
| 7 | $Acme::Glue::VERSION = "2026.09"; | ||
| 8 | |||
| 9 | =encoding utf8 | ||
| 10 | |||
| 11 | =head1 NAME | ||
| 12 | |||
| 13 | Acme::Glue - A placeholder module for code accompanying a Perl photo project | ||
| 14 | |||
| 15 | =head1 VERSION | ||
| 16 | |||
| 17 | 2026.09 | ||
| 18 | |||
| 19 | =head1 DESCRIPTION | ||
| 20 | |||
| 21 | =begin HTML | ||
| 22 | |||
| 23 | <p><img src="https://images.squarespace-cdn.com/content/v1/60f40aa1942bba66cf802d7d/1626967232855-GP54O7LH9BAGBGAXJXUJ/05_yapc_eu_2016_f04.jpg?format=625w" | ||
| 24 | width="650" alt="Acme::Glue Photo" /></p> | ||
| 25 | |||
| 26 | =end HTML | ||
| 27 | |||
| 28 | Acme::Glue is the companion Perl module for a Perl photo project, the idea | ||
| 29 | for the photo project is to have each photo include a small snippet of code. | ||
| 30 | The code does not have to be Perl, it just has to be something you're quite | ||
| 31 | fond of for whatever reason. | ||
| 32 | |||
| 33 | "Glue" is a series of photos shot at Perl conferences and workshops in | ||
| 34 | Europe and America between 2015 and 2025. Perl was one of the programming | ||
| 35 | languages that bootstrapped a lot of internet based companies in the mid/late | ||
| 36 | 1990s and early 2000s, sometimes sticking together disparate systems. | ||
| 37 | |||
| 38 | Perl has fallen out of favour as newer languages have taken its place; | ||
| 39 | however, it can still be found in many places and often running critical | ||
| 40 | infrastructure. The title is a metaphor not just for the language but also | ||
| 41 | for the shrinking of the community at the events the photos are shot at. | ||
| 42 | |||
| 43 | The full project edit (70 photos picked from approx 1,000) touches on the | ||
| 44 | aforementioned themes but also on the loss of books as learning material, | ||
| 45 | and the raise of AI. | ||
| 46 | |||
| 47 | =head1 SNIPPETS | ||
| 48 | |||
| 49 | Here are the snippets that may accompany the photo project | ||
| 50 | |||
| 51 | =head2 LEEJO (transform.pl) | ||
| 52 | |||
| 53 | #!/usr/bin/env perl | ||
| 54 | # | ||
| 55 | # transform an array of hashes into an array of arrays where each array | ||
| 56 | # contains the values from the hash sorted by the original hash keys or | ||
| 57 | # the passed order of columns (hash slicing) | ||
| 58 | my @ordered = $column_order | ||
| 59 | ? map { [ @$_{ @{ $column_order } } ] } @{ $chaos } | ||
| 60 | : map { [ @$_{sort keys %$_} ] } @{ $chaos }; | ||
| 61 | |||
| 62 | =head2 LEEJO (hopscotch.p6) | ||
| 63 | |||
| 64 | #!/usr/bin/env perl6 | ||
| 65 | |||
| 66 | my @court = ( | ||
| 67 | [ 'FIN' ], | ||
| 68 | [ 9 ,10 ], | ||
| 69 | [ 8 ], | ||
| 70 | [ 6 , 7 ], | ||
| 71 | [ 5 ], | ||
| 72 | [ 4 ], | ||
| 73 | [ 2 , 3 ], | ||
| 74 | [ 1 ], | ||
| 75 | ); | ||
| 76 | |||
| 77 | my $skip = @court.[1..*].pick.pick; | ||
| 78 | my @play; | ||
| 79 | |||
| 80 | for @court.reverse -> $hop { | ||
| 81 | @play.push( $hop.map( *.subst( /^$skip$/,'🚫' ).list ) ); | ||
| 82 | } | ||
| 83 | |||
| 84 | say @play.reverse.join( "\n" ); | ||
| 85 | |||
| 86 | =head2 LEEJO (vec and pack examples from perldoc vec) | ||
| 87 | |||
| 88 | #!/usr/bin/env perl -wl | ||
| 89 | |||
| 90 | print <<'EOT'; | ||
| 91 | 0 1 2 3 | ||
| 92 | unpack("V",$_) 01234567890123456789012345678901 | ||
| 93 | ------------------------------------------------------------------ | ||
| 94 | EOT | ||
| 95 | |||
| 96 | for $w (0..3) { | ||
| 97 | $width = 2**$w; | ||
| 98 | for ($shift=0; $shift < $width; ++$shift) { | ||
| 99 | for ($off=0; $off < 32/$width; ++$off) { | ||
| 100 | $str = pack("B*", "0"x32); | ||
| 101 | $bits = (1<<$shift); | ||
| 102 | vec($str, $off, $width) = $bits; | ||
| 103 | $res = unpack("b*",$str); | ||
| 104 | $val = unpack("V", $str); | ||
| 105 | write; | ||
| 106 | } | ||
| 107 | } | ||
| 108 | } | ||
| 109 | |||
| 110 | format STDOUT = | ||
| 111 | vec($_,@#,@#) = @<< == @######### @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
| 112 | $off, $width, $bits, $val, $res | ||
| 113 | . | ||
| 114 | __END__ | ||
| 115 | |||
| 116 | =head2 LEEJO (example from "How Perl Saved the Human Genome Project" complete with syntax error) | ||
| 117 | |||
| 118 | use Boulder::Stream; | ||
| 119 | $stream = new Boulder::Stream; | ||
| 120 | while ($record=$stream->read_record('NAME','SEQUENCE')) { | ||
| 121 | $name = $record->get('NAME'); | ||
| 122 | $sequence = $record->get('SEQUENCE'); | ||
| 123 | |||
| 124 | ...continue processing... | ||
| 125 | |||
| 126 | $record->add(QUALITY_CHECK=>"OK|); | ||
| 127 | $stream->write_record($record); | ||
| 128 | } | ||
| 129 | |||
| 130 | =head2 LEEJO (quine - a program that prints itself out) | ||
| 131 | |||
| 132 | $_=q(print"\$_=q($_);eval;");eval; | ||
| 133 | |||
| 134 | =head2 LEEJO (perl5 LOC count as of 5.38 release) | ||
| 135 | |||
| 136 | % git branch | ||
| 137 | * blead | ||
| 138 | % find . -name "*.[ch]" | xargs wc -l | sort -nr | head -n5 | ||
| 139 | 788279 total | ||
| 140 | 436086 ./charclass_invlists.h | ||
| 141 | 17540 ./sv.c | ||
| 142 | 16254 ./regcomp.c | ||
| 143 | 15712 ./op.c | ||
| 144 | |||
| 145 | =head2 LEEJO (fizz_buzz.pl generated from an "AI"; it's wrong in so many ways, it doesn't even compile) | ||
| 146 | |||
| 147 | # Define a function that takes two arguments (starting number and ending number) | ||
| 148 | sub fizz_buzz { | ||
| 149 | |||
| 150 | # Initialize variables for counting and ending values | ||
| 151 | my $count = 0; | ||
| 152 | my @results = (); | ||
| 153 | |||
| 154 | # Loop through numbers between starting and ending values | ||
| 155 | for my $i ( $starting .. $ending ) { | ||
| 156 | |||
| 157 | # Check if current number is divisible by any of these factors: 15, 3 or itself | ||
| 158 | foreach my $factor ( @factors ) { | ||
| 159 | next unless $_ * $i == $i; | ||
| 160 | push( @{ $results[$factor] },"$i" ); | ||
| 161 | } | ||
| 162 | else { | ||
| 163 | push( @{ $results[0] },"$i" ); | ||
| 164 | } | ||
| 165 | |||
| 166 | $count++; | ||
| 167 | } | ||
| 168 | |||
| 169 | return \@results; | ||
| 170 | } | ||
| 171 | |||
| 172 | # Define arrays containing factors to check for each result type | ||
| 173 | my %fizz = ( 15 ); | ||
| 174 | my %buzz = ( 3 ); | ||
| 175 | my %self = ( 0 ); | ||
| 176 | |||
| 177 | # Call the fizz_buzz subroutine with appropriate parameters | ||
| 178 | print Dumper( \@result ); | ||
| 179 | |||
| 180 | =head2 LEEJO (snippet from obs-studio/libobs/obs.c) | ||
| 181 | |||
| 182 | static void stop_audio(void) | ||
| 183 | { | ||
| 184 | struct obs_core_audio *audio = &obs->audio; | ||
| 185 | |||
| 186 | if (audio->audio) { | ||
| 187 | audio_output_close(audio->audio); | ||
| 188 | audio->audio = NULL; | ||
| 189 | } | ||
| 190 | } | ||
| 191 | |||
| 192 | =head2 LEEJO (only compiles on a Friday) | ||
| 193 | |||
| 194 | # general idea shamelessly stolen from Randal L. Schwartz: | ||
| 195 | # https://www.perlmonks.org/index.pl?node_id=44722 | ||
| 196 | |||
| 197 | use Time::Piece; | ||
| 198 | |||
| 199 | BEGIN { | ||
| 200 | *f = (localtime->wdayname eq 'Fri') | ||
| 201 | ? sub() {} | ||
| 202 | : sub {}; | ||
| 203 | } | ||
| 204 | |||
| 205 | f/1;#/+ | ||
| 206 | |||
| 207 | =head2 MIKESTOK (soundex "joke") | ||
| 208 | |||
| 209 | sub Soundex | ||
| 210 | { | ||
| 211 | local ($_, $f) = shift; | ||
| 212 | |||
| 213 | y;a-z;A-Z;;y;A-Z;;cd;$_ ne q???do{($f)=m;^(.);;s;$f+;;; | ||
| 214 | y;AEHIOUWYBFPVCGJKQSXZDTLMNR;00000000111122222222334556;; | ||
| 215 | y;;;cs;y;0;;d;s;^;$f;;s;$;0000;;m;(^.{4});;$1;}:q;;; | ||
| 216 | } | ||
| 217 | |||
| 218 | =head2 NERDVANA (delorean_ options.pl) | ||
| 219 | |||
| 220 | GetOptions( | ||
| 221 | 'help|h|?' => sub { pod2usage(1) }, | ||
| 222 | 'serial-dev|d=s' => \my $opt_serial_dev= '/dev/delorean', | ||
| 223 | 'socket|S=s' => \my $opt_socket= '/run/uctl-daemon.sock', | ||
| 224 | ) or pod2usage(2); | ||
| 225 | |||
| 226 | =head2 SLU (MAZE.BAS) | ||
| 227 | |||
| 228 | 10 PRINT CHR$(205.5+RND(1));:GOTO 10 | ||
| 229 | |||
| 230 | =head2 SLU (schwartzian_transform.pl) | ||
| 231 | |||
| 232 | |||
| 233 | #!/usr/bin/env perl | ||
| 234 | # https://en.wikipedia.org/wiki/Schwartzian_transform | ||
| 235 | # Sort list of words according to word length | ||
| 236 | |||
| 237 | print "$_\n" foreach | ||
| 238 | map { $_->[0] } | ||
| 239 | sort { $a->[1] <=> $b->[1] or $a->[0] cmp $b->[0] } | ||
| 240 | map { [$_, length($_)] } | ||
| 241 | qw(demo of schwartzian transform); | ||
| 242 | |||
| 243 | =head2 LIST OF WORKSHOPS / CONFERENCES | ||
| 244 | |||
| 245 | A full list of the workshops and conferences this project was shot at | ||
| 246 | |||
| 247 | =over | ||
| 248 | |||
| 249 | =item Alpine Perl Workshop (2016) | ||
| 250 | |||
| 251 | =item FOSDEM (2024) | ||
| 252 | |||
| 253 | =item German Perl Workshop (2019) | ||
| 254 | |||
| 255 | =item German Perl and Raku Workshop (2022, 2023, 2024, 2025) | ||
| 256 | |||
| 257 | =item Les Journées Perl (2017, 2019) | ||
| 258 | |||
| 259 | =item London Perl Workshop (2015, 2016, 2019) | ||
| 260 | |||
| 261 | =item PerlCon (2019) | ||
| 262 | |||
| 263 | =item Swiss Perl Workshop (2015, 2017, 2018, 2019) | ||
| 264 | |||
| 265 | =item The Perl Conference [EU] (2017, 2018) | ||
| 266 | |||
| 267 | =item The Perl Conference [NA] (2016, 2017) | ||
| 268 | |||
| 269 | =item The Perl Toolchain Summit (2017) | ||
| 270 | |||
| 271 | =item The Perl and Raku Conference [NA] (2023, 2024) | ||
| 272 | |||
| 273 | =item Yet Another Perl Conference [EU] (2015, 2016) | ||
| 274 | |||
| 275 | =back | ||
| 276 | |||
| 277 | =head1 THANKS | ||
| 278 | |||
| 279 | Thanks to all who contributed a snippet | ||
| 280 | |||
| 281 | =head1 SEE ALSO | ||
| 282 | |||
| 283 | L<https://www.formulanon.com/glue> | ||
| 284 | |||
| 285 | L<https://www.youtube.com/watch?v=OXcHLAL_luU> | ||
| 286 | |||
| 287 | L<https://leejo.github.io/acme-glue-talk/presentation.html#1> | ||
| 288 | |||
| 289 | =head1 AUTHOR | ||
| 290 | |||
| 291 | Lee Johnson - C<leejo@cpan.org> | ||
| 292 | |||
| 293 | =head1 LICENCE | ||
| 294 | |||
| 295 | This library is free software; you can redistribute it and/or modify it under | ||
| 296 | the same terms as Perl itself. If you would like to contribute documentation, | ||
| 297 | features, bug fixes, or anything else then please raise an issue / pull request: | ||
| 298 | |||
| 299 | https://github.com/leejo/acme-glue | ||
| 300 | |||
| 301 | All photos © Lee Johnson | ||
| 302 | |||
| 303 | =cut | ||
| 304 | |||
| 305 | 1; |