This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use v5.14; | |
| use strict; | |
| use warnings; | |
| package MyApp { | |
| use Zydeco; | |
| class Person { | |
| has name ( type => Str, required => true ); | |
| has gender ( type => Str ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| use v5.14; | |
| package Local::App { | |
| use Zydeco; | |
| # Utility function. | |
| # | |
| require HTML::Entities; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sub TO_JSON { | |
| my $self = shift; | |
| return { %$self }; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use v5.16; | |
| use strict; | |
| use warnings; | |
| use JSON::MaybeXS; | |
| use Data::Dumper; | |
| package MyApp { | |
| use Zydeco; | |
| use Carp 'confess'; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use v5.16; | |
| use strict; | |
| use warnings; | |
| use JSON::MaybeXS; | |
| use Data::Dumper; | |
| package MyApp { | |
| use Zydeco; | |
| use Carp 'confess'; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use v5.16; | |
| use strict; | |
| use warnings; | |
| use JSON::MaybeXS; | |
| use Data::Dumper; | |
| package MyApp { | |
| use Zydeco; | |
| use Carp 'confess'; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use strict; | |
| use warnings; | |
| package Widget { | |
| use Mom q{ | |
| name :ro :type(Str) :required | |
| stock_level :rwp :type(Int) :default(0) | |
| sku :ro :type(Str) :required | |
| }; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use strict; | |
| use warnings; | |
| package Widget { | |
| use Mom q{ name stock_level sku }; | |
| } | |
| my $thingy = Widget->new( | |
| name => 'Whatsit', | |
| sku => 'X0000001', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| use v5.12; | |
| use strict; | |
| use warnings; | |
| use Algorithm::Permute; | |
| sub main { | |
| my $check = build_checker( \*DATA ); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| # These snippets can be added to your existing functions.php. | |
| # | |
| # 1. This outputs <link rel="edit-form"> in your page <head> elements. | |
| # | |
| add_action( 'wp_head', function () { | |
| global $post; | |
| if ( $post && current_user_can( 'edit_post', $post->ID ) ) { |