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


Adapter-Async

 view release on metacpan or  search on metacpan

lib/Adapter/Async/OrderedList.pm  view on Meta::CPAN


=item * hidden - no longer visible.

 hidden => [1,2,4]

=item * selected - this item is now part of an active selection. could be used to block deletes.

 selected => [1,4,5,6]

=item * highlight - mouse over, cursor, etc. 

 highlight => 1

lib/Adapter/Async/OrderedList.pm  view on Meta::CPAN

=item * activate - some action has been performed.

 activate => [1]
 activate => [1,2,5,6,7,8]

Multi-activate will typically happen when items have been selected rather than just highlighted.

The adapter itself doesn't do much with this.

=back

 view all matches for this distribution


AddressBook

 view release on metacpan or  search on metacpan

lib/AddressBook/Config.pm  view on Meta::CPAN

sub new {
  my $class=shift;
  my %args = @_;
  my $self = {};
  bless ($self,$class);
  my ($parser,$config,$field,$field_name,$attr,$db_type,$db_field_name,$db,$select,$option,$value);
  $self->{config_file} = $args{config_file} || $AddressBook::Config::config_file;
  eval {
    $parser = XML::DOM::Parser->new(ErrorContext=>1,
				    ParseParamEnt=>1,
				    ProtocolEncoding=>'UTF-8');

 view all matches for this distribution


Ado

 view release on metacpan or  search on metacpan

lib/Ado/Command/generate/crud.pm  view on Meta::CPAN

    #Used in template <%= $a->{t}%>/list.html.ep
    $c->stash('table_class',$table_class);
    #content negotiation
    my $list = $c->list_for_json(
            [$$args{limit}, $$args{offset}],
            [$table_class->select_range($$args{limit}, $$args{offset})]
        );
    return $c->respond_to(
        json => $list,
        html =>{list =>$list}
    );

 view all matches for this distribution


Advanced-Config

 view release on metacpan or  search on metacpan

Config.pm  view on Meta::CPAN

   bless ( $self, $class );

   # Creating a new object ... (The main section)
   my %control;

   # Initialize what options were selected ...
   $control{filename}  = $self->_fix_path ($filename);
   $control{read_opts} = get_read_opts ( $read_opts );
   $control{get_opts}  = get_get_opts ( $get_opts );
   $control{date_opts} = get_date_opts ( $date_opts );

Config.pm  view on Meta::CPAN

   }
   my $language = $opts->{month_language};
   my $type = ( $opts->{use_gmt} ) ? "gmtime" : "localtime";

   print STDERR "${cmt} The Special Predefined Date Variables ... (in ${language})\n";
   print STDERR "${cmt} The format and language used can vary based on the date options selected.\n";
   print STDERR "${cmt} Uses ${type} to convert the current timestamp into the other values.\n";

   set_special_date_vars ( $opts, \%dt );
   foreach my $k ( sort keys %dt ) {
      print STDERR "   ${la}$k${ra} ${asgn} $dt{$k}\n";

 view all matches for this distribution


Affix

 view release on metacpan or  search on metacpan

dyncall/Makefile.embedded  view on Meta::CPAN

  CFLAGS="-isysroot ${IOS_SDKROOT}"\
  CXXFLAGS="-isysroot ${IOS_SDKROOT}"\
  LDFLAGS="-Wl,-syslibroot ${IOS_SDKROOT}"\
  ${MAKE_CMD} all  
ios:
	IOS_SDKROOT="`xcode-select -print-path`/Platforms/iPhone${IOS_PLATFORM}.platform/Developer/SDKs/iPhone${IOS_PLATFORM}${IOS_SDK}.sdk" ${MAKE_CMD} ios-sdkroot
ios-sim:
	IOS_PLATFORM="Simulator" ${MAKE_CMD} ios
ios-os:
	IOS_PLATFORM="OS"        ${MAKE_CMD} ios
# NOTE iOS 6.1 does not support armv6 (has no libs)

 view all matches for this distribution


Agent-TCLI-Package-Net

 view release on metacpan or  search on metacpan

lib/Agent/TCLI/Package/Net/HTTPD.pm  view on Meta::CPAN

  handler: establish_context
  help: simple http web server
  manual: >
    httpd provides a simple web server that can respond to and log requests.
    By default it responds with a Status code 404 to all requests. One may add
    a select few other status code responses using regular expression pattern
    matching if desired. One cannot change content, only status codes.
    Httpd is useful for network testing situations where the response codes
    are being monitored by the network.
  topic: net
  usage: httpd spawn port=8080

 view all matches for this distribution


Agent

 view release on metacpan or  search on metacpan

examples/ex.pl  view on Meta::CPAN

$args{Eval} = '2+2';
unless ($args{'Name'}) { print $usage; exit 1; }

if ($logfile) {
	open (LOG, "> $logfile") or die "couldn't open $logfile! $!";
	select LOG;
	$| = 1;
}

# then setup and execute the agent:
my $agent = new Agent( %args ) or die "couldn't create agent!";

 view all matches for this distribution


Aion-Format

 view release on metacpan or  search on metacpan

lib/Aion/Format/Html.pm  view on Meta::CPAN

	th 			=> _set(qw/table thead tbody tfoot caption/),
	dt			=> _set(qw/dl/),
	dd			=> _set(qw/dl/),
	rt			=> _set(qw/ruby/),
	rp			=> _set(qw/ruby/),
	option 		=> _set(qw/optgroup select/),
	optgroup	=> _set(qw/select/),
);

# <tr> закрывает открытые <td> и <th> и <tr>
our %TOP_NEW_TAG = (
	head		=> _set(qw/body/),

lib/Aion/Format/Html.pm  view on Meta::CPAN


# Все, кроме запрещённых:
#  applet, script, style, embed, object, param,
#  video, audio, source, track, frame, frameset, iframe, comment
#  html, head, body, title, meta, base, basefont, bgsound, link
#  form, keygen, output, textarea, select, option, optgroup, legend, label, input
#  plaintext, xmp
# А так же удаляет атрибуты начинающиеся на "on", name, for, formaction и др..
my %SAFE_TAG = map {$_=>1} qw/
a
abbr

 view all matches for this distribution


Aion-Query

 view release on metacpan or  search on metacpan

lib/Aion/Query.pm  view on Meta::CPAN

	}) or die "Connect to db failed";

	$base->do($_) for @$conn;
	return $base unless wantarray;
	my ($base_connection_id) = $dsn =~ /^DBI:(mysql|mariadb)/i
		? $base->selectrow_array("SELECT connection_id()")
		: -1;
	return $base, $base_connection_id;
}

# Проверка коннекта и переконнект

lib/Aion/Query.pm  view on Meta::CPAN

	my ($query, $columns) = @_;
	sql_debug query => $query;
	connect_respavn($base, $base_connection_id);

	my $res = eval {
		if($query =~ /^\s*(select|show|desc(ribe)?)\b/in) {

			my $r = @_>1? do {
				my $sth = $base->prepare($query);
				$sth->execute;
				$_[1] = [@{$sth->{NAME}}];
				my $res = $sth->fetchall_arrayref({});
				$sth->finish;
				$res
			}: $base->selectall_arrayref($query, { Slice => {} });

			if(defined $r and BQ) {
				for my $row (@$r) {
					for my $k (keys %$row) {
						$row->{$k} =~ s/°([^\x7F]{1,7})\x7F/chr from_radix($1, 254)/ge if utf8::is_utf8($row->{$k});

lib/Aion/Query.pm  view on Meta::CPAN


	my @orders = split /\s*,\s*/, $order;
	my @order_direct;
	my @order_sel = map { my $x=$_; push @order_direct, $x=~s/\s+(asc|desc)\s*$//ie ? lc $1: "asc"; $x } @orders;

	my $select = @order_sel==1? $order_sel[0]: 
		_check_drv($base, "mysql|mariadb")? 
			join("", "concat(", join(",',',", @order_sel), ")"):
			join " || ',' || ", @order_sel
	;

	return $select, 1 if $next eq "";

	my @next = split /,/, $next;
	$next[$#orders] //= "";
	@next = map quote($_), @next;
	my @op = map { /^a/ ? ">": "<" } @order_direct;

lib/Aion/Query.pm  view on Meta::CPAN

		}
		push @whr, join " AND ", @opr;
	}
	my $where = join "\nOR ", map "$_", @whr;

	return $select, "($where)", \@order_sel;
}

# Устанавливает или возвращает ключ из таблицы settings
sub settings($;$) {
	my ($id, $value) = @_;

lib/Aion/Query.pm  view on Meta::CPAN


Creates a page request condition not by offset, but by B<cursor pagination>.

To do this, it receives C<$order> of the SQL query and C<$next> - a link to the next page.

	my ($select, $where, $order_sel) = make_query_for_order "name DESC, id ASC", undef;
	
	$select     # => name || ',' || id
	$where      # -> 1
	$order_sel  # -> undef
	
	my @rows = query "SELECT $select as next FROM author WHERE $where LIMIT 2";
	
	my $last = pop @rows;
	
	($select, $where, $order_sel) = make_query_for_order "name DESC, id ASC", $last->{next};
	$select     # => name || ',' || id
	$where      # => (name < 'Pushkin A.'\nOR name = 'Pushkin A.' AND id >= '2')
	$order_sel  # --> [qw/name id/]

See also:

 view all matches for this distribution


Aion-Telemetry

 view release on metacpan or  search on metacpan

lib/Aion/Telemetry.pm  view on Meta::CPAN


Creates a reference point.

	my $reper1 = refmark "main";
	
	select(undef, undef, undef, .05);
	
	my $reper2 = refmark "reper2";
	select(undef, undef, undef, .2);
	undef $reper2;
	
	select(undef, undef, undef, .05);
	
	my $reper3 = refmark "reper2";
	select(undef, undef, undef, .1);
	undef $reper3;
	
	select(undef, undef, undef, .1);
	
	undef $reper1;
	
	# report:
	sub round ($) { int($_[0]*10 + .5) / 10 }

 view all matches for this distribution


Album

 view release on metacpan or  search on metacpan

lib/Album/Tutorial.pm  view on Meta::CPAN

'200405171843310052.jpg'. 'album' tries to link to the image, if that
is not possible, the image will be coped. File 'dsc00053.jpg' must be
rotated, so it will always be a copy.

If you hover the mouse over the file name in the index page, or over
the title on the image pages, a pop-up will show a selection of
information from the EXIF data.

=head2 Embedding other albums

In the file 'info.dat' you can also enter names of HTML documents to

 view all matches for this distribution


Algorithm-AM

 view release on metacpan or  search on metacpan

lib/Algorithm/AM/Batch.pm  view on Meta::CPAN

    if(!$self->training_item_hook &&
            ($self->probability == 1) &&
            $max >= $self->training_set->size){
        $training_set = $self->training_set;
    }else{
        # otherwise, make a new set with just the selected
        # items
        $training_set = Algorithm::AM::DataSet->new(
            cardinality => $self->training_set->cardinality);

        # don't try to add more items than we have!

 view all matches for this distribution


Algorithm-Bitonic-Sort

 view release on metacpan or  search on metacpan

lib/Algorithm/Bitonic/Sort.pm  view on Meta::CPAN


=head1 SUBROUTINES

=head2 bitonic_sort

The First Parameter works as the ascending/decreasing selector.
True (1 or any true value) means ascending (incremental),
False (0 or any false value) means decreasing.

All other params will be treated as members/items to be sorted.

 view all matches for this distribution


Algorithm-BreakOverlappingRectangles

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

ck_retarget|||
ck_return|||
ck_rfun|||
ck_rvconst|||
ck_sassign|||
ck_select|||
ck_shift|||
ck_sort|||
ck_spair|||
ck_split|||
ck_subr|||

 view all matches for this distribution


Algorithm-CP-IZ

 view release on metacpan or  search on metacpan

lib/Algorithm/CP/IZ.pm  view on Meta::CPAN

# Do not simply export all your public functions/methods/constants.

# This allows declaration	use Algorithm::CP::IZ ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'value_selector' => [ qw(
    CS_VALUE_SELECTOR_MIN_TO_MAX
    CS_VALUE_SELECTOR_MAX_TO_MIN
    CS_VALUE_SELECTOR_LOWER_AND_UPPER
    CS_VALUE_SELECTOR_UPPER_AND_LOWER
    CS_VALUE_SELECTOR_MEDIAN_AND_REST

lib/Algorithm/CP/IZ.pm  view on Meta::CPAN

    CS_VALUE_SELECTION_LT
    CS_VALUE_SELECTION_GE
    CS_VALUE_SELECTION_GT
) ]);

our @EXPORT_OK = ( @{ $EXPORT_TAGS{'value_selector'} } );

our $VERSION = '0.07';

sub AUTOLOAD {
    # This AUTOLOAD is used to 'autoload' constants from the constant()

lib/Algorithm/CP/IZ.pm  view on Meta::CPAN

    my $array = [map { $$_ } @$var_array];
    my $max_fail = -1;
    my $find_free_var_id = 0;
    my $find_free_var_func = sub { die "search: Internal error"; };
    my $criteria_func;
    my $value_selectors;
    my $max_fail_func;
    my $ngs;
    my $notify;
    
    if ($params->{FindFreeVar}) {

lib/Algorithm/CP/IZ.pm  view on Meta::CPAN

    if ($params->{MaxFail}) {
	$max_fail = int($params->{MaxFail});
    }

    if ($params->{ValueSelectors}) {
	$value_selectors = $params->{ValueSelectors};
    }

    if ($params->{MaxFailFunc}) {
	$max_fail_func = $params->{MaxFailFunc};
    }

lib/Algorithm/CP/IZ.pm  view on Meta::CPAN

	}

	$notify->set_var_array($var_array);
    }

    my $is_search35 = $value_selectors || $max_fail_func || $ngs || $notify;

    if ($is_search35) {
	unless ($value_selectors) {
	    if ($criteria_func) {
		$Algorithm::CP::IZ::CriteriaValueSelector::CriteriaFunction = $criteria_func;
		
		$value_selectors = [
		    map {
			$self->create_value_selector_simple("Algorithm::CP::IZ::CriteriaValueSelector")
		    } (0..scalar(@$var_array)-1)];
	    }
	    else {
		$value_selectors = [
		    map {
			$self->get_value_selector(&CS_VALUE_SELECTOR_MIN_TO_MAX)
		    } (0..scalar(@$var_array)-1)];
	    }
	}
	
	my $i = 0;
	for my $v (@$array) {
	    my $vs = $value_selectors->[$i];
	    $vs->prepare($i);
	    $i++;
	}

	if ($max_fail_func) {
	    return Algorithm::CP::IZ::cs_searchValueSelectorRestartNG(
		$array,
		$value_selectors,
		$find_free_var_id,
		$find_free_var_func,
		$max_fail_func,
		$max_fail,
		defined($ngs) ? $ngs->{_ngs} : 0,
		defined($notify) ? $notify->{_ptr} : 0);
	}
	else {
	    return Algorithm::CP::IZ::cs_searchValueSelectorFail(
		$array,
		$value_selectors,
		$find_free_var_id,
		$find_free_var_func,
		$max_fail,
		defined($notify) ? $notify->{_ptr} : 0);
	}

lib/Algorithm/CP/IZ.pm  view on Meta::CPAN


    # not supported
    return;
}

sub get_value_selector {
    my $self = shift;
    my $id = shift;

    return Algorithm::CP::IZ::ValueSelector::IZ->new($self, $id);
}

sub create_value_selector_simple {
    my $self = shift;
    my $id = shift;

    return Algorithm::CP::IZ::ValueSelector::Simple->new($self, $id);
}

lib/Algorithm/CP/IZ.pm  view on Meta::CPAN


=over 2

=item FindFreeVar

FindFreeVar specifies variable selection strategy.
Choose constants from Algorithm::CP::IZ::FindFreeVar or specify your own
function as coderef here.

Most simple function will be following. (select from first)

    sub simple_find_free_var{
	my $array = shift; # VARIABLES is in parameter
	my $n = scalar @$array;

lib/Algorithm/CP/IZ.pm  view on Meta::CPAN

	return -1; # no free variable
    };

=item Criteria

Criteria specifies value selection strategy.
Specify your own function as coderef here.

    sub sample_criteria {
      # position in VARIABLES, and candidate value
      my ($index, $val) = @_;

lib/Algorithm/CP/IZ.pm  view on Meta::CPAN

Upper limit of fail count while searching solutions.

=item ValueSelectors

Arrayref of Algorithm::CP::IZ::ValueSelector instances created via
get_value_selector or create_value_selector_simple method.

(If ValueSelector is specified, this parameter is ignored.)

=item MaxFailFunc

lib/Algorithm/CP/IZ.pm  view on Meta::CPAN


Specify a notify object receives following notification by search function.

    search_start
    search_end
    before_value_selection
    after_value_selection
    enter
    leave
    found

if OBJECT is a object, method having notification name will be called.

lib/Algorithm/CP/IZ.pm  view on Meta::CPAN


Returns version string like "3.5.0".
undef will be returned if getVersion() is not supported in iZ-C (old version).


=item get_value_selector(ID)

Get built-in value selector (instance of Algorithm::CP::IZ::ValueSelector) specifed by ID.
ID must be selected from following constants defined in package Algorithm::CP::IZ.

=over

=item CS_VALUE_SELECTOR_MIN_TO_MAX

lib/Algorithm/CP/IZ.pm  view on Meta::CPAN


=item CS_VALUE_SELECTOR_MEDIAN_AND_REST

=back

(These values are exported by Algorithm::CP::IZ and can be imported using tag 'value_selector')

Returned object will be used as a parameter ValueSelectors when calling "search" method.

  use Algorithm::CP::IZ qw(:value_selector);
  my $vs = $iz->get_value_selector(CS_VALUE_SELECTOR_MIN_TO_MAX);

  my $v1 = $iz->create_int(1, 9);
  my $v2 = $iz->create_int(1, 9);
  $iz->Add($v1, $v2)->Eq(12);
  my $rc = $iz->search([$v1, $v2], {
      ValueSelectors => [ $vs, $vs ],
  });


=item create_value_selector_simple(CLASS_NAME)

Create user defined value-seelctor defined by class named CLASS_NAME.
This class must have constructor named "new" and method namaed "next".

  use Algorithm::CP::IZ qw(:value_selector);
  
  package VSSample1;
  sub new {
    my $class = shift;
    my ($v, $index) = @_;

lib/Algorithm/CP/IZ.pm  view on Meta::CPAN

  }

  my $v1 = $iz->create_int(1, 9);
  my $v2 = $iz->create_int(1, 9);
  $iz->Add($v1, $v2)->Eq(12);
  my $vs = $iz->create_value_selector_simple("VSSample1");
  my $rc = $iz->search([$v1, $v2], {
      ValueSelectors => [ $vs, $vs ],
  });

=item create_no_good_set(VARIABLES, PRE_FILTER, MAX_NO_GOOD, EXT)

 view all matches for this distribution


Algorithm-CheckDigits

 view release on metacpan or  search on metacpan

lib/Algorithm/CheckDigits.pm  view on Meta::CPAN

Providing some means to add additional algorithms without the need to change
the module has the benefit that the user of those additional algorithms may
easily use them with the same interface as the other algorithms without having
to wait for a new version, that may or may not include the wanted algorithm.

But there is a problem: the user must be able to select the new algorithms
like he did with the other ones. And the catch is: since these new algorithms
are developed independently there is no guarantee that no more than one
module applies for the same handle. I could have implemented some simple
strategies like last one wins (the module that registers last for a given
handle is the one that is choosen) or first one wins (the first registered

 view all matches for this distribution


Algorithm-ClusterPoints

 view release on metacpan or  search on metacpan

example/draw2-1.pl  view on Meta::CPAN

use List::Util qw(max min);
use GD::Image;

use Algorithm::ClusterPoints;

select STDERR; $|=1; select STDOUT;

# Latitude stats:
# Minimum: 10.318842
# Maximum: 14.124424
# Mean: 11.24719

 view all matches for this distribution


Algorithm-Combinatorics

 view release on metacpan or  search on metacpan

Combinatorics.pm  view on Meta::CPAN


This documentation refers to Algorithm::Combinatorics version 0.26.

=head1 DESCRIPTION

Algorithm::Combinatorics is an efficient generator of combinatorial sequences. Algorithms are selected from the literature (work in progress, see L</REFERENCES>). Iterators do not use recursion, nor stacks, and are written in C.

Tuples are generated in lexicographic order, except in C<subsets()>.

=head1 SUBROUTINES

 view all matches for this distribution


Algorithm-ConsistentHash-CHash

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

ck_require|||
ck_return|||
ck_rfun|||
ck_rvconst|||
ck_sassign|||
ck_select|||
ck_shift|||
ck_sort|||
ck_spair|||
ck_split|||
ck_subr|||

 view all matches for this distribution


Algorithm-ConstructDFA2

 view release on metacpan or  search on metacpan

lib/Algorithm/ConstructDFA2.pm  view on Meta::CPAN


  my $sth = $self->_dbh->prepare(q{
    SELECT state_id FROM State WHERE vertex_str = ?
  });

  return $self->_dbh->selectrow_array($sth, {}, $vertex_str);
}

sub _find_or_create_state_from_vertex_str {
  my ($self, $vertex_str) = @_;

lib/Algorithm/ConstructDFA2.pm  view on Meta::CPAN


  my $escaped_roots = join ", ", map {
    $self->_dbh->quote($_)
  } @vertices;

  my ($vertex_str) = $self->_dbh->selectrow_array(qq{
    SELECT _canonical(json_group_array(closure.e_reachable))
    FROM Closure
    WHERE root IN ($escaped_roots)
  });

lib/Algorithm/ConstructDFA2.pm  view on Meta::CPAN

}

sub vertices_in_state {
  my ($self, $state_id) = @_;

  return map { @$_ } $self->_dbh->selectall_array(q{
    SELECT vertex FROM Configuration WHERE state = ?
  }, {}, $state_id);
}

sub cleanup_dead_states {

lib/Algorithm/ConstructDFA2.pm  view on Meta::CPAN

    SELECT state_id AS state
    FROM State
    WHERE _vertices_accept(vertex_str)+0 = 1
  });

  my @accepting = map { @$_ } $self->_dbh->selectall_array(q{
    SELECT state FROM accepting
  });

  # NOTE: this also renames states in transitions involving
  # possible start states, but they would then simply have no

lib/Algorithm/ConstructDFA2.pm  view on Meta::CPAN

    ORDER BY
      s.state_id, i.rowid
    LIMIT ?
  });

  my @new = $self->_dbh->selectall_array($sth, {}, $limit);

  my $find_or_create = memoize(sub {
    _find_or_create_state_from_vertex_str($self, @_);
  });

lib/Algorithm/ConstructDFA2.pm  view on Meta::CPAN

}

sub transitions_as_3tuples {
  my ($self) = @_;

  return $self->_dbh->selectall_array(q{
    SELECT src, input, dst FROM transition
  });
}

sub transitions_as_5tuples {
  my ($self) = @_;

  return $self->_dbh->selectall_array(q{
    SELECT * FROM view_transitions_as_5tuples
  });
}

sub backup_to_file {

 view all matches for this distribution


Algorithm-DecisionTree

 view release on metacpan or  search on metacpan

Examples/evaluate_training_data1.pl  view on Meta::CPAN

##  contained in the file `stage3cancer.csv'.

##  Through the class EvalTrainingData as shown below, this script runs a 10-fold
##  cross-validation test on the training data.  This test divides all of the
##  training data into ten parts, with nine parts used for training a decision tree
##  and one part used for testing its ability to classify correctly. This selection
##  of nine parts for training and one part for testing is carried out in all of the
##  ten different possible ways.

##  A script like this can also be used to test the appropriateness of your choices
##  for the constructor parameters entropy_threshold, max_depth_desired, and

 view all matches for this distribution


Algorithm-Dependency-Objects

 view release on metacpan or  search on metacpan

lib/Algorithm/Dependency/Objects.pm  view on Meta::CPAN

	my ($class, %params) = @_;

	my $objects = $class->_to_set($params{objects}) or
		croak "The 'objects' parameter must be an array reference or a Set::Object";
	
	my $selected = exists($params{selected})
		? $class->_to_set($params{selected})
		: Set::Object->new()
			or croak "If provided, the 'selected' parameter must be an array reference or a Set::Object";
	
	# all the contents of the Set::Object must have depends methods
	$class->assert_can_get_deps($objects);

	$objects = $class->verify_input_set($objects);

	return bless {
		objects  => $objects,
		selected => $selected,
	}, $class;
}

sub objects  { (shift)->{objects}  }
sub selected { (shift)->{selected} }

sub get_deps {
	my ( $self, $obj ) = @_;
	$obj->depends;
}

lib/Algorithm/Dependency/Objects.pm  view on Meta::CPAN

sub depends {
	my ( $self, @objs ) = @_;

	my @queue = @objs;

	my $selected_now = Set::Object->new;
	my $selected_previously = $self->selected;

	my $all_objects = $self->objects;

	while (@queue){
		my $obj = shift @queue;

		$self->unknown_object($obj) unless $all_objects->contains($obj);

		next if $selected_now->contains($obj);
		next if $selected_previously->contains($obj);

		push @queue, $self->get_deps($obj);

		$selected_now->insert($obj);
	}

	$selected_now->remove(@objs);

	return wantarray ? $selected_now->members : $selected_now;
}

sub verify_input_set {
	my ( $self, $objects ) = @_;

lib/Algorithm/Dependency/Objects.pm  view on Meta::CPAN

sub schedule {
	my ( $self, @desired ) = @_;

	my $desired = Set::Object->new(@desired);

	my $selected = $self->selected;

	my $missing = $desired->difference($selected);

	$self->depends(@desired)->union($missing)->members;
}

sub schedule_all {
	my $self = shift;
	$self->objects->difference($self->selected)->members;
}

__PACKAGE__

__END__

lib/Algorithm/Dependency/Objects.pm  view on Meta::CPAN


	use Algorithm::Dependency::Objects;

	my $o = Algorithm::Dependency::Objects->new(
		objects => \@objects,
		selected => \@selected, # objects which are already taken care of
	);

	my @needed = $o->schedule( $objects[0] );

	# need to take care of @needed for $objecs[0] to be resolved

lib/Algorithm/Dependency/Objects.pm  view on Meta::CPAN


Duh.

=item B<objects>

=item B<selected>

Returns the L<Set::Object> representing this collection. Objects is an
enumeration of all the object who we're dependo-frobnicating, and selected is
those that don't need to be run.

=item B<depends>

=item B<schedule>

 view all matches for this distribution


Algorithm-Dependency-Source-DBI

 view release on metacpan or  search on metacpan

lib/Algorithm/Dependency/Source/DBI.pm  view on Meta::CPAN

  use Algorithm::Dependency::Source::DBI;
  
  # Load the data from a database
  my $data_source = Algorithm::Dependency::Source::DBI->new(
      dbh            => DBI->connect('dbi:SQLite:sqlite.db'),
      select_ids     => 'select name from stuff',
      select_depends => 'select from, to from m2m_deps',
  );
  
  # Create the dependency object, and indicate the items that are already
  # selected/installed/etc in the database
  my $dep = Algorithm::Dependency->new(
      source   => $data_source,
      selected => [ 'This', 'That' ]
  ) or die 'Failed to set up dependency algorithm';
  
  # For the item 'Foo', find out the other things we also have to select.
  # This WON'T include the item we selected, 'Foo'.
  my $also = $dep->depends( 'Foo' );
  print $also
  	? "By selecting 'Foo', you are also selecting the following items: "
  		. join( ', ', @$also )
  	: "Nothing else to select for 'Foo'";
  
  # Find out the order we need to act on the items in.
  # This WILL include the item we selected, 'Foo'.
  my $schedule = $dep->schedule( 'Foo' );

=head1 DESCRIPTION

The L<Algorithm::Dependency> module has shown itself to be quite reliable

lib/Algorithm/Dependency/Source/DBI.pm  view on Meta::CPAN


=head2 new

  my $simple = Algorithm::Dependency::Source::DBI->new(
      dbh            => $dbi_db_handle,
      select_ids     => 'select name from stuff',
      select_depends => 'select from, to from m2m_deps',
  );
  
  my $complex = Algorithm::Dependency::Source::DBI->new(
      dbh            => $dbi_db_handle,
      select_ids     => [ 'select name from stuff where foo = ?',         'bar' ],
      select_depends => [ 'select from, to from m2m_deps where from = ?', 'bar' ],
  );

The C<new> constructor takes three named named params.

The C<dbh> param should be a standard L<DBI> database connection.

The C<select_ids> param is either a complete SQL string, or a reference to
an C<ARRAY> containing a SQL string with placeholders and matching
variables.

When executed on the database, it should return a single column containing
the complete set of all item identifiers.

The C<select_depends> param is either a complete SQL string, or a reference
to an C<ARRAY> containing a SQL string with placeholders and matching
variables.

When executed on the database, it should return two columns containing
the complete set of all dependencies, where identifiers in the first-column

lib/Algorithm/Dependency/Source/DBI.pm  view on Meta::CPAN


	# Create the object
	my $self = bless { @_ }, $class;

	# Apply defaults
	if ( _STRING($self->{select_ids}) ) {
		$self->{select_ids} = [ $self->{select_ids} ];
	}
	if ( _STRING($self->{select_depends}) ) {
		$self->{select_depends} = [ $self->{select_depends} ];
	}

	# Check params
	unless ( _INSTANCE($self->dbh, 'DBI::db') ) {
		Carp::croak("The dbh param is not a DBI database handle");
	}
	unless ( _ARRAY($self->select_ids) and _STRING($self->select_ids->[0]) ) {
		Carp::croak("Missing or invalid select_ids param");
	}
	unless ( _ARRAY($self->select_depends) and _STRING($self->select_depends->[0]) ) {
		Carp::croak("Did not provide the select_depends query");
	}

	return $self;
}

