Alzabo-GUI-Mason
view release on metacpan or search on metacpan
inc/Alzabo/GUI/Mason/Build.pm view on Meta::CPAN
foreach my $from_f ( grep { ( ! /~\Z/ ) &&
-f File::Spec->catfile( $from, $_ ) }
readdir $dh )
{
my $to_f = File::Spec->catfile( $to, $from_f );
$to_f =~ s/\.mhtml$/$ext/;
my $target =
$self->copy_if_modified( from => File::Spec->catfile( $from, $from_f ),
to => $to_f,
);
# was up to date
next unless $target;
$count++;
chown $self->{Alzabo}{uid}, $self->{Alzabo}{gid}, $target
or die "Can't chown $target to $self->{Alzabo}{user}/$self->{Alzabo}{group}: $!\n?";
}
closedir $dh;
return $count;
}
sub _get_uid_gid
{
my $self = shift;
return if ( exists $self->{Alzabo}{uid} &&
exists $self->{Alzabo}{gid} );
$self->{Alzabo}{user} =
$self->prompt( <<'EOF',
What user would you like to own the directories and files used for the
Mason components as well as the components themselves?
EOF
$self->_possible_web_user );
$self->{Alzabo}{group} =
$self->prompt( <<'EOF',
What group would you like to own the directories and files used for
the Mason components as well as the components themselves?
EOF
$self->_possible_web_group );
$self->{Alzabo}{uid} = (getpwnam( $self->{Alzabo}{user} ))[2] || $<;
$self->{Alzabo}{gid} = (getgrnam( $self->{Alzabo}{group} ))[2] || $(;
}
sub _possible_web_user
{
foreach ( qw( www-data web apache daemon nobody root ) )
{
return $_ if getpwnam($_);
}
return (getpwuid( $< ))[0];
}
sub _possible_web_group
{
foreach ( qw( www-data web apache nobody nogroup daemon root ) )
{
return $_ if getpwnam($_);
}
return (getgrgid( $( ))[0];
}
1;
( run in 2.122 seconds using v1.01-cache-2.11-cpan-97f6503c9c8 )