Result:
found more than 894 distributions - search limited to the first 2001 files matching your query ( run in 2.083 )


App-BorgRestore

 view release on metacpan or  search on metacpan

lib/App/BorgRestore.pm  view on Meta::CPAN


=encoding utf-8

=head1 NAME

App::BorgRestore - Restore paths from borg backups

=head1 SYNOPSIS

    use App::BorgRestore;

    my $app = App::BorgRestore->new();

    # Update the cache (call after creating/removing backups)
    $app->update_cache();

    # Restore a path from a backup that is at least 5 days old. Optionally
    # restore it to a different directory than the original.
    # Look at the implementation of this method if you want to know how the
    # other parts of this module work together.
    $app->restore_simple($path, "5days", $optional_destination_directory);

=head1 DESCRIPTION

App::BorgRestore is a restoration helper for borg.

It maintains a cache of borg backup contents (path and latest modification
time) and allows to quickly look up backups that contain a path. It further
supports restoring a path from an archive. The archive to be used can also be
automatically determined based on the age of the path.

The cache has to be updated regularly, ideally after creating or removing
backups.

L<borg-restore.pl> is a wrapper around this class that allows for simple CLI
usage.

This package uses L<Log::Any> for logging.

lib/App/BorgRestore.pm  view on Meta::CPAN

method new($class: $deps = {}) {
	$deps->{settings} //= App::BorgRestore::Settings->new();

	my $config = $deps->{settings}->get_config();

	$deps->{borg} //= App::BorgRestore::Borg->new(@{$config->{borg}}{qw(repo backup_prefix)});
	$deps->{db} //= App::BorgRestore::DB->new($config->{cache}->{database_path}, $config->{cache}->{sqlite_memory_cache_size});

	return $class->new_no_defaults($deps, $config);
}

lib/App/BorgRestore.pm  view on Meta::CPAN

	}

	return $abs_path;
}

=head3 map_path_to_backup_path

 my $path_in_backup = $app->map_path_to_backup_path($abs_path);

Maps an absolute path from the system to the path that needs to be looked up in
/ extracted from the backup using C<@backup_prefixes> from
L<App::BorgRestore::Settings>.

Returns the mapped path (string).

=cut

method map_path_to_backup_path($abs_path) {
	my $backup_path = $abs_path;

	for my $backup_prefix (@{$self->{config}->{borg}->{path_prefixes}}) {
		if ($backup_path =~ m/$backup_prefix->{regex}/) {
			$backup_path =~ s/$backup_prefix->{regex}/$backup_prefix->{replacement}/;
			last;
		}
	}

	return $backup_path;
}

=head3 find_archives

 my $archives = $app->find_archives($path);

lib/App/BorgRestore.pm  view on Meta::CPAN

	return;
}

=head3 restore

 $app->restore($backup_path, $archive, $destination);

Restore a backup path (returned by C<map_path_to_backup_path>) from an archive
(returned by C<find_archives> or C<get_all_archives>) to a destination
directory.

If the destination path (C<$destination/$last_elem_of_backup_path>) exists, it
is removed before beginning extraction from the backup.

Warning: This method temporarily modifies the current working directory of the
process during method execution since this is required by C<`borg extract`>.

=cut

lib/App/BorgRestore.pm  view on Meta::CPAN


=cut

method restore_simple($path, $timespec, $destination) {
	my $abs_path = $self->resolve_relative_path($path);
	my $backup_path = $self->map_path_to_backup_path($abs_path);

	$destination //= dirname($abs_path);

	my $archives = $self->find_archives($backup_path);
	my $selected_archive = $self->select_archive_timespec($archives, $timespec);
	$self->restore($backup_path, $selected_archive, $destination);
}

=head3 search_path

 my $paths = $app->search_path($pattern)

 view all matches for this distribution


App-Build

 view release on metacpan or  search on metacpan

MANIFEST.SKIP  view on Meta::CPAN

\b_build/
\bblib/
\bMYMETA.yml$
^App-Build-.*\.tar\.gz$

# Avoid temp and backup files.
~$
\.old$
\#$
\b\.#
\.bak$

 view all matches for this distribution


App-CELL

 view release on metacpan or  search on metacpan

MANIFEST.SKIP  view on Meta::CPAN

\bBuild.bat$
\bBuild.COM$
\bBUILD.COM$
\bbuild.com$

# Avoid temp and backup files.
~$
\.old$
\#$
\b\.#
\.bak$

 view all matches for this distribution


