Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I freely admit: I'm not that experienced with OO.
But instead of asking us all to Abandon hope you might be willing and able to post a hint on how to do it better.
In case you would like to do so I put the POD of that code in question here:

NAME

Archive - Manage Archives as Objects.


SYNOPSIS

    use Archive;

    ##  create a Archive object supplying all information needed
    my $force = 1;
    my $arch = Archive->new( archive    => $full_path_archive
                           , source_dir => $source_directory
                           , file_glob  => '.'
                           , log_file   => $log_object  ## a LogFile object (see LogFile.pm)
                           );

    ##  create a physical Archive using 'gtar czvf'
    $arch->prepare_create(force=>$force);
    $arch->create;

    ##  or

    ##  extract a physical Archive using 'gtar xzvf'
    $arch->prepare_extract;
    $arch->extract;

    ##  or

    ##  remove a physical Archive using 'rm -f'
    $arch->remove;

    ##  You can create a list of Archive objects as Archive::List object
    my $arch_list = Archive::List->new;

    ##  and add Archive objects to the list
    $arch_list->add($arch);
    $arch_list->add($brch);

    ##  now you can use all Archive methods also on all members of a Archive::List object
    $arch_list->prepare_create;
    $arch_list->create;


DESCRIPTION

Use Archive to create, extract or remove archives.


OBJECT METHODS


Archive Methods

new

Create a Archive object.

prepare_create

The check_archive Function checks whether an archive exists and refuses to overwrite it unless we set the parameter 'force'. It also checks whether the directory of the archive-to-be exists, is really a directory and is writeable for this user.

create

The create Function actually creates a physical gtar-ed archive.

prepare_extract

The prepare_extract Function checks whether an archive exists and whether the target directory of the extraction exists, is really a directory and is writeable for this user.

extract

The extract Function actually restores all files contained in a gtar-ed archive.

remove

The remove Function removes a gtar-ed archive.


Archive::List Methods

new

Create a Archive::List object.

add

Adds a Archive object to the Archive::List object that invoked the method.

prepare_create create prepare_extract extract remove

These methods called on a Archive::List object do the same for all Archive objects in the list.

---
The idea to create the Class Archive::List is actually just to be able of serialising method invocations.

(update: on dio's suggestion I put the POD directly into this node ....)

pelagic

In reply to Re^2: List Wrapper for Object Methods. by pelagic
in thread List Wrapper for Object Methods. by pelagic

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-19 00:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found