Menu

What variables are accessible to a command?

Help
2010-07-19
2013-03-15
  • Terrence M. Brannon

    If I write a command for use within a rule, what variables are accessible to that command and how?

    I have a working rule, which is entirely perl:

    $(EDAN_EL): $(WARES)$(GEST)
        perl {{
        use File::Butler;   
        my $lines = Butler('init.el', 'read');
        my $loc = sprintf "$WARES$GEST";
        $lines =~ s/__LOC__/$loc/g;
        Butler( $EDAN_EL, prepend => \$lines );
        }}
    

    I want to abstract this out as a command, but am not sure what variables I will need to pass and which ones will be available to it.

    I think this would make good doc material in the Extending section.

     
  • Daniel Pfeiffer

    Daniel Pfeiffer - 2010-08-06

    http://makepp.sourceforge.net/1.50/makepp_variables.html#variables_and_perl

    I don't get the point of your sprintf above.

    I don't know File::Butler and the doc CPAN manages to extract is rather scanty.  But it looks to me like the mpp builtins will do all that butler can and much more.  If I understand the above right, it's the same as:

    $(EDAN_EL): $(WARES)$(GEST)
        &sed s/__LOC__/$(input)/g init.el -o $(output)
    

    Which doesn't make sence.  I guess you want:

    $(EDAN_EL): init.el
        &sed s/__LOC__/$(WARES)$(GEST)/g $(input) -o $(output)
    
     

Log in to post a comment.