App-CPANtoRPM

 view release on metacpan or  search on metacpan

lib/App/CPANtoRPM.pm  view on Meta::CPAN

}

###############################################################################
# This either renames or copies a file.
#
sub _backup_file {
   my($self,$file1,$file2,$copy) = @_;

   if ($copy) {

      if (-d $file2) {

lib/App/CPANtoRPM.pm  view on Meta::CPAN

      $dir = "$yum/RPMS/$package{arch_val}";
   } else {
      $dir = "$yum/RPMS";
   }

   $self->_backup_file($package{'rpmfile'},$dir,"copy");

   # Copy in the source RPM

   $self->_backup_file($package{'srpmfile'},"$yum/SRPMS","copy");
}

###############################################################################
###############################################################################

lib/App/CPANtoRPM.pm  view on Meta::CPAN

      $package{'remove'} = 1;


   } elsif ($package{'remove'}  ||  $package{'restore'}) {

      # If we've already created a backup of the macros file
      # which will be restore, or if we've already determined
      # that the macros file will be removed, we don't have
      # redetermine anything.

   } else {

      # This is the first time we're adding a macro to
      # the macros file, so we want to save it so that it
      # can be restored at the end.

      $self->_backup_file($file,"$file.cpantorpm",1);
      $package{'restore'} = 1;

   }

   my $out = new IO::File;

lib/App/CPANtoRPM.pm  view on Meta::CPAN


   my $macros = "$ENV{HOME}/.rpmmacros";

   if ($$self{'clean_macros'}) {
      if (-f $macros) {
         $self->_backup_file($macros,"$macros.cpantorpm",0);
         $package{'restore'} = 1;
      }
   }

   my $macroval;

lib/App/CPANtoRPM.pm  view on Meta::CPAN


   # Copy in the file

   $self->_log_message('INFO',"Copying file");

   $self->_backup_file($$self{'file_path'},$TMPDIR,1);

   # Extract it.

   $self->_extract_archive();
}

 view all matches for this distribution


App-CSVUtils-csv_mix_formulas

 view release on metacpan or  search on metacpan

lib/App/CSVUtils/csv_mix_formulas.pm  view on Meta::CPAN

same file (C<-o INPUT.csv -O>) you will clobber the input file; thus the utility
prevents you from doing it. However, with this C<--inplace> option, you can
output to the same file. Like perl's C<-i> option, this will first output to a
temporary file in the same directory as the input file then rename to the final
file at the end. You cannot specify output file (C<-o>) when using this option,
but you can specify backup extension with C<-b> option.

Some caveats:

=over

lib/App/CSVUtils/csv_mix_formulas.pm  view on Meta::CPAN


=item * things can also fail if permissions are restrictive;

=back

=item * B<inplace_backup_ext> => I<str> (default: "")

Extension to add for backup of input file.

In inplace mode (C<--inplace>), if this option is set to a non-empty string, will
rename the input file using this extension as a backup. The old existing backup
will be overwritten, if any.

=item * B<input_escape_char> => I<str>

Specify character to escape value in field in input CSV, will be passed to Text::CSV_XS.

 view all matches for this distribution


App-CSVUtils

 view release on metacpan or  search on metacpan

lib/App/CSVUtils.pm  view on Meta::CPAN

same file (`-o INPUT.csv -O`) you will clobber the input file; thus the utility
prevents you from doing it. However, with this `--inplace` option, you can
output to the same file. Like perl's `-i` option, this will first output to a
temporary file in the same directory as the input file then rename to the final
file at the end. You cannot specify output file (`-o`) when using this option,
but you can specify backup extension with `-b` option.

Some caveats:

- if input file is a symbolic link, it will be replaced with a regular file;
- renaming (implemented using `rename()`) can fail if input filename is too long;

lib/App/CSVUtils.pm  view on Meta::CPAN

- things can also fail if permissions are restrictive;

