VCS::CSync 0.01 and Param::Coerce 'from'

Alias on 2005-06-05T02:47:56

Update: The code at bottoms looks broken to me... WTF?

So another birthday rolls around, and I'm still stuck in my home town, not quite ready to go back to Sydney... darn it.

To treat myself, I spent my birthday making life a little more convenient. I paid for XChat for Win32, cause I'm just sick of mIRC. I also shelled out for a copy of iRadio, so I never have to go searching for mp3s again.

On the CPAN side, I've created csync (uploaded to CPAN as VCS::CSync).

csync is intended to be a small and extremely easy to use utility for extracting things from code repositories and publishing it to places. The focus is simplicity and usability, not amazing features. Clkao has a monopoly on super-advanced version control stuff already.

This is intended to be the sort of thing you can create one config file for, add csync --cron to your crontab, and it will push exported copies of various files and modules from various repositories of various types to various targets, with enough smarts to know how remove/replace, overwrite, overlay, or delicately overlay the target, to support a variety of scenarious.

For now, I've just got it publishing my personal attempt at the JSAN concept to my website, updated hourly.

http://ali.as/devel/PNJS

csync has been built as about 90% modules, so if you want you can hook into VCS::CSync to do various publishing tasks of your own. It's not well documented yet, and I'll get to that once it has a few more features.

I've also been playing with coercion in my head a little again, as I'm getting more and more negative on the idea of pushing to the destination class, such as Param::Coerce currently does, and Perl 6 will do with the as method/operator.

To try a different direction, I've added an importable from method to Param::Coerce, so now you can use this syntax.
package My::Class;

use Param::Coerce 'from';

package Other::Class;

sub new { my $class = shift; my $param = My::Class->from(shift) or die "Bad param"; ... }


If this feels comfortable, I'll be thinking about having a shot at the coerce.pm, as.pm, from.pm family of modules in the next few months.


update?

phillup on 2005-06-09T17:26:54

I'm waaaaayyyy behind in my reading of this site. So, sorry if you have already found an answer!

If you are talking about the formatting of your code, then I think you want to wrap your code in "ecode" tags.
package My::Class;
use Param::Coerce 'from';
package Other::Class;
 
sub new { my $class = shift;
  my $param = My::Class->from(shift) or die "Bad param";
  ...
}
HTH!