App::Sqitch::Plan::Depend(3)

Name
App::Sqitch::Plan::Depend - Sqitch dependency specification

Synopsis
  my $depend = App::Sqitch::Plan::Depend->new(
        plan => $plan,
        App::Sqitch::Plan::Depend->parse('!proj:change@tag')
  );

Description
An App::Sqitch::Plan::Line represents a single dependency from the dependency list for a planned change. Is is constructed by App::Sqitch::Plan and included in App::Sqitch::Plan::Change objects "conflicts" and "requires" attributes.

Interface

  Constructors
"new"

  my $depend = App::Sqitch::Plan::Depend->new(%params);

Instantiates and returns a App::Sqitch::Plan::Line object. Parameters:

"plan"
    The plan with which the dependency is associated. Required.

"project"
    Name of the project. Required.

"conflicts"
    Boolean to indicate whether the dependency is a conflicting dependency.

"change"
    The name of the change.

"tag"
    The name of the tag claimed as the dependency.

"id"
    The ID of a change. Mutually exclusive with "change" and "tag".

"parse"

  my %params = App::Sqitch::Plan::Depend->parse($string);

Parses a dependency specification as extracted from a plan and returns a hash reference of parameters suitable for passing to "new()". Returns "undef" if the string is not a properly-formatted dependency.

  Accessors
"plan"

  my $plan = $depend->plan;

Returns the App::Sqitch::Plan object with which the dependency specification is associated.

"conflicts"

  say $depend->as_string, ' conflicts' if $depend->conflicts;

Returns true if the dependency is a conflicting dependency, and false if it is not (in which case it is a required dependency).

"required"

  say $depend->as_string, ' required' if $depend->required;

Returns true if the dependency is a required, and false if it is not (in which case it is a conflicting dependency).

"type"

  say $depend->type;

Returns a string indicating the type of dependency, either "require" or "conflict".

"project"

  my $proj = $depend->project;

Returns the name of the project with which the dependency is associated.

"got_project"

Returns true if the "project" parameter was passed to the constructor with a defined value, and false if it was not passed to the constructor.

"change"

  my $change = $depend->change;

Returns the name of the change, if any. If "undef" is returned, the dependency is a tag-only dependency.

"tag"

  my $tag = $depend->tag;

Returns the name of the tag, if any. If "undef" is returned, the dependency is a change-only dependency.

"id"

Returns the ID of the change if the dependency was specified as an ID, or if the dependency is a local dependency.

"got_id"

Returns true if the "id" parameter was passed to the constructor with a defined value, and false if it was not passed to the constructor.

"resolved_id"

Change ID used by the engine when deploying a change. That is, if the dependency is in the database, it will be assigned this ID from the database. If it is not in the database, "resolved_id" will be undef.

"is_external"

Returns true if the dependency references a change external to the current project, and false if it is part of the current project.

"is_internal"

The opposite of "is_external()": returns true if the dependency is in the internal (current) project, and false if not.

  Instance Methods
"key_name"

Returns the key name of the dependency, with the change name and/or tag, properly formatted for passing to the "find()" method of App::Sqitch::Plan. If the dependency was specified as an ID, rather than a change or tag, then the ID will be returned.

"as_string"

Returns the project-qualified key name. That is, if there is a project name, it returns a string with the project name, a colon, and the key name. If there is no project name, the key name is returned.

"as_plan_string"

  my $string = $depend->as_string;

Returns the full stringification of the dependency, suitable for output to a plan file. That is, the same as "as_string" unless "conflicts" returns true, in which case it is prepended with "!".

See Also

App::Sqitch::Plan
    Class representing a plan.

sqitch
    The Sqitch command-line client.

Author
David E. Wheeler <david@justatheory.com>

License
Copyright (c) 2012-2014 iovation Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.