---
name: "UR::Object::Type::ModuleWriter"
section: "3pm"
platform: "linux"
package: "libur-perl"
version: "0.470+ds-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/UR::Object::Type::ModuleWriter"
---

# UR::Object::Type::ModuleWriter(3pm)

Helper module for UR::Object::Type responsible for writing Perl modules

## NAME

UR::Object::Type::ModuleWriter - Helper module for UR::Object::Type responsible for writing Perl modules

## DESCRIPTION

Subroutines within this module actually live in the UR::Object::Type namespace;  this module is just a convienent place to collect them.  The Module Writer is used by the class updater system ((UR::Namespace::Command::Update::Classes and 'ur update classes) to add, remove and alter the Perl modules behind the classes within a Namespace.

## METHODS

- resolve\_module\_header\_source

  ```
    $classobj->resolve_module_header_source();
  ```

  Returns a string that represents a fully-formed class definition the the given class metaobject `$classobj`.

- resolve\_class\_description\_perl

  ```
    $classobj->resolve_class_description_perl()
  ```

  Used by **resolve\_module\_header\_source()**.  This method inspects all the applicable properties of the class metaobject and builds up a string that gets inserted between the {...} of the class definition string.

- rewrite\_module\_header

  ```
    $classobj->rewrite_module_header();
  ```

  This method rewrites an existing Perl module file in place for the class metaobject, or creates a new file if one does not already exist.

- module\_base\_name

  Returns the pathname of the class's module relative to the top level directory of that class's Namespace.

- module\_path

  Returns the fully qualified pathname of the class's module.

- module\_source\_lines

  Returns the text of the class's Perl module as a list of strings.

- module\_source

  Returns the text of the class's Perl module as a single string.

- module\_header\_positions

  Returns a 3-element list ($begin, `$end`, `$use`) where `$begin` is the line number where the class header begins.  `$end` is the line number where it ends.  `$use` is the line number where the module declares that it use's a Namespace.

- module\_header\_source\_lines

  Returns the text of the class's Perl module source where the class definition is as a list of strings.

- module\_header\_source

  Returns the text of the class's Perl module source where the class definition is as a single string.

## SEE ALSO

UR::Object::Type, UR::Object::Type::Initializer