lib/Algorithm/Dependency/Source/DBI.pm  view on Meta::CPAN

	$_[0]->{dbh};
}

=pod

=head2 select_ids

The C<select_ids> accessor returns the SQL statement provided to the
constructor. If a raw string was provided, it will be returned as a
reference to an C<ARRAY> containing the SQL string and no params.

=cut

sub select_ids {
	$_[0]->{select_ids};
}

=pod

=head2 select_depends

The C<select_depends> accessor returns the SQL statement provided to
the constructor. If a raw string was provided, it will be returned as
a reference to an C<ARRAY> containing the SQL string and no params.

=cut

sub select_depends {
	$_[0]->{select_depends};
}




lib/Algorithm/Dependency/Source/DBI.pm  view on Meta::CPAN


sub _load_item_list {
	my $self = shift;

	# Get the list of ids
	my $ids  = $self->dbh->selectcol_arrayref(
		$self->select_ids->[0],
		{}, # No options
		@{$self->select_ids}[1..-1],
		);
	my %hash = map { $_ => [ ] } @$ids;

	# Get the list of links
	my $depends = $self->dbh->selectall_arrayref(
		$self->select_depends->[0],
		{}, # No options
		@{$self->select_depends}[1..-1],
		);
	foreach my $depend ( @$depends ) {
		next unless $hash{$depend->[0]};
		next unless $hash{$depend->[1]};
		push @{$hash{$depend->[0]}}, $depend->[1];

 view all matches for this distribution


Algorithm-Dependency

 view release on metacpan or  search on metacpan

lib/Algorithm/Dependency.pm  view on Meta::CPAN

#pod   };
#pod   my $deps_source = Algorithm::Dependency::Source::HoA->new( $deps );
#pod
#pod   my $dep = Algorithm::Dependency::Ordered->new(
#pod     source   => $deps_source,
#pod     selected => [ 'this', 'that' ], # Items we have processed elsewhere or have already satisfied
#pod   )
#pod   or die 'Failed to set up dependency algorithm';
#pod
#pod   my $also = $dep->schedule_all();
#pod   # Returns: ['core', 'a', 'b'] -- ie: installation-order. Whereas using base

lib/Algorithm/Dependency.pm  view on Meta::CPAN

#pod   
#pod   # Load the data from a simple text file
#pod   my $data_source = Algorithm::Dependency::Source::File->new( 'foo.txt' );
#pod   
#pod   # Create the dependency object, and indicate the items that are already
#pod   # selected/installed/etc in the database
#pod   my $dep = Algorithm::Dependency->new(
#pod       source   => $data_source,
#pod       selected => [ 'This', 'That' ]
#pod   ) or die 'Failed to set up dependency algorithm';
#pod   
#pod   # For the item 'Foo', find out the other things we also have to select.
#pod   # This WON'T include the item we selected, 'Foo'.
#pod   my $also = $dep->depends( 'Foo' );
#pod   print $also
#pod   	? "By selecting 'Foo', you are also selecting the following items: "
#pod   		. join( ', ', @$also )
#pod   	: "Nothing else to select for 'Foo'";
#pod   
#pod   # Find out the order we need to act on the items in.
#pod   # This WILL include the item we selected, 'Foo'.
#pod   my $schedule = $dep->schedule( 'Foo' );
#pod
#pod =head1 DESCRIPTION
#pod
#pod Algorithm::Dependency is a framework for creating simple read-only

lib/Algorithm/Dependency.pm  view on Meta::CPAN

#pod
#pod =for stopwords versioned
#pod
#pod Algorithm::Dependency implements algorithms relating to dependency
#pod hierarchies. To use this framework, all you need is a source for the master
#pod list of all the items, and a list of those already selected. If your
#pod dependency hierarchy doesn't require the concept of items that are already
#pod selected, simply don't pass anything to the constructor for it.
#pod
#pod Please note that the class Algorithm::Dependency does NOT implement an
#pod ordering, for speed and simplicity reasons. That is, the C<schedule> it
#pod provides is not in any particular order. If item 'A' depends on item 'B',
#pod it will not place B before A in the schedule. This makes it unsuitable for

lib/Algorithm/Dependency.pm  view on Meta::CPAN

#pod The only compulsory option is the source of the dependency items. This is
#pod an object of a subclass of L<Algorithm::Dependency::Source>. In practical terms,
#pod this means you will create the source object before creating the
#pod Algorithm::Dependency object.
#pod
#pod =item selected => [ 'A', 'B', 'C', etc... ]
#pod
#pod The C<selected> option provides a list of those items that have already been
#pod 'selected', acted upon, installed, or whatever. If another item depends on one
#pod in this list, we don't have to include it in the output of the C<schedule> or
#pod C<depends> methods.
#pod
#pod =item ignore_orphans => 1
#pod

lib/Algorithm/Dependency.pm  view on Meta::CPAN

		or return undef;

	# Create the object
	my $self = bless {
		source   => $source, # Source object
		selected => {},
		}, $class;

	# Were we given the 'ignore_orphans' flag?
	if ( $args{ignore_orphans} ) {
		$self->{ignore_orphans} = 1;
	}

	# Done, unless we have been given some selected items
	_ARRAY($args{selected}) or return $self;

	# Make sure each of the selected ids exists
	my %selected = ();
	foreach my $id ( @{ $args{selected} } ) {
		# Does the item exist?
		return undef unless $source->item($id);

		# Is it a duplicate
		return undef if $selected{$id};

		# Add to the selected index
		$selected{$id} = 1;
	}

	$self->{selected} = \%selected;
	$self;
}



lib/Algorithm/Dependency.pm  view on Meta::CPAN


sub source { $_[0]->{source} }

#pod =pod
#pod
#pod =head2 selected_list
#pod
#pod The C<selected_list> method returns, as a list and in alphabetical order,
#pod the list of the names of the selected items.
#pod
#pod =cut

sub selected_list { sort keys %{$_[0]->{selected}} }

#pod =pod
#pod
#pod =head2 selected $name
#pod
#pod Given an item name, the C<selected> method will return true if the item is
#pod selected, false is not, or C<undef> if the item does not exist, or an error
#pod occurs.
#pod
#pod =cut

sub selected { $_[0]->{selected}->{$_[1]} }

#pod =pod
#pod
#pod =head2 item $name
#pod

lib/Algorithm/Dependency.pm  view on Meta::CPAN

#pod
#pod =head2 depends $name1, ..., $nameN
#pod
#pod Given a list of one or more item names, the C<depends> method will return
#pod a reference to an array containing a list of the names of all the OTHER
#pod items that also have to be selected to meet dependencies.
#pod
#pod That is, if item A depends on B and C then the C<depends> method would
#pod return a reference to an array with B and C. ( C<[ 'B', 'C' ]> )
#pod
#pod If multiple item names are provided, the same applies. The list returned

lib/Algorithm/Dependency.pm  view on Meta::CPAN

	while ( my $id = shift @stack ) {
		# Does the id exist?
		my $Item = $self->{source}->item($id)
		or $self->{ignore_orphans} ? next : return undef;

		# Skip if selected or checked
		next if $checked{$id};

		# Add its depends to the stack
		push @stack, $Item->depends;
		$checked{$id} = 1;

lib/Algorithm/Dependency.pm  view on Meta::CPAN

		unless ( scalar grep { $id eq $_ } @_ ) {
			push @depends, $id;
		}
	}

	# Remove any items already selected
	my $s = $self->{selected};
	return [ sort grep { ! $s->{$_} } @depends ];
}

