From: Dave Rolsky Date: Sun, 7 Jun 2009 18:51:54 +0000 (-0500) Subject: moved slides to slides X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9b1950484568c2d4eb09611053ec64f987c2bf0e;p=gitmo%2Fmoose-presentations.git moved slides to slides --- diff --git a/moose-class/index.html b/moose-class/slides/index.html similarity index 89% rename from moose-class/index.html rename to moose-class/slides/index.html index d860eb0..dcae330 100644 --- a/moose-class/index.html +++ b/moose-class/slides/index.html @@ -836,6 +836,7 @@ use Moose; @@ -872,14 +873,14 @@ use Moose;

WRONG

-
package BadEmployee;
+  
package EvilEmployee;
 use Moose;
 extends 'Person';
 extends 'Thief';

RIGHT

-
package BadEmployee;
+  
package EvilEmployee;
 use Moose;
 extends 'Person', 'Thief';
@@ -904,6 +905,90 @@ extends 'LWP';
+

overrides and super

+ +
    +
  • overrides is another method modifier
  • +
  • An alternative to Perl's SUPER::
  • +
+
+ +
+

overrides and super

+ +
package Employee;
+use Moose;
+
+extends 'Person';
+
+overrides work => sub {
+    my $self = shift;
+
+    die "Pay me first" unless $self->got_paid;
+    super();
+};
+ +
+

Caveat super

+ +
    +
  • Mostly like $self->SUPER::work(@_)
  • +
  • But cannot change @_!
  • +
  • Binds the parent's method at compile time
  • +
+
+ +
+

Attributes (Part 1)

+ +
    +
  • has 'foo'
  • +
  • Use is => 'ro' or is => 'rw'
  • +
  • Attributes without "is" have no accessors
  • +
+
+ +
+

Read-write attributes

+ +
package Person;
+use Moose;
+
+has 'first_name' => ( is => 'rw' );
+
+my $person =
+    Person->new( first_name => 'Dave' );
+
+$person->first_name('Stevan');
+print $person->first_name; # Stevan
+ +
+ +
+

Read-only attributes

+ +
package Person;
+use Moose;
+
+has 'first_name' => ( is => 'ro' );
+
+my $person =
+    Person->new( first_name => 'Dave' );
+
+$person->first_name('Stevan');
+print $person->first_name; # Dave
+ +
+ +
+

There is More to Come

+ +
    +
  • Attributes have a lot of features
  • +
+
+ +

Cleaning Up Moose Droppings

package Person;
@@ -953,5 +1038,26 @@ use Moose;
 __PACKAGE__->meta->make_immutable;
+
+

What make_immutable does

+ +
    +
  • Magic
  • +
  • Uses eval to "inline" a constructor
  • +
  • Memoizes a lot of meta-information
  • +
  • Makes loading your class slower
  • +
  • Makes object creation much faster
  • +
+
+ +
+

When to Immutabilize?

+ +
    +
  • Almost always
  • +
  • Startup time vs execution time
  • +
+
+ diff --git a/moose-class/outline b/moose-class/slides/outline similarity index 100% rename from moose-class/outline rename to moose-class/slides/outline diff --git a/moose-class/ui/bg-shade.png b/moose-class/slides/ui/bg-shade.png similarity index 100% rename from moose-class/ui/bg-shade.png rename to moose-class/slides/ui/bg-shade.png diff --git a/moose-class/ui/custom.css b/moose-class/slides/ui/custom.css similarity index 95% rename from moose-class/ui/custom.css rename to moose-class/slides/ui/custom.css index 2840f55..fc54819 100644 --- a/moose-class/ui/custom.css +++ b/moose-class/slides/ui/custom.css @@ -17,6 +17,10 @@ div#header, div#footer { color: black; } +.slide h1 { + text-transform: none; +} + span.date, span.uri { font-size: 80%; } @@ -44,7 +48,7 @@ img.for-slide { .slide pre { font-size: 100%; - line-height: 130%; + line-height: 110%; } .highlight { @@ -55,9 +59,6 @@ img.for-slide { font-size: 33%; } -.slide pre code { -} - .slide table.side-by-side tr { vertical-align: top; } diff --git a/moose-class/ui/default/blank.gif b/moose-class/slides/ui/default/blank.gif similarity index 100% rename from moose-class/ui/default/blank.gif rename to moose-class/slides/ui/default/blank.gif diff --git a/moose-class/ui/default/bodybg.gif b/moose-class/slides/ui/default/bodybg.gif similarity index 100% rename from moose-class/ui/default/bodybg.gif rename to moose-class/slides/ui/default/bodybg.gif diff --git a/moose-class/ui/default/framing.css b/moose-class/slides/ui/default/framing.css similarity index 100% rename from moose-class/ui/default/framing.css rename to moose-class/slides/ui/default/framing.css diff --git a/moose-class/ui/default/iepngfix.htc b/moose-class/slides/ui/default/iepngfix.htc similarity index 100% rename from moose-class/ui/default/iepngfix.htc rename to moose-class/slides/ui/default/iepngfix.htc diff --git a/moose-class/ui/default/notes.css b/moose-class/slides/ui/default/notes.css similarity index 100% rename from moose-class/ui/default/notes.css rename to moose-class/slides/ui/default/notes.css diff --git a/moose-class/ui/default/opera.css b/moose-class/slides/ui/default/opera.css similarity index 100% rename from moose-class/ui/default/opera.css rename to moose-class/slides/ui/default/opera.css diff --git a/moose-class/ui/default/outline.css b/moose-class/slides/ui/default/outline.css similarity index 100% rename from moose-class/ui/default/outline.css rename to moose-class/slides/ui/default/outline.css diff --git a/moose-class/ui/default/pretty.css b/moose-class/slides/ui/default/pretty.css similarity index 100% rename from moose-class/ui/default/pretty.css rename to moose-class/slides/ui/default/pretty.css diff --git a/moose-class/ui/default/print.css b/moose-class/slides/ui/default/print.css similarity index 100% rename from moose-class/ui/default/print.css rename to moose-class/slides/ui/default/print.css diff --git a/moose-class/ui/default/s5-core.css b/moose-class/slides/ui/default/s5-core.css similarity index 100% rename from moose-class/ui/default/s5-core.css rename to moose-class/slides/ui/default/s5-core.css diff --git a/moose-class/ui/default/slides.css b/moose-class/slides/ui/default/slides.css similarity index 100% rename from moose-class/ui/default/slides.css rename to moose-class/slides/ui/default/slides.css diff --git a/moose-class/ui/default/slides.js b/moose-class/slides/ui/default/slides.js similarity index 100% rename from moose-class/ui/default/slides.js rename to moose-class/slides/ui/default/slides.js diff --git a/moose-class/ui/s5-notes.html b/moose-class/slides/ui/s5-notes.html similarity index 100% rename from moose-class/ui/s5-notes.html rename to moose-class/slides/ui/s5-notes.html