Padre

 view release on metacpan or  search on metacpan

lib/Padre/DB/History.pm  view on Meta::CPAN

package Padre::DB::History;

# NOTE: This class is loaded automatically by Padre::DB, overlaying the
# code already auto-generated by Padre::DB. Do not load manually, as this
# module will not function standalone.

# NOTE: Portable Perl support is NOT required for this class, as the use
# of it is shared between many different modules. If any consumer of this
# module needs Portable Support, they will need to implement it themselves.

use 5.008;
use strict;
use warnings;
use Params::Util ();

our $VERSION = '1.02';

sub recent {
	my $class  = shift;
	my $type   = shift;
	my $limit  = Params::Util::_POSINT(shift) || 10;
	my $recent = Padre::DB->selectcol_arrayref(
		'select distinct name from history where type = ? order by id desc limit ?',
		{}, $type, $limit
	) or die 'Failed to find recent values from history';
	return wantarray ? @$recent : $recent;
}

sub previous {
	my $class = shift;
	my @list = $class->recent( $_[0], 1 );
	return $list[0];
}

1;

__END__

=pod

=head1 NAME

Padre::DB::History - Padre::DB class for the history table

=head1 SYNOPSIS

TO BE COMPLETED

=head1 DESCRIPTION

TO BE COMPLETED

=head1 METHODS

=head2 base

  # Returns 'Padre::DB'
  my $namespace = Padre::DB::History->base;

Normally you will only need to work directly with a table class,
and only with one ORLite package.

However, if for some reason you need to work with multiple ORLite packages



( run in 0.606 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )