view release on metacpan or search on metacpan
bin/mktelrc view on Meta::CPAN
LOCATION=$HOME/.telrc2
if [[ -x $XDG_CONFIG_HOME ]]; then
LOCATION=$XDG_CONFIG_HOME/telrc
elif [[ -x $HOME/.config ]]; then
LOCATION=$HOME/.config/telrc
fi
mv -i $TMPFILE $LOCATION
chmod 400 $LOCATION
local/lib/perl5/File/Remove.pm view on Meta::CPAN
next;
}
if ( -f $path ) {
print "file: $path\n" if DEBUG;
unless ( -w $path ) {
# Make the file writable (implementation from File::Path)
(undef, undef, my $rp) = lstat $path or next;
$rp &= 07777; # Don't forget setuid, setgid, sticky bits
$rp |= 0600; # Turn on user read/write
chmod $rp, $path;
}
if ( $unlink ? $unlink->($path) : unlink($path) ) {
# Failed to delete the file
next if -e $path;
push @removes, $path;
}
} elsif ( -d $path ) {
print "dir: $path\n" if DEBUG;
my $dir = File::Spec->canonpath($path);
local/lib/perl5/File/Remove.pm view on Meta::CPAN
if ( $$recursive ) {
if ( File::Path::rmtree( [ $dir ], DEBUG, 0 ) ) {
# Failed to delete the directory
next if -e $path;
push @removes, $path;
}
} else {
my ($save_mode) = (stat $dir)[2];
chmod $save_mode & 0777, $dir; # just in case we cannot remove it.
if ( $rmdir ? $rmdir->($dir) : rmdir($dir) ) {
# Failed to delete the directory
next if -e $path;
push @removes, $path;
}
}
} else {
print "???: $path\n" if DEBUG;
}
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
if ($status->{ok}) {
return $status->{have} if $status->{have} and "$status->{have}" ne '<none>';
return '0 but true';
}
$@ = $status->{message};
return 0;
}
sub make_executable {
# Perl's chmod() is mapped to useful things on various non-Unix
# platforms, so we use it in the base class even though it looks
# Unixish.
my $self = shift;
foreach (@_) {
my $current_mode = (stat $_)[2];
chmod $current_mode | oct(111), $_;
}
}
sub is_executable {
# We assume this does the right thing on generic platforms, though
# we do some other more specific stuff on Unixish platforms.
my ($self, $file) = @_;
return -x $file;
}
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
my ($self, $manifest, $lines) = @_;
$lines = [$lines] unless ref $lines;
my $existing_files = $self->_read_manifest($manifest);
return unless defined( $existing_files );
@$lines = grep {!exists $existing_files->{$_}} @$lines
or return;
my $mode = (stat $manifest)[2];
chmod($mode | oct(222), $manifest) or die "Can't make $manifest writable: $!";
open(my $fh, '<', $manifest) or die "Can't read $manifest: $!";
my $last_line = (<$fh>)[-1] || "\n";
my $has_newline = $last_line =~ /\n$/;
close $fh;
open($fh, '>>', $manifest) or die "Can't write to $manifest: $!";
print $fh "\n" unless $has_newline;
print $fh map "$_\n", @$lines;
close $fh;
chmod($mode, $manifest);
$self->log_verbose(map "Added to $manifest: $_\n", @$lines);
}
sub _sign_dir {
my ($self, $dir) = @_;
unless (eval { require Module::Signature; 1 }) {
$self->log_warn("Couldn't load Module::Signature for 'distsign' action:\n $@\n");
return;
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
# hack so that the resulting archive is compatible with older clients.
# If no file path is 100 chars or longer, we disable the prefix field
# for maximum compatibility. If there are any long file paths then we
# need the prefix field after all.
$Archive::Tar::DO_NOT_USE_PREFIX =
(grep { length($_) >= 100 } @$files) ? 0 : 1;
my $tar = Archive::Tar->new;
$tar->add_files(@$files);
for my $f ($tar->get_files) {
$f->mode($f->mode & ~022); # chmod go-w
}
$tar->write("$file.tar.gz", 1);
}
}
sub install_path {
my $self = shift;
my( $type, $value ) = ( @_, '<empty>' );
Carp::croak( 'Type argument missing' )
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
local $self->{properties}{quiet} = 1;
$self->delete_filetree($to_path); # delete destination if exists
}
# Create parent directories
File::Path::mkpath(File::Basename::dirname($to_path), 0, oct(777));
$self->log_verbose("Copying $file -> $to_path\n");
if ($^O eq 'os2') {# copy will not overwrite; 0x1 = overwrite
chmod 0666, $to_path;
File::Copy::syscopy($file, $to_path, 0x1) or die "Can't copy('$file', '$to_path'): $!";
} else {
File::Copy::copy($file, $to_path) or die "Can't copy('$file', '$to_path'): $!";
}
# mode is read-only + (executable if source is executable)
my $mode = oct(444) | ( $self->is_executable($file) ? oct(111) : 0 );
chmod( $mode, $to_path );
return $to_path;
}
sub up_to_date {
my ($self, $source, $derived) = @_;
$source = [$source] unless ref $source;
$derived = [$derived] unless ref $derived;
# empty $derived means $source should always run
local/lib/perl5/Module/Build/ConfigData.pm view on Meta::CPAN
sub config_names { keys %$config }
sub write {
my $me = __FILE__;
# Can't use Module::Build::Dumper here because M::B is only a
# build-time prereq of this module
require Data::Dumper;
my $mode_orig = (stat $me)[2] & 07777;
chmod($mode_orig | 0222, $me); # Make it writeable
open(my $fh, '+<', $me) or die "Can't rewrite $me: $!";
seek($fh, 0, 0);
while (<$fh>) {
last if /^__DATA__$/;
}
die "Couldn't find __DATA__ token in $me" if eof($fh);
seek($fh, tell($fh), 0);
my $data = [$config, $features, $auto_features];
print($fh 'do{ my '
. Data::Dumper->new([$data],['x'])->Purity(1)->Dump()
. '$x; }' );
truncate($fh, tell($fh));
close $fh;
chmod($mode_orig, $me)
or warn "Couldn't restore permissions on $me: $!";
}
sub feature {
my ($package, $key) = @_;
return $features->{$key} if exists $features->{$key};
my $info = $auto_features->{$key} or return 0;
# Under perl 5.005, each(%$foo) isn't working correctly when $foo
local/lib/perl5/Module/Build/Notes.pm view on Meta::CPAN
sub config_names { keys %$config }
sub write {
my $me = __FILE__;
# Can't use Module::Build::Dumper here because M::B is only a
# build-time prereq of this module
require Data::Dumper;
my $mode_orig = (stat $me)[2] & 07777;
chmod($mode_orig | 0222, $me); # Make it writeable
open(my $fh, '+<', $me) or die "Can't rewrite $me: $!";
seek($fh, 0, 0);
while (<$fh>) {
last if /^__DATA__$/;
}
die "Couldn't find __DATA__ token in $me" if eof($fh);
seek($fh, tell($fh), 0);
my $data = [$config, $features, $auto_features];
print($fh 'do{ my '
. Data::Dumper->new([$data],['x'])->Purity(1)->Dump()
. '$x; }' );
truncate($fh, tell($fh));
close $fh;
chmod($mode_orig, $me)
or warn "Couldn't restore permissions on $me: $!";
}
sub feature {
my ($package, $key) = @_;
return $features->{$key} if exists $features->{$key};
my $info = $auto_features->{$key} or return 0;
# Under perl 5.005, each(%$foo) isn't working correctly when $foo
local/lib/perl5/Module/Build/Platform/MacOS.pm view on Meta::CPAN
my $args = MacPerl::Ask('Any extra arguments? (ie. verbose=1)', '');
return unless defined $args;
push @ARGV, $self->split_like_shell($args);
}
$self->SUPER::dispatch(@_);
}
sub ACTION_realclean {
my $self = shift;
chmod 0666, $self->{properties}{build_script};
$self->SUPER::ACTION_realclean;
}
# ExtUtils::Install has a hard-coded '.' directory in versions less
# than 1.30. We use a sneaky trick to turn that into ':'.
#
# Note that we do it here in a cross-platform way, so this code could
# actually go in Module::Build::Base. But we put it here to be less
# intrusive for other platforms.