agustina_s has asked for the wisdom of the Perl Monks concerning the following question:

Hi perlmonks.. I really need some help. Anyone of you know how to use the SWISS knife?? They are short cut for accessing database from SWISSProt bank. All the packages are written in Perl. I don't understand the main packages even : Entry.pm. The function fromText.. what does it actually do??
sub fromText { my $class = shift; my $text = shift; my $fullParse = shift; my $removeInternalComments = shift; my $lineObject; unless ($text) { confess "fromText called with an empty text reference."; }; my $self = new $class; $self->{_text} = \$text; #handle internal comments and indentation if ($removeInternalComments) { my $indentation = SWISS::TextFunc::unindentLines (\$text); my $internalComments = SWISS::TextFunc::removeInternalComments(\$t +ext); $self->{_indentation} = $indentation; $self->{_internalComments} = $internalComments; }
I only know that it actually try to make the new object base on the input from the database. Thanks... This is the URL :http://swissknife.sourceforge.net/

Replies are listed 'Best First'.
Re: SWISS knife...
by PrakashK (Pilgrim) on Jan 16, 2002 at 23:33 UTC
    The function fromText.. what does it actually do??

    Did you check out the documentation? From the HTML documentation about the Entry.pm module:

    fromText text [, fullParse]

    Create an Entry object from the text $text. If $fullParse in true, the entry is parsed at creation time. Otherwise the individual line objects are only created if they are derefereced.

    /prakash

Re: SWISS knife...
by Alex the Serb (Monk) on Jan 16, 2002 at 16:06 UTC
    well first 4 lines takes arguments that are passed to function and put them in variables that are scalars (they begin with $).
    "shift" means: take from @_ array first element .. $_[0] and than move one place to the left ($_[1] becomes $_[0], etc)

    if scalar $text is empty than it displays the message.

    if you dont know OOP in Perl you should read perltoot, but in short:

    the name of the class is passed in first argument of function. Then the new class of that type is created. Then new atribute is added to the new class which references the data in $text variable
    that is what $self->{_text} = \$text; means.

    You could gave us the content of SWISS.pm module which have definitions of classes, I think.

    type: perl -e "print @INC"

    that will show you where to search for that SWISS.pm