diff options
Diffstat (limited to 'static/talks/bread_board_yapc_na_2012')
78 files changed, 4532 insertions, 0 deletions
diff --git a/static/talks/bread_board_yapc_na_2012/001.html b/static/talks/bread_board_yapc_na_2012/001.html new file mode 100644 index 0000000..76f0738 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/001.html @@ -0,0 +1,51 @@ +<html> +<head> +<title>001</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "002" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Dependency Injection with Bread::Board + + Jesse Luehrs + Infinity Interactive + doy@cpan.org + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/002.html b/static/talks/bread_board_yapc_na_2012/002.html new file mode 100644 index 0000000..026d7d8 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/002.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>002</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "001" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "003.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + + + A Motivating Example + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/003.pl.html b/static/talks/bread_board_yapc_na_2012/003.pl.html new file mode 100644 index 0000000..d68c9c3 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/003.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>003.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "002" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "004.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + +package MyApp; +use MyFramework; + +sub call { + my $self = shift; + + my $dbh = DBI->connect('dbi:mysql:myapp_db'); + my $hello = $dbh->selectall_arrayref('SELECT * FROM my_table')->[0][0]; + + my $template = Template->new(INCLUDE_PATH => 'root/template'); + $template->process('hello.tt', { hello => $hello }, \(my $output)); + + return $output; +} + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/004.pl.html b/static/talks/bread_board_yapc_na_2012/004.pl.html new file mode 100644 index 0000000..83fba78 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/004.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>004.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "003.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "005.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + +package MyApp; +use MyFramework; + +has model => (is => 'ro', isa => 'Model', default => sub { Model->new }); +has view => (is => 'ro', isa => 'View', default => sub { View->new }); + +sub call { + my $self = shift; + my $hello = $self->model->get_hello; + return $self->view->render($hello); +} + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/005.pl.html b/static/talks/bread_board_yapc_na_2012/005.pl.html new file mode 100644 index 0000000..6475d93 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/005.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>005.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "004.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "006.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre>package MyApp; +use MyFramework; + +has logger => ( + is => 'ro', isa => 'Logger', + default => sub { Logger->new } +); +has model => ( + is => 'ro', isa => 'Model', lazy => 1, + default => sub { Model->new(logger => $_[0]->logger) }, +); +has view => ( + is => 'ro', isa => 'View', lazy => 1, + default => sub { View->new(logger => $_[0]->logger) }, +); + +sub call { + my $self = shift; + my $hello = $self->model->get_hello; + return $self->view->render($hello); +} + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/006.pl.html b/static/talks/bread_board_yapc_na_2012/006.pl.html new file mode 100644 index 0000000..593cc3e --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/006.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>006.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "005.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "007" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre>package MyApp; +use MyFramework; + +has dsn => (is => 'ro', isa => 'Str', default => 'dbi:mysql:myapp_db'); +has tt_root => (is => 'ro', isa => 'Str', default => 'root/template'); +has logger => (is => 'ro', isa => 'Logger', default => sub {Logger->new}); +has model => ( + is => 'ro', isa => 'Model', lazy => 1, + default => sub { + my $m = Model->connect($_[0]->dsn); + $m->set_logger($_[0]->logger); + return $m; + }, +); +has view => ( + is => 'ro', isa => 'View', lazy => 1, + default => sub { + View->new(logger => $_[0]->logger, tt_root => $_[0]->tt_root); + }, +); + +sub call { ... } + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/007.html b/static/talks/bread_board_yapc_na_2012/007.html new file mode 100644 index 0000000..44137e2 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/007.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>007</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "006.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "007b" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Dependency Injection + + + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/007b.html b/static/talks/bread_board_yapc_na_2012/007b.html new file mode 100644 index 0000000..5388b4e --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/007b.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>007b</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "007" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "007c" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Dependency Injection + + · a form of inversion of control + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/007c.html b/static/talks/bread_board_yapc_na_2012/007c.html new file mode 100644 index 0000000..2191491 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/007c.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>007c</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "007b" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "007z" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Dependency Injection + + · a form of inversion of control + · "the inverse of garbage collection" + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/007z.html b/static/talks/bread_board_yapc_na_2012/007z.html new file mode 100644 index 0000000..5656c3b --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/007z.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>007z</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "007c" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "008" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Dependency Injection + + · a form of inversion of control + · "the inverse of garbage collection" + · manages object construction + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/008.html b/static/talks/bread_board_yapc_na_2012/008.html new file mode 100644 index 0000000..27b557b --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/008.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>008</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "007z" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "008b" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Benefits to Dependency Injection + + + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/008b.html b/static/talks/bread_board_yapc_na_2012/008b.html new file mode 100644 index 0000000..7cd24c5 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/008b.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>008b</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "008" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "008c" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Benefits to Dependency Injection + + · provides access to the same object creation code + that your app will actually use + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/008c.html b/static/talks/bread_board_yapc_na_2012/008c.html new file mode 100644 index 0000000..ac32a8d --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/008c.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>008c</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "008b" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "008z" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Benefits to Dependency Injection + + · provides access to the same object creation code + that your app will actually use + · removes need for globals + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/008z.html b/static/talks/bread_board_yapc_na_2012/008z.html new file mode 100644 index 0000000..864c4b8 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/008z.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>008z</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "008c" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "009" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Benefits to Dependency Injection + + · provides access to the same object creation code + that your app will actually use + · removes need for globals + · testing and reuse + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/009.html b/static/talks/bread_board_yapc_na_2012/009.html new file mode 100644 index 0000000..0a12b58 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/009.html @@ -0,0 +1,53 @@ +<html> +<head> +<title>009</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "008z" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "009z" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> Bread::Board + + + + + + + + + + + + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/009z.html b/static/talks/bread_board_yapc_na_2012/009z.html new file mode 100644 index 0000000..0ace083 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/009z.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>009z</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "009" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "010.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> Bread::Board + + +-----------------------------------------+ + | A B C D E F G H I J | + |-----------------------------------------| + | o o | 1 o-o-o-o-o v o-o-o-o-o 1 | o o | + | o o | 2 o-o-o-o-o o-o-o-o-o 2 | o o | + | o o | 3 o-o-o-o-o o-o-o-o-o 3 | o o | + | o o | 4 o-o-o-o-o o-o-o-o-o 4 | o o | + | o o | 5 o-o-o-o-o o-o-o-o-o 5 | o o | + | | 6 o-o-o-o-o o-o-o-o-o 6 | | + | o o | 7 o-o-o-o-o o-o-o-o-o 7 | o o | + | o o | 8 o-o-o-o-o o-o-o-o-o 8 | o o | + | o o | 9 o-o-o-o-o o-o-o-o-o 9 | o o | + | o o | 10 o-o-o-o-o o-o-o-o-o 10 | o o | + | o o | 11 o-o-o-o-o o-o-o-o-o 11 | o o | + | | 12 o-o-o-o-o o-o-o-o-o 12 | | + | o o | 13 o-o-o-o-o o-o-o-o-o 13 | o o | + | o o | 14 o-o-o-o-o o-o-o-o-o 14 | o o | + | o o | 15 o-o-o-o-o o-o-o-o-o 15 | o o | + | o o | 16 o-o-o-o-o ^ o-o-o-o-o 16 | o o | + +-----------------------------------------+ + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/010.pl.html b/static/talks/bread_board_yapc_na_2012/010.pl.html new file mode 100644 index 0000000..35f1fa8 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/010.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>010.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "009z" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "011" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> Bread::Board + +my $c = container MyApp => as { + service dsn => 'dbi:mysql:myapp_db'; + service logger => (class => 'Logger', lifecycle => 'Singleton'); + service view => (class => 'View', dependencies => ['logger']); + + service model => ( + class => 'Model', + dependencies => ['logger', 'dsn'], + block => sub { + my $m = Model->connect($_[0]->param('dsn')); + $m->set_logger($_[0]->param('logger')); + return $m; + }, + ); + service app => ( + class => 'MyApp', + dependencies => ['model', 'view'], + ); +}; +$c->resolve(service => 'app'); + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/011.html b/static/talks/bread_board_yapc_na_2012/011.html new file mode 100644 index 0000000..27a352a --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/011.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>011</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "010.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "011b" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Services + + + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/011b.html b/static/talks/bread_board_yapc_na_2012/011b.html new file mode 100644 index 0000000..0852e36 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/011b.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>011b</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "011" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "011c" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Services + + · represent the data you're storing + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/011c.html b/static/talks/bread_board_yapc_na_2012/011c.html new file mode 100644 index 0000000..1acc353 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/011c.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>011c</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "011b" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "011z" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Services + + · represent the data you're storing + · access contents via the ->get method + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/011z.html b/static/talks/bread_board_yapc_na_2012/011z.html new file mode 100644 index 0000000..4c37ffc --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/011z.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>011z</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "011c" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "012.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Services + + · represent the data you're storing + · access contents via the ->get method + · three built-in types: + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/012.pl.html b/static/talks/bread_board_yapc_na_2012/012.pl.html new file mode 100644 index 0000000..5fad51f --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/012.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>012.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "011z" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "013.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Bread::Board::ConstructorInjection + + service view => ( + class => 'View', + ); + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/013.pl.html b/static/talks/bread_board_yapc_na_2012/013.pl.html new file mode 100644 index 0000000..6b70db8 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/013.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>013.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "012.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "014.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + Bread::Board::BlockInjection + + service model => ( + class => 'Model', # optional + block => sub { + my $m = Model->new + $m->initialize; + return $m; + }, + ); + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/014.pl.html b/static/talks/bread_board_yapc_na_2012/014.pl.html new file mode 100644 index 0000000..eb7c53d --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/014.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>014.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "013.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "015" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + + Bread::Board::Literal + + service dsn => 'dbi:mysql:myapp_db'; + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/015.html b/static/talks/bread_board_yapc_na_2012/015.html new file mode 100644 index 0000000..f87c9e0 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/015.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>015</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "014.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "015b" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Containers + + + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/015b.html b/static/talks/bread_board_yapc_na_2012/015b.html new file mode 100644 index 0000000..e02b3b9 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/015b.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>015b</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "015" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "015c" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Containers + + · hold services and other containers + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/015c.html b/static/talks/bread_board_yapc_na_2012/015c.html new file mode 100644 index 0000000..e732750 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/015c.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>015c</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "015b" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "015z" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Containers + + · hold services and other containers + · access contents via the ->fetch method + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/015z.html b/static/talks/bread_board_yapc_na_2012/015z.html new file mode 100644 index 0000000..52bf73f --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/015z.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>015z</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "015c" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "016" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Containers + + · hold services and other containers + · access contents via the ->fetch method + · ->resolve is a shortcut method for ->fetch(...)->get + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/016.html b/static/talks/bread_board_yapc_na_2012/016.html new file mode 100644 index 0000000..905afd9 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/016.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>016</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "015z" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "016b" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Dependencies + + + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/016b.html b/static/talks/bread_board_yapc_na_2012/016b.html new file mode 100644 index 0000000..8b0e0cd --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/016b.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>016b</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "016" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "016z" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Dependencies + + · tells Bread::Board how your classes are related + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/016z.html b/static/talks/bread_board_yapc_na_2012/016z.html new file mode 100644 index 0000000..d9b1f4a --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/016z.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>016z</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "016b" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "017.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Dependencies + + · tells Bread::Board how your classes are related + · specified as a map of names to service paths + (there are shortcuts for common cases) + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/017.pl.html b/static/talks/bread_board_yapc_na_2012/017.pl.html new file mode 100644 index 0000000..3490107 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/017.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>017.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "016z" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "018.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + Dependencies + +service logger => (class => 'Logger'); +service view => ( + class => 'View', + dependencies => ['logger'], +); + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/018.pl.html b/static/talks/bread_board_yapc_na_2012/018.pl.html new file mode 100644 index 0000000..5de2fc0 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/018.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>018.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "017.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "019.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + Dependencies + +service dsn => 'dbi:mysql:myapp_db'; +service model => ( + class => 'Model', + dependencies => ['dsn'], + block => sub { + my $service = shift; + return Model->connect($service->param('dsn')); + }, +); + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/019.pl.html b/static/talks/bread_board_yapc_na_2012/019.pl.html new file mode 100644 index 0000000..c9ee994 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/019.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>019.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "018.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "020" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + Dependencies + +container MyApp => as { + container Model => as { + service dsn => 'dbi:mysql:myapp_db'; + service model => ( + class => 'Model', + dependencies => ['dsn'], + block => sub { + my $service = shift; + return Model->connect($service->param('dsn')); + }, + ); + }; + service app => ( + class => 'MyApp', + dependencies => ['Model/model'], + ); +}; + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/020.html b/static/talks/bread_board_yapc_na_2012/020.html new file mode 100644 index 0000000..88b8442 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/020.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>020</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "019.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "020z" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + + Parameters + + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/020z.html b/static/talks/bread_board_yapc_na_2012/020z.html new file mode 100644 index 0000000..2bc3569 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/020z.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>020z</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "020" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "021.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + + Parameters + + · like dependencies, but supplied when calling ->get or ->resolve + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/021.pl.html b/static/talks/bread_board_yapc_na_2012/021.pl.html new file mode 100644 index 0000000..dcc1961 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/021.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>021.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "020z" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "022.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + Parameters + +my $c = container MyApp => as { + service user => ( + class => 'User', + parameters => { + name => { isa => 'Str' }, + }, + ); +}; +$c->resolve(service => 'user', parameters => { name => 'doy' }); + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/022.pl.html b/static/talks/bread_board_yapc_na_2012/022.pl.html new file mode 100644 index 0000000..d502072 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/022.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>022.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "021.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "023.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + Parameters + +my $c = container MyApp => as { + service user => ( + class => 'User', + parameters => { + name => { isa => 'Str' }, + }, + ); + service superusers => ( + block => sub { [ $_[0]->param('root') ] }, + dependencies => { + root => { user => { name => 'root' } }, + }, + ); +}; + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/023.pl.html b/static/talks/bread_board_yapc_na_2012/023.pl.html new file mode 100644 index 0000000..f2c19f2 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/023.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>023.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "022.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "024.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + Parameters + +my $c = container MyApp => as { + service user => ( + class => 'User', + parameters => { + name => { isa => 'Str' }, + }, + ); + service superusers => ( + block => sub { + [ $_[0]->param('user')->inflate(name => 'root') ] + }, + dependencies => ['user'], + ); +}; + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/024.pl.html b/static/talks/bread_board_yapc_na_2012/024.pl.html new file mode 100644 index 0000000..a780d22 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/024.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>024.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "023.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "025.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + Parameters + +my $c = container MyApp => as { + service default_username => 'guest'; + service user => ( + class => 'User', + parameters => { + name => { isa => 'Str', optional => 1 }, + }, + dependencies => { + name => 'default_username', + }, + ); +}; +# user with name 'guest' +$c->resolve(service => 'user'); +# user with name 'doy' +$c->resolve(service => 'user', parameters => { name => 'doy' }); + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/025.pl.html b/static/talks/bread_board_yapc_na_2012/025.pl.html new file mode 100644 index 0000000..e39736f --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/025.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>025.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "024.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "026" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + Parameters + +my $c = container MyApp => as { + service user => ( + class => 'User', + parameters => { + name => { isa => 'Str', optional => 1, default => 'guest' }, + }, + ); +}; +# user with name 'guest' +$c->resolve(service => 'user'); +# user with name 'doy' +$c->resolve(service => 'user', parameters => { name => 'doy' }); + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/026.html b/static/talks/bread_board_yapc_na_2012/026.html new file mode 100644 index 0000000..5dbf9f2 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/026.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>026</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "025.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "026b" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Lifecycles + + + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/026b.html b/static/talks/bread_board_yapc_na_2012/026b.html new file mode 100644 index 0000000..ca5f9e4 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/026b.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>026b</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "026" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "026c" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Lifecycles + + · this is what determines what happens when ->get is called + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/026c.html b/static/talks/bread_board_yapc_na_2012/026c.html new file mode 100644 index 0000000..b1c28c9 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/026c.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>026c</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "026b" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "026z" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Lifecycles + + · this is what determines what happens when ->get is called + · by default, each call to ->get creates a new object + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/026z.html b/static/talks/bread_board_yapc_na_2012/026z.html new file mode 100644 index 0000000..925c234 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/026z.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>026z</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "026c" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "027.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Lifecycles + + · this is what determines what happens when ->get is called + · by default, each call to ->get creates a new object + · by specifying «lifecycle => 'Singleton'» when creating the service, + the same object will be returned each time + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/027.pl.html b/static/talks/bread_board_yapc_na_2012/027.pl.html new file mode 100644 index 0000000..81900b4 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/027.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>027.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "026z" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "028" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> Bread::Board + +my $c = container MyApp => as { + service dsn => 'dbi:mysql:myapp_db'; + service logger => (class => 'Logger', lifecycle => 'Singleton'); + service view => (class => 'View', dependencies => ['logger']); + + service model => ( + class => 'Model', + dependencies => ['logger', 'dsn'], + block => sub { + my $m = Model->connect($_[0]->param('dsn')); + $m->set_logger($_[0]->param('logger')); + return $m; + }, + ); + service app => ( + class => 'MyApp', + dependencies => ['model', 'view'], + ); +}; +$c->resolve(service => 'app'); + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/028.html b/static/talks/bread_board_yapc_na_2012/028.html new file mode 100644 index 0000000..19f190a --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/028.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>028</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "027.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "028b" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Best Practices + + + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/028b.html b/static/talks/bread_board_yapc_na_2012/028b.html new file mode 100644 index 0000000..5ad9534 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/028b.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>028b</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "028" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "028c" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Best Practices + + · only use containers during initialization + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/028c.html b/static/talks/bread_board_yapc_na_2012/028c.html new file mode 100644 index 0000000..ea57d8e --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/028c.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>028c</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "028b" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "028d" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Best Practices + + · only use containers during initialization + · factories + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/028d.html b/static/talks/bread_board_yapc_na_2012/028d.html new file mode 100644 index 0000000..19c25bb --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/028d.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>028d</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "028c" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "028z" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Best Practices + + · only use containers during initialization + · factories + · avoid unnecessary subcontainers + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/028z.html b/static/talks/bread_board_yapc_na_2012/028z.html new file mode 100644 index 0000000..b2977dd --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/028z.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>028z</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "028d" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "029.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Best Practices + + · only use containers during initialization + · factories + · avoid unnecessary subcontainers + · container classes + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/029.pl.html b/static/talks/bread_board_yapc_na_2012/029.pl.html new file mode 100644 index 0000000..7422143 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/029.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>029.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "028z" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "030.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + +package MyApp::Container; +use Moose; +extends 'Bread::Board::Container'; + +sub BUILD { + container $self => as { + ...; + }; +} + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/030.pl.html b/static/talks/bread_board_yapc_na_2012/030.pl.html new file mode 100644 index 0000000..185c53f --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/030.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>030.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "029.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "031" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + +container SomethingElse => as { + container MyApp::Container->new; +}; + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/031.html b/static/talks/bread_board_yapc_na_2012/031.html new file mode 100644 index 0000000..fb86ef0 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/031.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>031</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "030.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "031b" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Typemaps + + + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/031b.html b/static/talks/bread_board_yapc_na_2012/031b.html new file mode 100644 index 0000000..d2e173a --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/031b.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>031b</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "031" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "031c" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Typemaps + + · defines a mapping from a class_type to a service + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/031c.html b/static/talks/bread_board_yapc_na_2012/031c.html new file mode 100644 index 0000000..af277de --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/031c.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>031c</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "031b" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "031z" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Typemaps + + · defines a mapping from a class_type to a service + · instead of requesting a particular service, you can request an + object of a particular type: $c->resolve(type => 'Model'); + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/031z.html b/static/talks/bread_board_yapc_na_2012/031z.html new file mode 100644 index 0000000..1e245f6 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/031z.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>031z</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "031c" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "032.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Typemaps + + · defines a mapping from a class_type to a service + · instead of requesting a particular service, you can request an + object of a particular type: $c->resolve(type => 'Model'); + · with this, we can (mostly) infer the dependencies for a given class + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/032.pl.html b/static/talks/bread_board_yapc_na_2012/032.pl.html new file mode 100644 index 0000000..ec69e85 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/032.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>032.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "031z" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "033.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + +package Model +use Moose; +has logger => (is => 'ro', isa => 'Logger', required => 1); + +package Logger; +use Moose; + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/033.pl.html b/static/talks/bread_board_yapc_na_2012/033.pl.html new file mode 100644 index 0000000..fe338d6 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/033.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>033.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "032.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "034" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + +my $c = container MyApp => as { + typemap Logger => infer; + typemap Model => infer; +}; +$c->resolve(type => 'Model')->logger; # a valid logger object + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/034.html b/static/talks/bread_board_yapc_na_2012/034.html new file mode 100644 index 0000000..7144e36 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/034.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>034</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "033.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "034b" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Typemaps + + + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/034b.html b/static/talks/bread_board_yapc_na_2012/034b.html new file mode 100644 index 0000000..fca66b8 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/034b.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>034b</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "034" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "034z" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Typemaps + + · required attributes are automatically inferred, becoming either + dependencies (on types) or parameters (if the type doesn't exist + in the typemap) + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/034z.html b/static/talks/bread_board_yapc_na_2012/034z.html new file mode 100644 index 0000000..374ad23 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/034z.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>034z</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "034b" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "035.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Typemaps + + · required attributes are automatically inferred, becoming either + dependencies (on types) or parameters (if the type doesn't exist + in the typemap) + · non-required attributes can still be satisfied by parameters + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/035.pl.html b/static/talks/bread_board_yapc_na_2012/035.pl.html new file mode 100644 index 0000000..944310b --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/035.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>035.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "034z" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "036" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> Bread::Board::Declare + +package MyApp::Container; +use Moose; +use Bread::Board::Declare; + +has dsn => (is => 'ro', isa => 'Str', value => 'dbi:mysql:myapp_db'); +has logger => (is => 'ro', isa => 'Logger'); +has view => (is => 'ro', isa => 'View', infer => 1); + +has model => ( + is => 'ro', + isa => 'Model', + infer => 1, + dependencies => ['dsn'], + block => sub { + my $m = Model->connect($_[0]->param('dsn')); + $m->set_logger($_[0]->param('logger')); + return $m; + }, +); +has app => (is => 'ro', isa => 'MyApp', infer => 1); + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/036.html b/static/talks/bread_board_yapc_na_2012/036.html new file mode 100644 index 0000000..a491785 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/036.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>036</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "035.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "036b" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Bread::Board::Declare + + + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/036b.html b/static/talks/bread_board_yapc_na_2012/036b.html new file mode 100644 index 0000000..eb25288 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/036b.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>036b</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "036" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "036c" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Bread::Board::Declare + + · services are declared just by defining attributes + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/036c.html b/static/talks/bread_board_yapc_na_2012/036c.html new file mode 100644 index 0000000..192c71c --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/036c.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>036c</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "036b" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "036d" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Bread::Board::Declare + + · services are declared just by defining attributes + · attribute accessors resolve the service if no value is set + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/036d.html b/static/talks/bread_board_yapc_na_2012/036d.html new file mode 100644 index 0000000..2b56f2d --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/036d.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>036d</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "036c" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "036z" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Bread::Board::Declare + + · services are declared just by defining attributes + · attribute accessors resolve the service if no value is set + · if the attribute has a value, it is used in dependency resolution + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/036z.html b/static/talks/bread_board_yapc_na_2012/036z.html new file mode 100644 index 0000000..136d5ce --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/036z.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>036z</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "036d" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "037" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Bread::Board::Declare + + · services are declared just by defining attributes + · attribute accessors resolve the service if no value is set + · if the attribute has a value, it is used in dependency resolution + · MyApp::Container->new(dsn => 'dbi:mysql:other_db')->model + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/037.html b/static/talks/bread_board_yapc_na_2012/037.html new file mode 100644 index 0000000..0868a72 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/037.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>037</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "036z" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "037b" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Bread::Board::Declare + + + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/037b.html b/static/talks/bread_board_yapc_na_2012/037b.html new file mode 100644 index 0000000..bd702a4 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/037b.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>037b</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "037" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "037c" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Bread::Board::Declare + + · typemaps are much simplified + + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/037c.html b/static/talks/bread_board_yapc_na_2012/037c.html new file mode 100644 index 0000000..44d49f2 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/037c.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>037c</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "037b" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "037z" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Bread::Board::Declare + + · typemaps are much simplified + · attributes with class_type constraints automatically get a typemap + + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/037z.html b/static/talks/bread_board_yapc_na_2012/037z.html new file mode 100644 index 0000000..908bf38 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/037z.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>037z</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "037c" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "038.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Bread::Board::Declare + + · typemaps are much simplified + · attributes with class_type constraints automatically get a typemap + · «infer => 1» infers as many dependencies as possible + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/038.pl.html b/static/talks/bread_board_yapc_na_2012/038.pl.html new file mode 100644 index 0000000..8369221 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/038.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>038.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "037z" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "039.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + MongoDBx::Bread::Board::Container + +container MyApp => as { + container MongoDBx::Bread::Board::Container->new( + name => 'myapp_db', + host => 'localhost', + database_layout => { + user_db => ['standard_users', 'super_users'], + }, + ); + + service authenticator => ( + class => 'Authenticator', + dependencies => ['myapp_db/user_db/standard_users'], + ); +}; + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/039.pl.html b/static/talks/bread_board_yapc_na_2012/039.pl.html new file mode 100644 index 0000000..9d19129 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/039.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>039.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "038.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "040.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + Catalyst::Plugin::Bread::Board + +package MyApp; +use Catalyst 'Bread::Board'; + +__PACKAGE__->config( + 'Plugin::Bread::Board' => { + container => MyApp::Container->new, + } +); + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/040.pl.html b/static/talks/bread_board_yapc_na_2012/040.pl.html new file mode 100644 index 0000000..5d846c5 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/040.pl.html @@ -0,0 +1,52 @@ +<html> +<head> +<title>040.pl</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "039.pl" + ".html"; + return false; + } + if (keynum == 13 || keynum == 32) { + window.location = "041" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + OX + +package MyApp; +use OX; + +has model => (is => 'ro', isa => 'Model'); +has view => (is => 'ro', isa => 'View'); + +has controller => ( + is => 'ro', + isa => 'Controller', + infer => 1, +); + +router as { + route '/' => 'controller.index'; +}; + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/041.html b/static/talks/bread_board_yapc_na_2012/041.html new file mode 100644 index 0000000..a550e75 --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/041.html @@ -0,0 +1,48 @@ +<html> +<head> +<title>041</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 8) { + window.location = "040.pl" + ".html"; + return false; + } + if (keynum == 73 || keynum == 105) { + window.location = "index.html"; + return false; + } + return true; +} +</script> +</head> +<body onkeypress="return navigate(event)"> +<pre> + + + + + + + + Questions? + + https://metacpan.org/module/Bread::Board + https://metacpan.org/module/Bread::Board::Declare + https://github.com/stevan/OX + + + + + + + + + + + +</pre> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/index.html b/static/talks/bread_board_yapc_na_2012/index.html new file mode 100644 index 0000000..3247c2e --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/index.html @@ -0,0 +1,76 @@ +<html> +<head> +<title>Dependency Injection with Bread::Board</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<script> +function navigate(e) { + var keynum = (window.event) // IE + ? e.keyCode + : e.which; + if (keynum == 13 || keynum == 32) { + window.location = "001.html"; + return false; + } + return true; +} +</script> +<style> +body { + font-family: sans-serif; +} +h4 { + color: #888; +} +</style> +</head> +<body> +<h4>Use SPACEBAR to peruse the slides or click one to start...<h4> +<h1>Dependency Injection with Bread::Board</h1> +<ul> +<li><a href="001.html">Dependency Injection with Bread::Board</a></li> +<li><a href="002.html">A Motivating Example</a></li> +<li><a href="003.pl.html">package MyApp;</a></li> +<li><a href="004.pl.html">package MyApp;</a></li> +<li><a href="005.pl.html">package MyApp;</a></li> +<li><a href="006.pl.html">package MyApp;</a></li> +<li><a href="007.html">Dependency Injection</a></li> +<li><a href="008.html">Benefits to Dependency Injection</a></li> +<li><a href="009.html">Bread::Board</a></li> +<li><a href="010.pl.html">Bread::Board</a></li> +<li><a href="011.html">Services</a></li> +<li><a href="012.pl.html">Bread::Board::ConstructorInjection</a></li> +<li><a href="013.pl.html">Bread::Board::BlockInjection</a></li> +<li><a href="014.pl.html">Bread::Board::Literal</a></li> +<li><a href="015.html">Containers</a></li> +<li><a href="016.html">Dependencies</a></li> +<li><a href="017.pl.html">Dependencies</a></li> +<li><a href="018.pl.html">Dependencies</a></li> +<li><a href="019.pl.html">Dependencies</a></li> +<li><a href="020.html">Parameters</a></li> +<li><a href="021.pl.html">Parameters</a></li> +<li><a href="022.pl.html">Parameters</a></li> +<li><a href="023.pl.html">Parameters</a></li> +<li><a href="024.pl.html">Parameters</a></li> +<li><a href="025.pl.html">Parameters</a></li> +<li><a href="026.html">Lifecycles</a></li> +<li><a href="027.pl.html">Bread::Board</a></li> +<li><a href="028.html">Best Practices</a></li> +<li><a href="029.pl.html">package MyApp::Container;</a></li> +<li><a href="030.pl.html">container SomethingElse => as {</a></li> +<li><a href="031.html">Typemaps</a></li> +<li><a href="032.pl.html">package Model</a></li> +<li><a href="033.pl.html">my $c = container MyApp => as {</a></li> +<li><a href="034.html">Typemaps</a></li> +<li><a href="035.pl.html">Bread::Board::Declare</a></li> +<li><a href="036.html">Bread::Board::Declare</a></li> +<li><a href="037.html">Bread::Board::Declare</a></li> +<li><a href="038.pl.html">MongoDBx::Bread::Board::Container</a></li> +<li><a href="039.pl.html">Catalyst::Plugin::Bread::Board</a></li> +<li><a href="040.pl.html">OX</a></li> +<li><a href="041.html">Questions?</a></li> +</ul> +<p>This presentation was generated by <a +href="http://ingydotnet.github.com/vroom-pm">Vroom</a>. Use <SPACE> key to go +forward and <BACKSPACE> to go backwards. +</p> +</body> diff --git a/static/talks/bread_board_yapc_na_2012/slides.vroom b/static/talks/bread_board_yapc_na_2012/slides.vroom new file mode 100644 index 0000000..404431f --- /dev/null +++ b/static/talks/bread_board_yapc_na_2012/slides.vroom @@ -0,0 +1,508 @@ +# urxvt -fg black -bg white +# setfont 'xft:DejaVuSansMono-19:bold' +# echo 'set exrc' >> ~/.vimrc + +---- config +title: Dependency Injection with Bread::Board +indent: 4 +auto_size: 1 + +---- center +Dependency Injection with Bread::Board + +Jesse Luehrs +Infinity Interactive +doy@cpan.org +---- +== A Motivating Example +---- perl,i0 +package MyApp; +use MyFramework; + +sub call { + my $self = shift; + + my $dbh = DBI->connect('dbi:mysql:myapp_db'); + my $hello = $dbh->selectall_arrayref('SELECT * FROM my_table')->[0][0]; + + my $template = Template->new(INCLUDE_PATH => 'root/template'); + $template->process('hello.tt', { hello => $hello }, \(my $output)); + + return $output; +} +---- perl,i0 +package MyApp; +use MyFramework; + +has model => (is => 'ro', isa => 'Model', default => sub { Model->new }); +has view => (is => 'ro', isa => 'View', default => sub { View->new }); + +sub call { + my $self = shift; + my $hello = $self->model->get_hello; + return $self->view->render($hello); +} +---- perl,i0 +package MyApp; +use MyFramework; + +has logger => ( + is => 'ro', isa => 'Logger', + default => sub { Logger->new } +); +has model => ( + is => 'ro', isa => 'Model', lazy => 1, + default => sub { Model->new(logger => $_[0]->logger) }, +); +has view => ( + is => 'ro', isa => 'View', lazy => 1, + default => sub { View->new(logger => $_[0]->logger) }, +); + +sub call { + my $self = shift; + my $hello = $self->model->get_hello; + return $self->view->render($hello); +} +---- perl,i0 +package MyApp; +use MyFramework; + +has dsn => (is => 'ro', isa => 'Str', default => 'dbi:mysql:myapp_db'); +has tt_root => (is => 'ro', isa => 'Str', default => 'root/template'); +has logger => (is => 'ro', isa => 'Logger', default => sub {Logger->new}); +has model => ( + is => 'ro', isa => 'Model', lazy => 1, + default => sub { + my $m = Model->connect($_[0]->dsn); + $m->set_logger($_[0]->logger); + return $m; + }, +); +has view => ( + is => 'ro', isa => 'View', lazy => 1, + default => sub { + View->new(logger => $_[0]->logger, tt_root => $_[0]->tt_root); + }, +); + +sub call { ... } +---- +Dependency Injection + ++ · a form of inversion of control ++ · "the inverse of garbage collection" ++ · manages object construction +---- +Benefits to Dependency Injection + ++ · provides access to the same object creation code + that your app will actually use ++ · removes need for globals ++ · testing and reuse +---- center,-i1 +== Bread::Board + ++ +-----------------------------------------+ + | A B C D E F G H I J | + |-----------------------------------------| + | o o | 1 o-o-o-o-o v o-o-o-o-o 1 | o o | + | o o | 2 o-o-o-o-o o-o-o-o-o 2 | o o | + | o o | 3 o-o-o-o-o o-o-o-o-o 3 | o o | + | o o | 4 o-o-o-o-o o-o-o-o-o 4 | o o | + | o o | 5 o-o-o-o-o o-o-o-o-o 5 | o o | + | | 6 o-o-o-o-o o-o-o-o-o 6 | | + | o o | 7 o-o-o-o-o o-o-o-o-o 7 | o o | + | o o | 8 o-o-o-o-o o-o-o-o-o 8 | o o | + | o o | 9 o-o-o-o-o o-o-o-o-o 9 | o o | + | o o | 10 o-o-o-o-o o-o-o-o-o 10 | o o | + | o o | 11 o-o-o-o-o o-o-o-o-o 11 | o o | + | | 12 o-o-o-o-o o-o-o-o-o 12 | | + | o o | 13 o-o-o-o-o o-o-o-o-o 13 | o o | + | o o | 14 o-o-o-o-o o-o-o-o-o 14 | o o | + | o o | 15 o-o-o-o-o o-o-o-o-o 15 | o o | + | o o | 16 o-o-o-o-o ^ o-o-o-o-o 16 | o o | + +-----------------------------------------+ +---- perl,i0 +== Bread::Board + +my $c = container MyApp => as { + service dsn => 'dbi:mysql:myapp_db'; + service logger => (class => 'Logger', lifecycle => 'Singleton'); + service view => (class => 'View', dependencies => ['logger']); + + service model => ( + class => 'Model', + dependencies => ['logger', 'dsn'], + block => sub { + my $m = Model->connect($_[0]->param('dsn')); + $m->set_logger($_[0]->param('logger')); + return $m; + }, + ); + service app => ( + class => 'MyApp', + dependencies => ['model', 'view'], + ); +}; +$c->resolve(service => 'app'); +---- +== Services + ++ · represent the data you're storing ++ · access contents via the ->get method ++ · three built-in types: +---- perl +== Bread::Board::ConstructorInjection + +service view => ( + class => 'View', +); +---- perl +== Bread::Board::BlockInjection + +service model => ( + class => 'Model', # optional + block => sub { + my $m = Model->new + $m->initialize; + return $m; + }, +); +---- perl +== Bread::Board::Literal + +service dsn => 'dbi:mysql:myapp_db'; +---- +== Containers + ++ · hold services and other containers ++ · access contents via the ->fetch method ++ · ->resolve is a shortcut method for ->fetch(...)->get +---- +== Dependencies + ++ · tells Bread::Board how your classes are related ++ · specified as a map of names to service paths + (there are shortcuts for common cases) +---- perl,i0 +== Dependencies + +service logger => (class => 'Logger'); +service view => ( + class => 'View', + dependencies => ['logger'], +); +---- perl,i0 +== Dependencies + +service dsn => 'dbi:mysql:myapp_db'; +service model => ( + class => 'Model', + dependencies => ['dsn'], + block => sub { + my $service = shift; + return Model->connect($service->param('dsn')); + }, +); +---- perl,i0 +== Dependencies + +container MyApp => as { + container Model => as { + service dsn => 'dbi:mysql:myapp_db'; + service model => ( + class => 'Model', + dependencies => ['dsn'], + block => sub { + my $service = shift; + return Model->connect($service->param('dsn')); + }, + ); + }; + service app => ( + class => 'MyApp', + dependencies => ['Model/model'], + ); +}; +---- +== Parameters + ++ · like dependencies, but supplied when calling ->get or ->resolve +---- perl,i0 +== Parameters + +my $c = container MyApp => as { + service user => ( + class => 'User', + parameters => { + name => { isa => 'Str' }, + }, + ); +}; +$c->resolve(service => 'user', parameters => { name => 'doy' }); +---- perl,i0 +== Parameters + +my $c = container MyApp => as { + service user => ( + class => 'User', + parameters => { + name => { isa => 'Str' }, + }, + ); + service superusers => ( + block => sub { [ $_[0]->param('root') ] }, + dependencies => { + root => { user => { name => 'root' } }, + }, + ); +}; +---- perl,i0 +== Parameters + +my $c = container MyApp => as { + service user => ( + class => 'User', + parameters => { + name => { isa => 'Str' }, + }, + ); + service superusers => ( + block => sub { + [ $_[0]->param('user')->inflate(name => 'root') ] + }, + dependencies => ['user'], + ); +}; +---- perl,i0 +== Parameters + +my $c = container MyApp => as { + service default_username => 'guest'; + service user => ( + class => 'User', + parameters => { + name => { isa => 'Str', optional => 1 }, + }, + dependencies => { + name => 'default_username', + }, + ); +}; +# user with name 'guest' +$c->resolve(service => 'user'); +# user with name 'doy' +$c->resolve(service => 'user', parameters => { name => 'doy' }); +---- perl,i0 +== Parameters + +my $c = container MyApp => as { + service user => ( + class => 'User', + parameters => { + name => { isa => 'Str', optional => 1, default => 'guest' }, + }, + ); +}; +# user with name 'guest' +$c->resolve(service => 'user'); +# user with name 'doy' +$c->resolve(service => 'user', parameters => { name => 'doy' }); +---- +== Lifecycles + ++ · this is what determines what happens when ->get is called ++ · by default, each call to ->get creates a new object ++ · by specifying «lifecycle => 'Singleton'» when creating the service, + the same object will be returned each time +---- perl,i0 +== Bread::Board + +my $c = container MyApp => as { + service dsn => 'dbi:mysql:myapp_db'; + service logger => (class => 'Logger', lifecycle => 'Singleton'); + service view => (class => 'View', dependencies => ['logger']); + + service model => ( + class => 'Model', + dependencies => ['logger', 'dsn'], + block => sub { + my $m = Model->connect($_[0]->param('dsn')); + $m->set_logger($_[0]->param('logger')); + return $m; + }, + ); + service app => ( + class => 'MyApp', + dependencies => ['model', 'view'], + ); +}; +$c->resolve(service => 'app'); +---- +== Best Practices + ++ · only use containers during initialization ++ · factories ++ · avoid unnecessary subcontainers ++ · container classes +---- perl,i0 +package MyApp::Container; +use Moose; +extends 'Bread::Board::Container'; + +sub BUILD { + container $self => as { + ...; + }; +} +---- perl,i0 +container SomethingElse => as { + container MyApp::Container->new; +}; +---- +== Typemaps + ++ · defines a mapping from a class_type to a service ++ · instead of requesting a particular service, you can request an + object of a particular type: $c->resolve(type => 'Model'); ++ · with this, we can (mostly) infer the dependencies for a given class +---- perl,i0 +package Model +use Moose; +has logger => (is => 'ro', isa => 'Logger', required => 1); + +package Logger; +use Moose; +---- perl,i0 +my $c = container MyApp => as { + typemap Logger => infer; + typemap Model => infer; +}; +$c->resolve(type => 'Model')->logger; # a valid logger object +---- +== Typemaps + ++ · required attributes are automatically inferred, becoming either + dependencies (on types) or parameters (if the type doesn't exist + in the typemap) ++ · non-required attributes can still be satisfied by parameters +---- perl,i0 +== Bread::Board::Declare + +package MyApp::Container; +use Moose; +use Bread::Board::Declare; + +has dsn => (is => 'ro', isa => 'Str', value => 'dbi:mysql:myapp_db'); +has logger => (is => 'ro', isa => 'Logger'); +has view => (is => 'ro', isa => 'View', infer => 1); + +has model => ( + is => 'ro', + isa => 'Model', + infer => 1, + dependencies => ['dsn'], + block => sub { + my $m = Model->connect($_[0]->param('dsn')); + $m->set_logger($_[0]->param('logger')); + return $m; + }, +); +has app => (is => 'ro', isa => 'MyApp', infer => 1); +---- +== Bread::Board::Declare + ++ · services are declared just by defining attributes ++ · attribute accessors resolve the service if no value is set ++ · if the attribute has a value, it is used in dependency resolution ++ · MyApp::Container->new(dsn => 'dbi:mysql:other_db')->model +---- +== Bread::Board::Declare + ++ · typemaps are much simplified ++ · attributes with class_type constraints automatically get a typemap ++ · «infer => 1» infers as many dependencies as possible +---- perl,i0 +== MongoDBx::Bread::Board::Container + +container MyApp => as { + container MongoDBx::Bread::Board::Container->new( + name => 'myapp_db', + host => 'localhost', + database_layout => { + user_db => ['standard_users', 'super_users'], + }, + ); + + service authenticator => ( + class => 'Authenticator', + dependencies => ['myapp_db/user_db/standard_users'], + ); +}; +---- perl,i0 +== Catalyst::Plugin::Bread::Board + +package MyApp; +use Catalyst 'Bread::Board'; + +__PACKAGE__->config( + 'Plugin::Bread::Board' => { + container => MyApp::Container->new, + } +); + +---- perl,i0 +== OX + +package MyApp; +use OX; + +has model => (is => 'ro', isa => 'Model'); +has view => (is => 'ro', isa => 'View'); + +has controller => ( + is => 'ro', + isa => 'Controller', + infer => 1, +); + +router as { + route '/' => 'controller.index'; +}; + +---- center +Questions? + +https://metacpan.org/module/Bread::Board +https://metacpan.org/module/Bread::Board::Declare +https://github.com/stevan/OX +---- skip +motivating example (5m, 5s) +- everything inline +- separate model/view classes +- model and view classes both want a logger +- model and logger both want configuration +overview of dependency injection (5m, 1s) +- high level description +- ...??? +bread::board (15m, 4s) +- simple example (translation of intro?) +- services and containers +- dependencies, parameters +- lifecycles +- typemaps +- best practices + - not global - factory classes/closures, etc + - container classes +bread::board::declare (10m) +- show example +- attributes are services are attributes +- automatic typemapping +- subclassing, roles +- subcontainers +real world usage (10m) +- bread::board::container::mongodb +- catalyst::plugin::bread::board +- ox +questions (5m) |