_
        tags => ['category:output'],
    },
    inplace_backup_ext => {
        summary => 'Extension to add for backup of input file',
        schema => 'str*',
        default => '',
        description => <<'_',

In inplace mode (`--inplace`), if this option is set to a non-empty string, will
rename the input file using this extension as a backup. The old existing backup
will be overwritten, if any.

_
        cmdline_aliases => {b=>{}},
        tags => ['category:output'],

lib/App/CSVUtils.pm  view on Meta::CPAN

                    for my $output_filename (@{ $r->{output_filenames} }) {
                        $i++;
                        last if $i > $output_filenum;
                        (my $input_filename = $output_filename) =~ s/\.\w{5}\z//
                            or die [500, "BUG: Can't get original input file '$output_filename'"];
                        if (length(my $ext = $r->{util_args}{inplace_backup_ext})) {
                            my $backup_filename = $input_filename . $ext;
                            log_info "[csvutil] Backing up input file '$output_filename' -> '$backup_filename' ...";
                            rename $input_filename, $backup_filename or die [500, "Can't rename '$input_filename' -> '$backup_filename': $!"];
                        }
                        log_info "[csvutil] Renaming from temporary output file '$output_filename' -> '$input_filename' ...";
                        rename $output_filename, $input_filename or die [500, "Can't rename back '$output_filename' -> '$input_filename': $!"];
                    }
                }

lib/App/CSVUtils.pm  view on Meta::CPAN

                $meta->{args}{$_} = {%{$argspecs_csv_output{$_}}} for keys %argspecs_csv_output;

                if ($reads_csv) {
                    $meta->{args}{$_} = {%{$argspecsopt_inplace{$_}}} for keys %argspecsopt_inplace;
                    $meta->{args_rels}{'dep_all&'} //= [];
                    push @{ $meta->{args_rels}{'dep_all&'} }, ['inplace_backup_ext', ['inplace']];
                    $meta->{args_rels}{'choose_one&'} //= [];
                    push @{ $meta->{args_rels}{'choose_one&'} }, ['inplace', 'output_filename'];
                    push @{ $meta->{args_rels}{'choose_one&'} }, ['inplace', 'output_filenames'];
                }

 view all matches for this distribution


App-Chart

 view release on metacpan or  search on metacpan

MANIFEST.SKIP  view on Meta::CPAN

# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with Chart.  If not, see <http://www.gnu.org/licenses/>.

# emacs backups
~$
# emacs locks
(^|/)\.#
# emacs autosave
(^|/)#

MANIFEST.SKIP  view on Meta::CPAN

# built - emacs byte compile
\.elc$

\.tmp$
\.bak$
^backup
^dist-deb
^up$
^MakeMaker-\d
^junk
^formats

 view all matches for this distribution


App-Cheats

 view release on metacpan or  search on metacpan

MANIFEST.SKIP  view on Meta::CPAN

\bbuild.com$

# and Module::Build::Tiny generated files
\b_build_params$

# Avoid temp and backup files.
~$
\.old$
\#$
\b\.#
\.bak$

 view all matches for this distribution


App-ClusterSSH

 view release on metacpan or  search on metacpan

t/perltidyrc  view on Meta::CPAN

# perltidy to Perl Best Practices standard
-pbp -nst -nse 
## For use in ~/.perltidyrc
# --backup-and-modify-in-place

 view all matches for this distribution


App-Cmd

 view release on metacpan or  search on metacpan

lib/App/Cmd/Tutorial.pod  view on Meta::CPAN

#pod With a properly configured command class, the above invocation results in
#pod nicely formatted data:
#pod
#pod   $opt = {
#pod     zero      => 1,
#pod     no_backup => 1, #default value
#pod     new_seed  => 'xyzzy',
#pod   };
#pod
#pod   $args = [ qw(foo.db bar.db) ];
#pod

lib/App/Cmd/Tutorial.pod  view on Meta::CPAN

With a properly configured command class, the above invocation results in
nicely formatted data:

  $opt = {
    zero      => 1,
    no_backup => 1, #default value
    new_seed  => 'xyzzy',
  };

  $args = [ qw(foo.db bar.db) ];

 view all matches for this distribution


App-Cme

 view release on metacpan or  search on metacpan

lib/App/Cme/Command/edit.pm  view on Meta::CPAN


sub opt_spec {
    my ( $class, $app ) = @_;
    return (
        [ "ui|if=s"     => "user interface type. Either tk, curses, shell" ],
        [ "backup:s"  => "Create a backup of configuration files before saving." ],
        [ "open-item=s" => "open a specific item of the configuration" ],
        $class->cme_global_options,
    );
}

 view all matches for this distribution


App-Codit

 view release on metacpan or  search on metacpan

lib/App/Codit/Plugins/Backups.pm  view on Meta::CPAN


use base qw( Tk::AppWindow::BaseClasses::PluginJobs );

=head1 DESCRIPTION

Protect yourself against crashes. This plugin keeps backups of your unsaved files.

=head1 DETAILS

The Backups plugin protects you against crashes of all kinds.
It silently does it's job in the background and only reports when it
finds an existing backup of a file you open.

It keeps backups of all open and unsaved files. Whenever a file is saved or closed
the backup is removed.

It keeps the backups in the configuration folder, it does not pollute your working folders.

=cut

sub new {
	my $class = shift;

lib/App/Codit/Plugins/Backups.pm  view on Meta::CPAN

	$self->cmdHookBefore('deferred_open', 'openDocBefore', $self);
	$self->cmdHookAfter('doc_close', 'closeDocAfter', $self);
	$self->cmdHookBefore('doc_rename', 'docRenameBefore', $self);
	$self->cmdHookAfter('doc_save', 'saveDocAfter', $self);

	$self->backupFolder;
	return $self;
}

sub backupCheck {
	my ($self, $name) = @_;
	croak 'Name not defined' unless defined $name;
	my $mdi = $self->extGet('CoditMDI');

	unless ($mdi->docExists($name)) {

lib/App/Codit/Plugins/Backups.pm  view on Meta::CPAN

		my $widg = $mdi->docGet($name)->CWidg;
		my $em = $widg->editModified;
		my $modified = $mod->{$name};

		if (defined $modified) {
			$self->backupSave($name) if $em ne $modified
		} else {
			$self->backupSave($name);
		}

		$mod->{$name} = $em;
	} else {
		$self->backupRemove($name);
	}
}

sub backupExists {
	my ($self, $name) = @_;
	croak 'Name not defined' unless defined $name;
	my @list = $self->backupList;
	for (@list) {
		return 1 if $_ eq $name
	}
	return 0;
}

sub backupFile {
	my ($self, $name) = @_;
	croak 'Name not defined' unless defined $name;
	$name =~ s/^\///;
	$name =~ s/\//_-_/g;
	return $self->backupFolder . "/$name";
}

sub backupFolder {
	my $self = shift;
	my $config = $self->extGet('ConfigFolder')->ConfigFolder . '/Backups';
	make_path($config) unless -e $config;
	return $config
}

sub backupList {
	my $self = shift;
	my $folder = $self->backupFolder;
	my @names = ();
	if (opendir my $dh, $folder) {
		while (my $file = readdir $dh) {
			push @names, $self->backupName($file);
		}
		closedir $dh
	}
	return @names
}

sub backupName {
	my ($self, $file) = @_;
	croak 'Name not defined' unless defined $file;
	$file =~ s/_-_/\//g;
	$file = "/$file";
	return $file
}

sub backupRemove {
	my ($self, $name) = @_;
	croak 'Name not defined' unless defined $name;
	my $file = $self->backupFile($name);
	unlink $file if -e $file;
}

sub backupRestore {
	my ($self, $name) = @_;
	croak 'Name not defined' unless defined $name;
	my $file = $self->backupFile($name);
	my $mdi = $self->extGet('CoditMDI');
	my $widg = $mdi->docGet($name)->CWidg;
	if ($widg->load($file)) {
		$widg->editModified(1);
		return 1
	}
	return 0
}

sub backupSave {
	my ($self, $name) = @_;
	croak 'Name not defined' unless defined $name;
	my $file = $self->backupFile($name);
	my $mdi = $self->extGet('CoditMDI');
	my $widg = $mdi->docGet($name)->CWidg;
	$widg->saveExport($file);
	return 0;
}

sub closeDocAfter {
	my ($self, $name) = @_;
	if ((defined $name) and $name) {
		$self->jobEnd($name) if $self->jobExists($name);
		$self->backupRemove($name);
	}
}

sub docRenameBefore {
	my ($self, $name, $new) = @_;
	croak 'Name not defined' unless defined $name;
	croak 'New name not defined' unless defined $new;
	$self->jobEnd($name);
	$self->jobStart($new, 'backupCheck', $self, $new);
}

sub openDocBefore {
	my ($self, $name) = @_;
	if ((defined $name) and $name) {
		if ($self->backupExists($name)) {
			my $title = 'Backup exists';
			my $text = 'A backup for ' . basename($name) . " exists.\nDo you want to recover?";
			my $icon = 'dialog-question';
			my $response = $self->popDialog($title, $text, $icon, qw/Yes No/);
			$self->after(300, ['backupRestore', $self, $name]) if $response eq 'Yes';
		}
		$self->jobStart($name, 'backupCheck', $self, $name)
	}
}

sub saveDocAfter {
	my ($self, $name) = @_;
	if ((defined $name) and $name) {
		$self->backupRemove($name);
		delete $self->{MODIFIED}->{$name};
	}
}

sub Quit {

 view all matches for this distribution


App-CopyrightImage

 view release on metacpan or  search on metacpan

lib/App/CopyrightImage.pm  view on Meta::CPAN

=head4 dst

A string containing the name of a directory to be used to store the manipulated
images. By default, we use the path sent in with the C<image> option.

Eg: C<"/home/user/backup">

=head4 remove

Bool. If set, we'll remove all copyright information on the image(s).

 view all matches for this distribution


App-Critique

 view release on metacpan or  search on metacpan

lib/App/Critique/Command/collect.pm  view on Meta::CPAN

    return $predicate;
}

# NOTE:
# This was mostly taken from the guts of
# Perl::Critic::Util::{_is_perl,_is_backup}
# - SL
sub is_perl_file {
    my ($file) = @_;

    # skip all the backups
    return 0 if $file =~ m{ [.] swp \z}xms;
    return 0 if $file =~ m{ [.] bak \z}xms;
    return 0 if $file =~ m{  ~ \z}xms;
    return 0 if $file =~ m{ \A [#] .+ [#] \z}xms;

 view all matches for this distribution


App-CveClient

 view release on metacpan or  search on metacpan

MANIFEST.SKIP  view on Meta::CPAN

\bbuild.com$

# and Module::Build::Tiny generated files
\b_build_params$

# Avoid temp and backup files.
~$
\.old$
\#$
\b\.#
\.bak$

 view all matches for this distribution


App-DBBrowser

 view release on metacpan or  search on metacpan

lib/App/DBBrowser/Auxil.pm  view on Meta::CPAN



sub reset_sql {
    my ( $sf, $sql ) = @_;
    # preserve base data: table name, column names and data types:
    my $backup = {
        table => $sql->{table} // '',
        columns => $sql->{columns} // [],
        data_types => $sql->{data_types} // {},
    };
    # reset/initialize:

lib/App/DBBrowser/Auxil.pm  view on Meta::CPAN

                     insert_col_names insert_args );
    my @hash   = qw( alias );
    @{$sql}{@string} = ( '' ) x  @string;
    @{$sql}{@array}  = map{ [] } @array;
    @{$sql}{@hash}   = map{ {} } @hash;
    for my $y ( keys %$backup ) {
        $sql->{$y} = $backup->{$y};
    }
}


sub __stmt_fold {

 view all matches for this distribution


App-DBCritic

 view release on metacpan or  search on metacpan

MANIFEST.SKIP  view on Meta::CPAN

\bbuild.com$

# and Module::Build::Tiny generated files
\b_build_params$

# Avoid temp and backup files.
~$
\.old$
\#$
\b\.#
\.bak$

 view all matches for this distribution


App-DataDirUtils

 view release on metacpan or  search on metacpan

lib/App/DataDirUtils.pm  view on Meta::CPAN

            test => 0,
            'x.doc.show_result' => 0,
        },
        {
            summary => 'Backup all my datadirs to Google Drive',
            src => q{[[prog]] /media/budi /media/ujang -l | td map '"rclone copy -v -v $_->{abs_path} mygdrive:/backup/$_->{name}"' | bash},
            src_plang => 'bash',
            test => 0,
            'x.doc.show_result' => 0,
        },
    ],

lib/App/DataDirUtils.pm  view on Meta::CPAN

=back

A "datadir" is a directory which has a (usually empty) file called
F<.tag-datadir>. A datadir usually does not contain other datadirs.

You can backup, rsync, or do whatever you like with a datadir, just like a
normal filesystem directory. The utilities provided in this distribution help
you handle datadirs.

=head1 FUNCTIONS

 view all matches for this distribution


App-DistSync

 view release on metacpan or  search on metacpan

lib/App/DistSync.pm  view on Meta::CPAN

            "!!perl/regexp (?i-xsm:\\B\\.git\\b)",
            "!!perl/regexp (?i-xsm:\\B\\.gitignore\\b)",
            "!!perl/regexp (?i-xsm:\\b_darcs\\b)",
            "!!perl/regexp (?i-xsm:\\B\\.cvsignore\$)",
            "",
            "# Avoid temp and backup files.",
            "!!perl/regexp (?i-xsm:~\$)",
            "!!perl/regexp (?i-xsm:\\.(old|bak|tmp|rej)\$)",
            "!!perl/regexp (?i-xsm:\\#\$)",
            "!!perl/regexp (?i-xsm:\\b\\.#)",
            "!!perl/regexp (?i-xsm:\\.#)",

 view all matches for this distribution


App-DocKnot

 view release on metacpan or  search on metacpan

MANIFEST.SKIP  view on Meta::CPAN

\bBuild.bat$
\bBuild.COM$
\bBUILD.COM$
\bbuild.com$

# Avoid temp and backup files.
~$
\.old$
\#$
\b\.#
\.bak$

 view all matches for this distribution


App-Dochazka-Common

 view release on metacpan or  search on metacpan

MANIFEST.SKIP  view on Meta::CPAN

\bBuild.bat$
\bBuild.COM$
\bBUILD.COM$
\bbuild.com$

# Avoid temp and backup files.
~$
\.old$
\#$
\b\.#
\.bak$

 view all matches for this distribution


App-Dochazka-REST

 view release on metacpan or  search on metacpan

MANIFEST.SKIP  view on Meta::CPAN

\bBuild.bat$
\bBuild.COM$
\bBUILD.COM$
\bbuild.com$

# Avoid temp and backup files.
~$
\.old$
\#$
\b\.#
\.bak$

 view all matches for this distribution


App-EventStreamr

 view release on metacpan or  search on metacpan

bin/station-mgr.pl  view on Meta::CPAN

  "roles" :
    [
    ],
  "nickname" : "$hostname",
  "room" : "$room",
  "record_path" : "/localbackup/\$room/\$date",
  "mixer" :
    {
      "port":"1234",
      "host":"$mixer_ipaddr",
      "loop":"/home/av/eventstreamr/baseimage/video/standby.dv"

 view all matches for this distribution


App-FTNDB

 view release on metacpan or  search on metacpan

MANIFEST.SKIP  view on Meta::CPAN

\bBuild.bat$
\bBuild.COM$
\bBUILD.COM$
\bbuild.com$

# Avoid temp and backup files.
~$
\.old$
\#$
\b\.#
\.bak$

 view all matches for this distribution


App-File-Grepper

 view release on metacpan or  search on metacpan

lib/App/File/Grepper.pm  view on Meta::CPAN

A perl pattern to select which files must be rejected. Note that this
pattern is applied to the basename of each file, not the full path.
Also, this pattern is applied before the filter pattern.

Version control directories C<RCS>, C<CVS>, C<.svn>, C<.git> and
C<.hg> are always excluded, as are common editor backups.

=back

=cut

 view all matches for this distribution


App-FilenameUtils

 view release on metacpan or  search on metacpan

lib/App/FilenameUtils.pm  view on Meta::CPAN

    wrap_code => _gen_wrapper('an audio file'),
);

require Filename::Backup;
gen_modified_sub(
    base_name => 'Filename::Backup::check_backup_filename',
    add_args => {
        %argsopt,
    },
    modify_meta => sub {
        $_[0]{result_naked} = 0;
        # XXX we should adjust the examples instead
        delete $_[0]{examples};
    },
    wrap_code => _gen_wrapper('a backup file'),
);

require Filename::Compressed;
gen_modified_sub(
    base_name => 'Filename::Compressed::check_compressed_filename',

lib/App/FilenameUtils.pm  view on Meta::CPAN


=item * L<check-archive-filename>

=item * L<check-audio-filename>

=item * L<check-backup-filename>

=item * L<check-compressed-filename>

=item * L<check-ebook-filename>

lib/App/FilenameUtils.pm  view on Meta::CPAN

Return false if no archive suffixes detected. Otherwise return a hash of
information.



=head2 check_backup_filename

Usage:

 check_backup_filename(%args) -> [status, msg, payload, meta]

Check whether filename indicates being a backup file.

This function is not exported.

Arguments ('*' denotes required arguments):

lib/App/FilenameUtils.pm  view on Meta::CPAN

that contains extra information.

Return value:  (bool|hash)


Return false if not detected as backup name. Otherwise return a hash, which may
contain these keys: C<original_filename>. In the future there will be extra
information returned, e.g. editor name (if filename indicates backup from
certain backup program), date (if filename contains date information), and so
on.



=head2 check_compressed_filename

 view all matches for this distribution


App-FirefoxMultiAccountContainersUtils

 view release on metacpan or  search on metacpan

lib/App/FirefoxMultiAccountContainersUtils.pm  view on Meta::CPAN

    require File::Copy;
    require File::Slurper;
    require Firefox::Util::Profile;
    require JSON::MaybeXS;

    my ($args, $do_backup) = @_;

    my $res;

    if ($do_backup) {
        $res = App::FirefoxUtils::firefox_is_running();
        return [500, "Can't check if Firefox is running: $res->[0] - $res->[1]"]
            unless $res->[0] == 200;
        if ($args->{-dry_run}) {
            log_info "[DRY-RUN] Note that Firefox is still running, ".

lib/App/FirefoxMultiAccountContainersUtils.pm  view on Meta::CPAN


    $path = "$path/containers.json";
    return [412, "Can't find '$path', is this Firefox using Multi-Account Containers?"]
        unless (-f $path);

    unless ($args->{-dry_run} || !$do_backup) {
        log_info "Backing up $path to $path~ ...";
        File::Copy::copy($path, "$path~") or
              return [500, "Can't backup $path to $path~: $!"];
    }

    my $json = JSON::MaybeXS::decode_json(File::Slurper::read_text($path));

    [200, "OK", {path=>$path, content=>$json}];

lib/App/FirefoxMultiAccountContainersUtils.pm  view on Meta::CPAN

        $code = eval $code; ## no critic: BuiltinFunctions::ProhibitStringyEval
        return [400, "Cannot compile string code: $@"] if $@;
    }

    my $res;
    $res = _get_containers_json(\%args, 'backup');
    return $res unless $res->[0] == 200;

    my $path = $res->[2]{path};
    my $json = $res->[2]{content};
    my $new_identities = [];

lib/App/FirefoxMultiAccountContainersUtils.pm  view on Meta::CPAN


    my %args = @_;
    defined(my $name = $args{name}) or return [400, "Please specify name for new container"];

    my $res;
    $res = _get_containers_json(\%args, 'backup');
    return $res unless $res->[0] == 200;

    my $path = $res->[2]{path};
    my $json = $res->[2]{content};

lib/App/FirefoxMultiAccountContainersUtils.pm  view on Meta::CPAN

    my $sort_sub  = $args{sort_sub}  // 'asciibetically';
    my $sort_args = $args{sort_args} // [];
    my $cmp = Sort::Sub::get_sorter($sort_sub, { map { split /=/, $_, 2 } @$sort_args });

    my $res;
    $res = _get_containers_json(\%args, 'backup');
    return $res unless $res->[0] == 200;

    my $path = $res->[2]{path};
    my $json = $res->[2]{content};
    $json->{identities} = [

 view all matches for this distribution


App-Followme

 view release on metacpan or  search on metacpan

share/clean.pl  view on Meta::CPAN

    push(@output, @input);
    return join('', @output)
}

#----------------------------------------------------------------------
# Create a backup copy of the original file

sub backup_file {
    my ($file, $text) = @_;
    $file .= '~';

    write_file($file, $text);
}

share/clean.pl  view on Meta::CPAN

    my ($patterns, @files) = @_;


    foreach my $file (@files) {
        my $text = slurp_file($file);
        backup_file($file, $text);

        my @tags = web_split_at_tags($text);
        my $tokens = {next => 0, data => \@tags};
        $text = replace_tokens($patterns, $tokens);

 view all matches for this distribution


App-ForExample

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

TODO:
    - Add --backup (or --no-backup) option
    - Change --package option to --class

0.024 Monday June 08 11:06:08 PDT 2009:
    - Added --class as an alias to --package
    - Added "Apache2 and FastCGI on Ubuntu" tutorial

 view all matches for this distribution


App-Framework

 view release on metacpan or  search on metacpan

examples/eg1.pl  view on Meta::CPAN

sub app
{
	my ($app) = @_ ;
	
	# Get source/dest dirs
	my ($src_dir, $backup_dir) = $app->args();
	
	# options
	my %opts = $app->options() ;

	if ($opts{array})

examples/eg1.pl  view on Meta::CPAN


[ARGS]

* src_dir=d 		Source directory

* backup_dir=d		Backup directory

[OPTIONS]

-database=s	Database name [default=test]

 view all matches for this distribution


( run in 2.083 seconds using v1.01-cache-2.11-cpan-49f99fa48dc )