#pod =pod
#pod

lib/Algorithm/Dependency.pm  view on Meta::CPAN

#pod dependencies, in the preferred order of action. For the normal algorithm,
#pod where order it not important, this is alphabetical order. This makes it
#pod easier for someone watching a program operate on the items to determine
#pod how far you are through the task and makes any logs easier to read.
#pod
#pod If any of the names you provided in the arguments is already selected, it
#pod will not be included in the list.
#pod
#pod The method returns a reference to an array of item names on success, a
#pod reference to an empty array if no items need to be acted upon, or C<undef>
#pod on error.

lib/Algorithm/Dependency.pm  view on Meta::CPAN

	my @items = @_ or return undef;

	# Get their dependencies
	my $depends = $self->depends( @items ) or return undef;

	# Now return a combined list, removing any items already selected.
	# We are allowed to return an empty list.
	my $s = $self->{selected};
	return [ sort grep { ! $s->{$_} } @items, @$depends ];
}

#pod =pod
#pod
#pod =head2 schedule_all;
#pod
#pod The C<schedule_all> method acts the same as the C<schedule> method, but 
#pod returns a schedule that selected all the so-far unselected items.
#pod
#pod =cut

sub schedule_all {
	my $self = shift;

lib/Algorithm/Dependency.pm  view on Meta::CPAN

  };
  my $deps_source = Algorithm::Dependency::Source::HoA->new( $deps );

  my $dep = Algorithm::Dependency::Ordered->new(
    source   => $deps_source,
    selected => [ 'this', 'that' ], # Items we have processed elsewhere or have already satisfied
  )
  or die 'Failed to set up dependency algorithm';

  my $also = $dep->schedule_all();
  # Returns: ['core', 'a', 'b'] -- ie: installation-order. Whereas using base

