On Tue, Jun 04, 2013 at 12:01:09AM +0100, Rahim Fakir wrote:
> Iam using win 7 64bits, and i downloaded Strawberry, and I use Perl PAckage
> Manager to install modules, insted of Cpan command.
> I know how to install them, but I need instrucions how to use them, step by
> step, how-to run the modules.
> Best regards
> Ray

Hi Ray,

So, I assume you downloaded whatever modules you chose to because you wanted 
the whatever functionality they provide.  Since I don't know _what_ modules 
you chose I'll give an imaginary example and then a specific example from a 
favorite module I use.

  Having said that:
The CPAN page for a module always includes a SYNOPSIS - this gives a very terse
example of using the module.  Check there.

For our example I'll use the fictional raspberry.pm.
It's synopsis reads;
   use raspberry;
   my $answer = raspberry();

The description says:
raspberry returns a line from the raspberry wisdom list.

In your code then it might be used:

    #!/usr/bin/perl    
    use warnings;
    use strict;
    use raspberry;   # the use line incorporates the module code into your 
program

    my $answer = raspberry(); # the function call uses code from the module 
that you didn't write

    print $answer, $/;

and the output might be something like 

    Raspberries are delicious!  Eat some soon to feel good!

Now for a specific, real world example:

    #!/usr/bin/perl
    use Data::Dumper; 

    [ imagine a bunch of code that does something, but you don't quite know 
what            ]
    [ someone else wrote it, and it's now time for you to fix a problem         
            ]
    [ there's a huge complex data structure that hash of arrays or a hash of 
hashes or ...? ]

    print Dumper( \%my_hash_with_who_knows_what ):

Because you're using Data::Dumper you didn't have to write a bunch of code to 
figure out
how to interpret Perl data structures, Gurusamy Sarathy did all the hard work.  
All you need to
do is include is module and call it on the hash of convoluted origins to see 
what it really is.

Generically:

    use <module_name>;

    # code that calls on the modules functions or OO interfaces as documented.



-- 
            Michael Rasmussen, Portland Oregon  
          Be Appropriate && Follow Your Curiosity
  Other Adventures: http://www.jamhome.us/ or http://gplus.to/MichaelRpdx
A special random fortune cookie fortune:
A sadist is a masochist who follows the Golden Rule.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to