Padre

 view release on metacpan or  search on metacpan

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

package Padre::DB::Bookmark;

# 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.

use 5.008;
use strict;
use warnings;
use Padre::Constant ();

our $VERSION = '1.02';





######################################################################
# General Methods

sub select_names {
	Padre::DB->selectcol_arrayref('select name from bookmark order by name');
}

# Finds and returns a single element by name.
# NOTE: This is probably broken, since there can be many plugins with one name
sub fetch_name {
	return ( $_[0]->select( 'where name = ?', $_[1] ) )[0];
}




######################################################################
# Portability Support

if (Padre::Constant::PORTABLE) {
	require Padre::Portable;

	*new = sub {
		my $class = shift;
		my %param = @_;
		$param{file} = Padre::Portable::freeze( $param{file} );
		$class->SUPER::new(%param);
		}
		if __PACKAGE__->can('new');

	*file = sub {
		Padre::Portable::thaw( shift->SUPER::file(@_) );
		}
		if __PACKAGE__->can('file');

	*set = sub {
		my $self  = shift;
		my $name  = shift;
		my $value = shift;
		if ( $name and $name eq 'file' ) {
			$value = Padre::Portable::freeze($value);
		}
		$self->SUPER::set( $name => $value );
		}
		if __PACKAGE__->can('set');



( run in 2.678 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )