|
Posted by Krzysiek on July 5, 2008, 5:46 am
Please log in for more thread options
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:
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.
|