The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

CAD::Drawing::IO -- I/O methods for the CAD::Drawing module

Description

This module provides the load() and save() functions for CAD::Drawing and provides a point of flow-control to deal with the inheritance and other trickiness of having multiple formats handled through a single module.

AUTHOR

  Eric L. Wilhelm
  ewilhelm at sbcglobal dot net
  http://pages.sbcglobal.net/mycroft

COPYRIGHT

This module is copyright (C) 2003 by Eric L. Wilhelm and A. Zahner Co.

LICENSE

This module is distributed under the same terms as Perl. See the Perl source package for details.

You may use this software under one of the following licenses:

  (1) GNU General Public License
    (found at http://www.gnu.org/copyleft/gpl.html)
  (2) Artistic License
    (found at http://www.perl.com/pub/language/misc/Artistic.html)

NO WARRANTY

This software is distributed with ABSOLUTELY NO WARRANTY. The author and his employer will in no way be held liable for any loss or damages resulting from its use.

Modifications

The source code of this module is made freely available and distributable under the GPL or Artistic License. Modifications to and use of this software must adhere to one of these licenses. Changes to the code should be noted as such and this notification (as well as the above copyright information) must remain intact on all copies of the code.

Additionally, while the author is actively developing this code, notification of any intended changes or extensions would be most helpful in avoiding repeated work for all parties involved. Please contact the author with any such development plans.

SEE ALSO

  CAD::Drawing
  CAD::Drawing::IO::*

front-end Input and output methods

The functions load() and save() are responsible for determining the filetype (with forced types available via $opt->{type}.) These then call the appropriate load<thing> or save<thing> functions.

save

Saves a file to disk. See the save<type> functions in this file and the other filetype functions in the CAD::Drawing::IO::<type> modules.

See each save<type> function for available options for that type.

While you may call the save<type> function directly (if you include the module), it is recommended that you stick to the single point of interface provided here.

Note that this method also implements forking.

  $drw->save($filename, \%options);

load

Loads a file from disk. See the load<type> functions in this file and the other filetype functions in the CAD::Drawing::IO::<type> modules.

See each load<type> function for available options for that type.

In most cases %options may contain the selection methods available via the CAD::Drawing::check_select() function.

While you may call the load<type> function directly (if you include the module), it is recommended that you stick to the single point of interface provided here.

  $drw->load($filename, \%options);

Back-End functions

You should not need to call these directly, though extensions will need to be added to the flow control of these two functions.

diskaction

This function is for internal use, intended to consolidate the type selection and calling of load/save methods.

  $drw->diskaction("load|save", $filename, $type, \%options);

typelookup

Internally selects file type based on extensions. While you should never need to call this function directly, you may want understand how it works if you are trying to do something strange.

  $type = typelookup($filename);

Compressed I/O functions

These use File::Temp and compression modules to create a compressed version of most supported I/O types (need tar support for directory-based formats?)

savegzip

  $drw->savegzip($filename, \%opts);

loadgzip

  $drw->loadgzip($filename, \%opts);