lib/Algorithm/Dependency.pm  view on Meta::CPAN

  
  # Load the data from a simple text file
  my $data_source = Algorithm::Dependency::Source::File->new( 'foo.txt' );
  
  # Create the dependency object, and indicate the items that are already
  # selected/installed/etc in the database
  my $dep = Algorithm::Dependency->new(
      source   => $data_source,
      selected => [ 'This', 'That' ]
  ) or die 'Failed to set up dependency algorithm';
  
  # For the item 'Foo', find out the other things we also have to select.
  # This WON'T include the item we selected, 'Foo'.
  my $also = $dep->depends( 'Foo' );
  print $also
  	? "By selecting 'Foo', you are also selecting the following items: "
  		. join( ', ', @$also )
  	: "Nothing else to select for 'Foo'";
  
  # Find out the order we need to act on the items in.
  # This WILL include the item we selected, 'Foo'.
  my $schedule = $dep->schedule( 'Foo' );

=head1 DESCRIPTION

Algorithm::Dependency is a framework for creating simple read-only

lib/Algorithm/Dependency.pm  view on Meta::CPAN


=for stopwords versioned

Algorithm::Dependency implements algorithms relating to dependency
hierarchies. To use this framework, all you need is a source for the master
list of all the items, and a list of those already selected. If your
dependency hierarchy doesn't require the concept of items that are already
selected, simply don't pass anything to the constructor for it.

Please note that the class Algorithm::Dependency does NOT implement an
ordering, for speed and simplicity reasons. That is, the C<schedule> it
provides is not in any particular order. If item 'A' depends on item 'B',
it will not place B before A in the schedule. This makes it unsuitable for

