Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Including files

by Juerd (Abbot)
on Sep 24, 2004 at 09:28 UTC ( [id://393426]=perltutorial: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use lib 'path/to/the/modules';
    # The example module could be path/to/the/modules/NameOfTheProject/Som
    +eModule.pm
    
  2. or download this
    use strict;
    package NameOfTheProject::SomeModule;
    ...
    }
    
    1;
    
  3. or download this
    use NameOfTheProject::SomeModule;
    
    print NameOfTheProject::SomeModule::some_function();  # prints 123
    
  4. or download this
    use base 'Exporter';
    our @EXPORT_OK = ('some_function');
    
  5. or download this
    use NameOfTheProject::SomeModule ('some_function');
    
    print some_function();  # prints 123
    
  6. or download this
    # This is config.pl
    mirror     => 'http://www.nl.example.com/mirror',
    path       => '/var/www/example',
    skip_files => [ 'png', 'gif', 'jpg' ],
    
  7. or download this
    # This is script.pl
    use strict;
    ...
    chdir $config{path};
    
    ...
    
  8. or download this
    use strict;
    package Acme::Include;
    ...
    }
    
    1;
    
  9. or download this
    # This is foo.pl
    use strict;
    ...
    include 'bar.pl';
    
    print $lexical;  # Should print: set in bar.pl
    
  10. or download this
    # This is bar.pl
    use strict;
    ...
    
    # There is no "my" here, because that would create a *new* lexical
    # variable, hiding the existing one.
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perltutorial [id://393426]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-03-29 11:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found