Rake project main page:
http://rake.rubyforge.org/
Rake syntax:
http://rake.rubyforge.org/files/doc/rakefile_rdoc.html
Rake tutorial:
http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial
In general it's a embedded domain specific language doing same things
as the unix make utill but it is using only ruby language.
I'm not a perl expert and I would need some feedback from some more
experienced perl programmers.
The source code is available at http://manta.univ.gda.pl/~ksuchoms/pake.tar.gz
You will find there:
1) pake - main app, definition of method available in Pakefile
try running:
./pake -T
./pake test3
./pake program
2) Pakefile - the srcipt where you define dependencies
3) Pake - in this directory you will find all perl classes I'm using
in the pake.
First question goes to the language that should be exposed in Pakefile
(analogy to Makefile, Rakefile scripts)
In rake you would define task like this:
task :prereq1 do
# ruby code here
end
task :name => [:prereq1] do
# task name depends on prereq1 task, so if you run task name it
# will execute prereq1 first after that body of this task
end
In perl, by prototyping I've achieved smth like this:
task {
# task code here
} "test";
task {
# test1 task depends on test task
# test 1 task code here
} "test1" => ["test"];
Can I move the anonymous subroutine to the end of the task function
call, so that I would not be forced to write it like this:
task "test", sub {
# task code here
};
but like this:
task "test" {
# task code here
};
.
Another issue is more about perl idioms. I'm mainly programming java
so it's quite bizarre for me that if I bless hash variable to object I
have no option to block access to some variable (private modifier in
java).
What is the preffered style:
Creating set/get subroutines
using Autoload?
direct access through blessed variable
some other option?
I'm also interested what elements of rake language should be in the
perl version I'm writing out of the box. Namespaces? Adding some
specific tasks? Integration with some existing perl frameworks? Maybe
you are doing some things repeatedly and you would find it useful. I
will appreciate any feedback and opinions.
> I'm trying to rewrite rake, "build language" so it would fit within
> perl. If you don't know what is rake here you find all the info:
Interesting idea ;-) It takes the Module::Build idea, and takes it three
steps further away from simple, back toward a generic make, but perlishly.
In my estimation, you'll get much more feedback by posting to
www.perlmonks.org than usenet groups.
> I'm not a perl expert and I would need some feedback from some more
> experienced perl programmers.
First feedback: not everyone has threads enabled in their perl... a better
error message would be appreciated ;-)
> In perl, by prototyping I've achieved smth like this:
>
> task {
> # task code here
> } "test";
>
> task {
> # test1 task depends on test task
> # test 1 task code here
> } "test1" => ["test"];
>
> Can I move the anonymous subroutine to the end of the task function
> call, so that I would not be forced to write it like this:
Apparently not. At least, not without some sort of source filter.
> task "test", sub {
> # task code here
> };
>
> but like this:
> task "test" {
> # task code here
> };
> .
>
>
> Another issue is more about perl idioms. I'm mainly programming java
> so it's quite bizarre for me that if I bless hash variable to object I
> have no option to block access to some variable (private modifier in
> java).
Right. See perltoot.
That said, you may want to use Class::InsideOut which kind of does this for
you. Personally, I'm not a fan, but others with more experience than I are
fans, so it may be a good idea to check it out and decide for yourself.
> What is the preffered style:
> Creating set/get subroutines
FYI: in perl, this is one subroutine, not two.
sub foo {
my $self = shift;
if (@_) {
$self->{foo} = shift;
}
$self->{foo}
}
> using Autoload?
I only do this when I can't know at compile time what my attributes will be
(e.g., for base classes).
> direct access through blessed variable
No. Just like in Java, this prevents us from doing any debugging based on
access to this variable. With the above, you can go into the debugger and
put a breakpoint on the set-line, and get stack traces of any access.
Direct access makes this much more painful.
> some other option?
>
> I'm also interested what elements of rake language should be in the
> perl version I'm writing out of the box. Namespaces? Adding some
> specific tasks? Integration with some existing perl frameworks? Maybe
> you are doing some things repeatedly and you would find it useful. I
> will appreciate any feedback and opinions.
I'm sure most perl gurus would just shrug and say, "eh, makefiles are
working for me just fine." :-)
Again, I'll say that you should try posting your question to perlmonks.org -
you'll likely get much more feedback there :-)