lib/Algorithm/Dependency.pm  view on Meta::CPAN

The only compulsory option is the source of the dependency items. This is
an object of a subclass of L<Algorithm::Dependency::Source>. In practical terms,
this means you will create the source object before creating the
Algorithm::Dependency object.

=item selected => [ 'A', 'B', 'C', etc... ]

The C<selected> option provides a list of those items that have already been
'selected', acted upon, installed, or whatever. If another item depends on one
in this list, we don't have to include it in the output of the C<schedule> or
C<depends> methods.

=item ignore_orphans => 1

lib/Algorithm/Dependency.pm  view on Meta::CPAN

=head2 source

The C<source> method retrieves the L<Algorithm::Dependency::Source> object
for the algorithm context.

=head2 selected_list

The C<selected_list> method returns, as a list and in alphabetical order,
the list of the names of the selected items.

=head2 selected $name

Given an item name, the C<selected> method will return true if the item is
selected, false is not, or C<undef> if the item does not exist, or an error
occurs.

=head2 item $name

The C<item> method fetches and returns the item object, as specified by the

lib/Algorithm/Dependency.pm  view on Meta::CPAN


=head2 depends $name1, ..., $nameN

Given a list of one or more item names, the C<depends> method will return
a reference to an array containing a list of the names of all the OTHER
items that also have to be selected to meet dependencies.

That is, if item A depends on B and C then the C<depends> method would
return a reference to an array with B and C. ( C<[ 'B', 'C' ]> )

If multiple item names are provided, the same applies. The list returned

lib/Algorithm/Dependency.pm  view on Meta::CPAN

dependencies, in the preferred order of action. For the normal algorithm,
where order it not important, this is alphabetical order. This makes it
easier for someone watching a program operate on the items to determine
how far you are through the task and makes any logs easier to read.

If any of the names you provided in the arguments is already selected, it
will not be included in the list.

The method returns a reference to an array of item names on success, a
reference to an empty array if no items need to be acted upon, or C<undef>
on error.

=head2 schedule_all;

The C<schedule_all> method acts the same as the C<schedule> method, but 
returns a schedule that selected all the so-far unselected items.

=head1 TO DO

Add the C<check_source> method, to verify the integrity of the source.

 view all matches for this distribution


Algorithm-Diff-Any

 view release on metacpan or  search on metacpan

lib/Algorithm/Diff/Any.pm  view on Meta::CPAN

# Algorithm::Diff::Any
#  An interface that automagically selects the XS or Pure Perl port of
#  the diff algorithm (Algorithm::Diff or Algorithm::Diff::XS)
#
# $Id: Any.pm 10595 2009-12-23 00:29:52Z FREQUENCY@cpan.org $

package Algorithm::Diff::Any;

lib/Algorithm/Diff/Any.pm  view on Meta::CPAN

  }
}

=head1 DESCRIPTION

This is a simple module to select the best available implementation of the
standard C<diff> algorithm, which works by effectively trying to solve the
Longest Common Subsequence (LCS) problem. This algorithm is described in:
I<A Fast Algorithm for Computing Longest Common Subsequences>, CACM, vol.20,
no.5, pp.350-353, May 1977.

 view all matches for this distribution


Algorithm-Diff-XS

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

ck_retarget|||
ck_return|||
ck_rfun|||
ck_rvconst|||
ck_sassign|||
ck_select|||
ck_shift|||
ck_sort|||
ck_spair|||
ck_split|||
ck_subr|||

 view all matches for this distribution


Algorithm-Diff

 view release on metacpan or  search on metacpan

lib/Algorithm/Diff.pm  view on Meta::CPAN

            # 1   # $me->[1]: Ref to first sequence
            # 2   # $me->[2]: Ref to second sequence
sub _End()  { 3 } # $me->[_End]: Diff between forward and reverse pos
sub _Same() { 4 } # $me->[_Same]: 1 if pos 1 contains unchanged items
sub _Base() { 5 } # $me->[_Base]: Added to range's min and max
sub _Pos()  { 6 } # $me->[_Pos]: Which hunk is currently selected
sub _Off()  { 7 } # $me->[_Off]: Offset into _Idx for current position
sub _Min() { -2 } # Added to _Off to get min instead of max+1

sub Die
{

 view all matches for this distribution


Algorithm-DimReduction

 view release on metacpan or  search on metacpan

inc/Test/Builder.pm  view on Meta::CPAN

    return $fh;
}

sub _autoflush {
    my($fh) = shift;
    my $old_fh = select $fh;
    $| = 1;
    select $old_fh;

    return;
}

my( $Testout, $Testerr );

 view all matches for this distribution


Algorithm-Easing

 view release on metacpan or  search on metacpan

lib/Algorithm/Easing.pm  view on Meta::CPAN

    Quintonion
    Sinusoidal
    Backdraft
    Circular

For ease of use, there is an included Mediator class.  The Mediator class permits the programmer to select from the spread of easing functions through a single class name.

=cut

=head1 METHODS

 view all matches for this distribution


Algorithm-Evolutionary

 view release on metacpan or  search on metacpan

lib/Algorithm/Evolutionary/Hash_Wheel.pm  view on Meta::CPAN

use strict;
use warnings;

=head1 NAME

Algorithm::Evolutionary::Hash_Wheel - Random selector of things depending on probabilities

=head1 SYNOPSIS

    my $wheel = new Algorithm::Evolutionary::Hash_Wheel( \%probs );
    print $wheel->spin(); #Returns an element according to probabilities;

=head1 DESCRIPTION

Creates a "roulette wheel" for spinning and selecting stuff. It will
be used in several places; mainly in the
L<Algorithm::Evolutionary::Op::CanonicalGA>. It's similar to
L<Algorithm::Evolutionary::Wheel>, but with a hash instead of an
array. Probably should unify both..

 view all matches for this distribution


( run in 1.258 second using v1.01-cache-2.11-cpan-2b1a40005be )