Cisco-Conf

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN


test :: all
	\$(NOOP)

install ::
	if [ `perl -e 'print \$\$>'` -ne 0 ]; then                           \\
	    echo "Sorry, but you must be root to install this module.";      \\
	    exit 1;                                                          \\
	fi
	$perl -MFile::Path -e 'mkpath(["$etcdir", "$tftpdir"], 1, 0755)'
	chown root \$(INSTALLSCRIPT)/cisconf
	chmod 4755 \$(INSTALLSCRIPT)/cisconf
	chown root $etcdir
	chmod 700 $etcdir
	if [ -f "$etcdir/configuration" ]; then                              \\
	    echo "Not overwriting existing configfile $etcdir/configuration";\\
	else                                                                 \\
	    cp configuration "$etcdir/configuration";                        \\
	fi

EOF
}

lib/Cisco/Conf.pm  view on Meta::CPAN

	$fh = IO::File->new($file, "r");
	if (!$fh  ||  !defined($configuration = $fh->getline())  ||
	    !$fh->close()) {
	    die "Error while reading $file: $!";
	}
    }

    my $tmpFile = $tmpDir . "/cisconf.$$";
    $fh = IO::File->new($tmpFile, "w");
    if (!$fh  ||  !chmod(0600, $tmpFile)  ||
	!chown($<, $(, $tmpFile)  ||  !$fh->print($configuration)  ||
	!$fh->flush()  ||  !$fh->close()) {
	unlink $tmpFile;
	die "Error while creating temporary file $tmpFile: $!";
    }

    my $pid = fork();
    if (!defined($pid)) {
	unlink $tmpFile;
	die "Cannot fork: $!";
    } elsif (!$pid) {



( run in 1.039 second using v1.01-cache-2.11-cpan-5511b514fd6 )