MySQL-ORM
view release on metacpan or search on metacpan
lib/MySQL/ORM/Generate/Writer.pm view on Meta::CPAN
}
}
@public = sort @public;
$self->_write( fh => $fh, text => join( "\n\n", @public ) );
$self->_write( fh => $fh );
@private = sort @private;
$self->_write( fh => $fh, text => join( "\n\n", @private ) );
$self->_write( fh => $fh );
#
# moose methods section
#
@public = ();
@private = ();
foreach my $method (@$methods) {
$method = trim $method;
if ( $method =~ /^method\s+_/ or $method =~ /^sub\s+_/ ) {
push @private, $method;
}
else {
push @public, $method;
}
}
@public = sort @public;
$self->_write( fh => $fh, text => join( "\n\n", @public ) );
$self->_write( fh => $fh );
@private = sort @private;
$self->_write( fh => $fh, text => join( "\n\n", @private ) );
$self->_write( fh => $fh );
$self->_write( fh => $fh, text => '1;' );
close($fh);
$self->_tidy($file_name);
$self->trace('exit');
}
##############################################################################
## private methods
##############################################################################
method _tidy (Str $file_name) {
my $cmd = "perltidier -b -bext='/' $file_name";
# pdump $cmd;
my ( $stdout, $stderr, $exit ) = capture {
system($cmd);
};
if ($exit) {
confess "$stdout\n$stderr";
}
return;
#local @ARGV = ('-b', "-bext='/'", $file_name);
#Perl::Tidy::Sweetened::perltidy();
}
#method _tidy (Str $file_name) {
#
# my $cmd = "perltidier -b -bext='/' $file_name";
# system($cmd);
# die if $?;
#}
method _write ( Ref :$fh, Str :$text ) {
print $fh $text if $text;
print $fh "\n";
}
1;
( run in 0.539 second using v1.01-cache-2.11-cpan-f56aa216473 )