App::Sqitch::Plan::Depend3pm
Sqitch dependency specification
Usage
my $depend = App::Sqitch::Plan::Depend->new(plan => $plan,App::Sqitch::Plan::Depend->parse('!proj:change@tag'));
Overview
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 |
"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 "!".
Releases
6 releases since Debian 8 (Jessie); the text changed 5 times.