MidasTouch has asked for the wisdom of the Perl Monks concerning the following question:
This is the code for Slic3r::Print->newhas '_print' => ( is => 'ro', default => sub { Slic3r::Print->new }, handles => [qw(apply_config extruders expanded_output_fil +epath total_used_filament total_extruded_volume placeholder_parser process)], );
1. _print doesn't pass any parameters, so what is $class supposed to be assigned? I'm guessing the object which calls the method? 2. _new, haven't been able to find the relevant code for this subroutine. If Simple inherits from Moo::Object then it's in a file with package Moo::Object, right? Or is there some other possibility? 3. placeholder_parser. There is no placeholder_parser subroutine definition in the entire directory for the program or the Perl library. So, what exactly is it doing? Also, if self refers to the Simple object, then how is it calling the delegate before Print->new has returned a value? Thankssub new { # TODO: port PlaceholderParser methods to C++, then its own constr +uctor # can call them and no need for this new() method at all my ($class) = @_; my $self = $class->_new; $self->placeholder_parser->apply_env_variables; $self->placeholder_parser->update_timestamp; return $self; }
|
|---|