App-DumpChromeHistory

 view release on metacpan or  search on metacpan

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

                $sth->execute;
                while (my $row = $sth->fetchrow_hashref) {
                    if ($args{detail}) {
                        push @rows, $row;
                    } else {
                        push @rows, $row->{url};
                    }
                }
            };
            my $err = $@;
            if ($err && $err =~ /database is locked/) {
                if ((-s $history_path) <= $args{copy_size_limit}) {
                    log_debug "Database is locked ($err), will try to copy and query the copy instead ...";
                    require File::Copy;
                    require File::Temp;
                    my ($temp_fh, $temp_path) = File::Temp::tempfile();
                    File::Copy::copy($history_path, $temp_path) or die $err;
                    $history_path = $temp_path;
                    redo SELECT;
                } else {
                    log_debug "Database is locked ($err) but is too big, will wait instead";
                }
            }
        } # SELECT
    } # for profile

    $resmeta->{'table.fields'} = [qw/url title last_visit_time visit_count/]
        if $args{detail};
    [200, "OK", \@rows, $resmeta];
}



( run in 1.902 second using v1.01-cache-2.11-cpan-49f99fa48dc )