in reply to Saltine::Toffee

But do you have to get a new oven and pan every time?

How can you feel when you're made of steel? I am made of steel. I am the Robot Tourist.
Robot Tourist, by Ten Benson

Replies are listed 'Best First'.
Re^2: Saltine::Toffee (news)
by tye (Sage) on Dec 28, 2005 at 15:50 UTC
    But do you have to get a new oven and pan every time?

    I think that this:

    $pan->melt­();

    explains the need for a "new pan every time". And I doubt doing that leaves the oven in very good shape either.

    - tye        

      yes yes, (and lol! tye), i was just thinking about that.

      i think the "correct" $pan handling block ought to be:
      my $pan = Saucepan->new(); $pan->heat( "medium" ); wait() until $pan->temperature( "warm" ); $pan += Ingredient->new( "butter", cup => .5 ); $pan += Ingredient->new( "sugar", cup => .5 ); wait() until $pan->contents()->state( "melted" ); $pan->bubble($_) for Time->new( minute => (1 || 2) );
Re^2: Saltine::Toffee
by jdporter (Paladin) on Dec 29, 2005 at 12:46 UTC
    But do you have to get a new oven and pan every time?

    Of course not. Those new methods just return refs to singleton instances.

    We're building the house of the future together.
      There's a lot going on that's not obvious at first.

      Note that ->contents() can either be passed an ID to return a particular content object from the container, or be passed nothing to return an object representing all contained objects. The Saucepan class has a few convenience methods that automatically generate such an object and do the work on it: $pan->melt is just shorthand for $pan->contents()->melt; same with $pan->bubble.

      The Cookie::Sheet class is more generic and doesn't have such methods, since they could cause confusion. Note the $sheet->contents()->state( "cool" ) call; state iterates over each object contained in the object returned by contents() and verifies that they are all "cool". $sheet->state( "cool" ) just checks that the sheet itself is cool; some of it's contents may still be hot.

      Another nice thing is the Ingredient class; it's constructor can take a quantity or it can return a lazy object whose quantity is undetermined until it's actually used in a quantized context, e.g. $sheet->spread( Ingredient->new( "crackers", type => "saltine" ),