This document discusses Perl packages and namespaces. It explains that packages are used to specify namespaces and avoid name collisions. Namespaces isolate variables and functions into separate "compartments". The document then discusses how to create packages using the 'package' function and how package scope works. It also covers using the 'our' keyword to declare variables within a specific package and avoid warnings. The benefits of modularizing code using packages placed in separate files (modules) is discussed. The document provides an example of a simple Toaster module and how to load it into a Perl program. It concludes by covering different ways to add directories to Perl's @INC array to load additional modules, such as using the '-I' command line option, modifying
Doxyfile# doxyfile 1.8.3.1# this file describes the settinronak56
This document contains configuration settings for Doxygen, a documentation system. It specifies project-related values like the project name, number, and logo, as well as build options concerning output format and language. Documentation generation values are set, such as whether to generate separate member pages or inline simple structs in documentation.
The document provides various ways to work with Perl modules from the command line and within Perl scripts. Some of the key points discussed include:
1. Using the perl command with various options like -M, -T, -l, and -w to list installed Perl modules from the command line.
2. Using the ExtUtils::Installed module to get a list of installed modules within a Perl script.
3. Using the perldoc command to view documentation for built-in and installed Perl modules.
4. Configuring the CPAN module to install additional Perl modules from the command line.
5. Checking if a specific module is installed and viewing its version number.
This document provides an example Perl script called count_logins.pl that counts the number of logins for each user on a system by using the 'who' command. The summary explains:
1) The script uses the 'who' command to get user login details and counts the number of logins for each user, storing it in a hash.
2) A getusers subroutine is called that opens a pipe to the 'who' command, loops through the output to count logins for each user, and returns the results in a hash.
3) The script then prints out each user and their number of logins by iterating through the returned hash.
This document is a tutorial on the Perl programming language. It begins with a brief introduction to Perl, describing how it was created and some of its main uses and strengths. The tutorial then covers essential Perl concepts like variables, scalars, arrays, associative arrays, conditionals, and loops. It provides examples and explanations of Perl's syntax for these fundamental programming structures. The focus is on helping readers gain a basic understanding of the Perl language.
The document discusses C preprocessor directives and header files. It provides details on the #include, #define, and #pragma directives. #include is used to include the contents of another file, commonly a header file with a .h extension. Header files contain declarations for types, constants, functions, and extern variables to be shared across files. The #define directive is used for text substitution macros and conditional compilation. Pragma directives provide instructions to the compiler about how code should be compiled.
This document provides an introduction to using PHP with MySQL for beginners. It covers establishing a database connection, selecting a database, querying and manipulating data, and retrieving result rows and field metadata. Common PHP functions for MySQL like mysql_connect(), mysql_query(), mysql_fetch_array() and their usage is explained through examples. It also includes SQL scripts for creating a sample database table and inserting records.
Doxyfile# doxyfile 1.8.3.1# this file describes the settinronak56
This document contains configuration settings for Doxygen, a documentation system. It specifies project-related values like the project name, number, and logo, as well as build options concerning output format and language. Documentation generation values are set, such as whether to generate separate member pages or inline simple structs in documentation.
The document provides various ways to work with Perl modules from the command line and within Perl scripts. Some of the key points discussed include:
1. Using the perl command with various options like -M, -T, -l, and -w to list installed Perl modules from the command line.
2. Using the ExtUtils::Installed module to get a list of installed modules within a Perl script.
3. Using the perldoc command to view documentation for built-in and installed Perl modules.
4. Configuring the CPAN module to install additional Perl modules from the command line.
5. Checking if a specific module is installed and viewing its version number.
This document provides an example Perl script called count_logins.pl that counts the number of logins for each user on a system by using the 'who' command. The summary explains:
1) The script uses the 'who' command to get user login details and counts the number of logins for each user, storing it in a hash.
2) A getusers subroutine is called that opens a pipe to the 'who' command, loops through the output to count logins for each user, and returns the results in a hash.
3) The script then prints out each user and their number of logins by iterating through the returned hash.
This document is a tutorial on the Perl programming language. It begins with a brief introduction to Perl, describing how it was created and some of its main uses and strengths. The tutorial then covers essential Perl concepts like variables, scalars, arrays, associative arrays, conditionals, and loops. It provides examples and explanations of Perl's syntax for these fundamental programming structures. The focus is on helping readers gain a basic understanding of the Perl language.
The document discusses C preprocessor directives and header files. It provides details on the #include, #define, and #pragma directives. #include is used to include the contents of another file, commonly a header file with a .h extension. Header files contain declarations for types, constants, functions, and extern variables to be shared across files. The #define directive is used for text substitution macros and conditional compilation. Pragma directives provide instructions to the compiler about how code should be compiled.
This document provides an introduction to using PHP with MySQL for beginners. It covers establishing a database connection, selecting a database, querying and manipulating data, and retrieving result rows and field metadata. Common PHP functions for MySQL like mysql_connect(), mysql_query(), mysql_fetch_array() and their usage is explained through examples. It also includes SQL scripts for creating a sample database table and inserting records.
Thomas Weinert gave a presentation on PHP 5.3 and 6. Some key updates in PHP 5.3 include improved performance of 5-15%, new extensions like fileinfo and intl, and syntax sugar like __DIR__. PHP 6 is still in development and will include features like upload progress tracking in sessions and full Unicode support. Namespaces were also discussed as a new way to encapsulate classes, functions, and constants.
LAMP stands for Linux, Apache, MySQL, and PHP. Linux is a free open source operating system based on Unix. The document provides syntax and explanations for many Linux commands related to system administration, file management, process management and more. It describes commands for changing directories, copying/moving files, comparing files, installing software, and more.
Reviews the basic of creating a WordPress plugin and some of the things you can do with a plugin. Presentation prepared for the Seacoast WordPress Developers Meetup in NH.
The document provides an overview of PHP (Hypertext Preprocessor), which is a widely used open-source scripting language used for web development. PHP code is executed on the server and generates HTML that is sent to the browser. PHP can connect to databases, collect form data, send/receive cookies, and more. It runs on many platforms and servers and is easy to learn. The document also covers basic PHP syntax, comments, variables, variable scope, and how to use global and static variables.
This project aimed to integrate SFX buttons into the library catalog to provide consistent access to e-resources. It involved collaboration between various library teams and took a long time due to challenges in getting the necessary information to display on catalog pages. The solution involved Aleph fix scripts that extract data from records and pass it to JavaScript, which constructs conditional SFX buttons and URLs. Obstacles included characters in URLs breaking SFX and parser errors, which required workarounds. The project provides a unified way for users to access electronic resources from both on and off campus.
This chapter discusses working with text and numbers in PHP. It covers defining and manipulating strings, including validating, formatting, and changing case. Functions for selecting, replacing, and exploding parts of strings are described. Working with numbers, math operators, variables, and number formatting functions are also summarized. Key string functions include substr(), str_replace(), printf(), and number functions include rand(), round(), pow(), and abs().
make is a basic tool to define pipelines of shell commands.
It is useful if you have many shell scripts and commands, and you want to organize them.
Even if it has been written to automatize the build of compiled language programs, make is also useful in bioinformatics and other fields.
The document provides information about PHP and web development concepts. It discusses:
- PHP is a server-side scripting language used for web development. It was created in 1994 and allows for dynamic content and database integration.
- PHP supports common data types, operators, and control structures like conditional statements and loops to control program flow.
- Variables, cookies, and sessions allow storing and transferring data across web requests. Cookies are stored on the client-side while sessions use server-side storage.
- Advanced PHP concepts include security, performance, and scalability. Object state can be stored in sessions using serialization and unserialization.
This document is a tutorial on makefiles that introduces their purpose for managing complex compilations across multiple source files. It covers topics such as targets, dependencies, macros, naming conventions, phony targets, automatic variables, and default compilation rules. An example makefile is provided to demonstrate these concepts.
Here are some examples of pattern rules:
%.o: %.c
$(CC) -c $< -o $@
frammis cooker: frammis.o cooker.o
$(CC) -o $@ $^
clean:
rm -f *.o frammis cooker
This uses implicit pattern rules to compile .c files to .o, links the objects into the executables frammis and cooker, and defines a clean target to remove the object and executable files. The % wildcard allows make to recognize common filename patterns and apply the appropriate compilation/linking rules.
MySQL is a database management system where data is stored in tables which consist of columns and rows. The document provides instructions on installing MySQL on Linux using RPM files and setting the root password. It also describes some basic MySQL concepts like queries, creating/modifying tables, and joining tables.
The document introduces makefiles and their use in managing complex software projects with multiple files and programmers. It describes that makefiles describe a project's structure and instructions for compiling files. Rules in makefiles specify targets, prerequisites, and recipes to create targets that are older than their prerequisites. The make command uses the makefile to determine what needs to be recompiled and executes the recipes to rebuild targets efficiently.
This document provides information about PHP (Hypertext Preprocessor), including its history, uses, syntax, variables, data types, operators, conditional statements, arrays, loops, functions, and more. Some key points:
- PHP is a widely-used scripting language for building dynamic web pages and applications. It was created in 1995 and runs on web servers.
- PHP code is embedded into HTML files and interpreted by the server before the page is sent to the browser. It allows for the creation of dynamic content.
- PHP is free, runs on most servers, and provides tools for database connectivity, security, and dynamic web page creation. It has advantages over competitors like ASP.
Session held at Drupal MountainCamp 2017, Davos, Switzerland. February 17th 2017
https://drupalmountaincamp.ch/sessions/drupal-8s-multilingual-apis-building-entire-world
Are you interested in writing contributed modules, themes or distributions for Drupal 8? Then this is the session for you. In this session, we'll look at the most important APIs you would use to integrate with and best practices to use to ensure that your project is fully multilingual-ready.
This session will be valuable to all contributors even those whose projects are not inherently multilingual. Even if your project is not immediately intended to be multilingual, having a multilingual-capable module, theme or distribution makes your solution appealing to a much broader audience and is likely to provide value to global users.
Drupal 8 is a great platform to work with not only because it is so multilingual capable out-of-the-box, but also because you can easily expand while maintaining the translatability of your data. Drupal 8’s multilingual core offers a robust multilingual foundation, making the integration process much more seamless.
The majority of Drupal 8's APIs are designed to support multilingual by default and make sane assumptions about common scenarios. As a result, there are several important things to keep in mind to build the best integration possible.
In this session, we will walk through:
Working with language APIs, and the language your data is in.
Making your output strings translatable: t() and its friends, but also in twig templates
Why you should and how to code translatable content entities.
Customizing your field properties translatability so site builders can choose.
Configuration translation: translating your configuration entities
INTENDED AUDIENCE
Drupal developers working with contrib or custom modules that are designed for multilingual or non-English sites would benefit from this session (that means nearly every Drupal developer out there).
Drupal themers intending to make their theme templates translation ready.
Attendees will walk away with knowledge to add Drupal 8 multilingual support to your modules, themes and distributions.
SKILL LEVELS
This session is suitable for beginners or intermediate Drupal users. It is best if you come to the session with some exposure to OOP, Drupal 8 code and twig templates, but even if you don’t have that foundation I’m sure you can catch up.
PHP is a server-side scripting language that allows developers to add dynamic content to websites. PHP code is embedded within HTML and executed on the server before the page is sent to the browser. PHP supports many databases and is free to download and use. It works by processing PHP files, communicating with databases and servers, and delivering HTML pages to the browser.
The document discusses PHP functions for ZIP files, filesystems, and calendars. It provides examples of ZIP functions like zip_open() and zip_read() to open and read ZIP files. Filesystem functions like basename() and is_writable() are described to manipulate system files. Calendar functions like cal_days_in_month() and cal_to_jd() allow working with different calendar formats by converting between Julian dates and calendar representations. Code examples demonstrate using several of these functions.
Perl is an interpreted, general-purpose programming language originally developed for text manipulation and now used widely for a variety of tasks including system administration, web development, and more. It has a small number of basic data types (scalars, arrays, hashes) and supports both procedural and object-oriented programming. Key elements of Perl include its C-style syntax, dynamic typing, and emphasis on practical solutions over purity.
La investigación-acción es un proceso cíclico que articula la teoría con la práctica para lograr un cambio en la sociedad educativa. Tiene como propósito mejorar la práctica educativa a través de la planificación, acción, observación y reflexión. Aunque involucra a todo el sistema educativo, enfrenta desafíos como la resistencia al cambio y falta de recursos.
The document appears to be lyrics for a rap song titled "Tha Total Elimination! Pt.1" composed of multiple verses and choruses discussing various religious and spiritual topics from a perspective of empowerment and righteousness. It promotes living according to God/Allah's will and avoiding negative influences while achieving success and fulfillment.
Criminal class loc's in ultra motion.Pt.3.Pic.docMCDub
The document appears to be lyrics for rap songs that emphasize themes of staying positive and avoiding negative influences. The lyrics are divided into sections with titles like "Aaliphate! Pt.3", "Trully What LORD’S Will... Meanted!", and "Anit No NeedFoe A Ultra Exam!" which are then further divided into verses and choruses. The verses contain lyrics with repetitive lines emphasizing not needing negativity or exams, while staying true to oneself. The choruses also reiterate these themes in a call-and-response format. The overall message conveyed is one of empowerment, spirituality and self-betterment.
Thomas Weinert gave a presentation on PHP 5.3 and 6. Some key updates in PHP 5.3 include improved performance of 5-15%, new extensions like fileinfo and intl, and syntax sugar like __DIR__. PHP 6 is still in development and will include features like upload progress tracking in sessions and full Unicode support. Namespaces were also discussed as a new way to encapsulate classes, functions, and constants.
LAMP stands for Linux, Apache, MySQL, and PHP. Linux is a free open source operating system based on Unix. The document provides syntax and explanations for many Linux commands related to system administration, file management, process management and more. It describes commands for changing directories, copying/moving files, comparing files, installing software, and more.
Reviews the basic of creating a WordPress plugin and some of the things you can do with a plugin. Presentation prepared for the Seacoast WordPress Developers Meetup in NH.
The document provides an overview of PHP (Hypertext Preprocessor), which is a widely used open-source scripting language used for web development. PHP code is executed on the server and generates HTML that is sent to the browser. PHP can connect to databases, collect form data, send/receive cookies, and more. It runs on many platforms and servers and is easy to learn. The document also covers basic PHP syntax, comments, variables, variable scope, and how to use global and static variables.
This project aimed to integrate SFX buttons into the library catalog to provide consistent access to e-resources. It involved collaboration between various library teams and took a long time due to challenges in getting the necessary information to display on catalog pages. The solution involved Aleph fix scripts that extract data from records and pass it to JavaScript, which constructs conditional SFX buttons and URLs. Obstacles included characters in URLs breaking SFX and parser errors, which required workarounds. The project provides a unified way for users to access electronic resources from both on and off campus.
This chapter discusses working with text and numbers in PHP. It covers defining and manipulating strings, including validating, formatting, and changing case. Functions for selecting, replacing, and exploding parts of strings are described. Working with numbers, math operators, variables, and number formatting functions are also summarized. Key string functions include substr(), str_replace(), printf(), and number functions include rand(), round(), pow(), and abs().
make is a basic tool to define pipelines of shell commands.
It is useful if you have many shell scripts and commands, and you want to organize them.
Even if it has been written to automatize the build of compiled language programs, make is also useful in bioinformatics and other fields.
The document provides information about PHP and web development concepts. It discusses:
- PHP is a server-side scripting language used for web development. It was created in 1994 and allows for dynamic content and database integration.
- PHP supports common data types, operators, and control structures like conditional statements and loops to control program flow.
- Variables, cookies, and sessions allow storing and transferring data across web requests. Cookies are stored on the client-side while sessions use server-side storage.
- Advanced PHP concepts include security, performance, and scalability. Object state can be stored in sessions using serialization and unserialization.
This document is a tutorial on makefiles that introduces their purpose for managing complex compilations across multiple source files. It covers topics such as targets, dependencies, macros, naming conventions, phony targets, automatic variables, and default compilation rules. An example makefile is provided to demonstrate these concepts.
Here are some examples of pattern rules:
%.o: %.c
$(CC) -c $< -o $@
frammis cooker: frammis.o cooker.o
$(CC) -o $@ $^
clean:
rm -f *.o frammis cooker
This uses implicit pattern rules to compile .c files to .o, links the objects into the executables frammis and cooker, and defines a clean target to remove the object and executable files. The % wildcard allows make to recognize common filename patterns and apply the appropriate compilation/linking rules.
MySQL is a database management system where data is stored in tables which consist of columns and rows. The document provides instructions on installing MySQL on Linux using RPM files and setting the root password. It also describes some basic MySQL concepts like queries, creating/modifying tables, and joining tables.
The document introduces makefiles and their use in managing complex software projects with multiple files and programmers. It describes that makefiles describe a project's structure and instructions for compiling files. Rules in makefiles specify targets, prerequisites, and recipes to create targets that are older than their prerequisites. The make command uses the makefile to determine what needs to be recompiled and executes the recipes to rebuild targets efficiently.
This document provides information about PHP (Hypertext Preprocessor), including its history, uses, syntax, variables, data types, operators, conditional statements, arrays, loops, functions, and more. Some key points:
- PHP is a widely-used scripting language for building dynamic web pages and applications. It was created in 1995 and runs on web servers.
- PHP code is embedded into HTML files and interpreted by the server before the page is sent to the browser. It allows for the creation of dynamic content.
- PHP is free, runs on most servers, and provides tools for database connectivity, security, and dynamic web page creation. It has advantages over competitors like ASP.
Session held at Drupal MountainCamp 2017, Davos, Switzerland. February 17th 2017
https://drupalmountaincamp.ch/sessions/drupal-8s-multilingual-apis-building-entire-world
Are you interested in writing contributed modules, themes or distributions for Drupal 8? Then this is the session for you. In this session, we'll look at the most important APIs you would use to integrate with and best practices to use to ensure that your project is fully multilingual-ready.
This session will be valuable to all contributors even those whose projects are not inherently multilingual. Even if your project is not immediately intended to be multilingual, having a multilingual-capable module, theme or distribution makes your solution appealing to a much broader audience and is likely to provide value to global users.
Drupal 8 is a great platform to work with not only because it is so multilingual capable out-of-the-box, but also because you can easily expand while maintaining the translatability of your data. Drupal 8’s multilingual core offers a robust multilingual foundation, making the integration process much more seamless.
The majority of Drupal 8's APIs are designed to support multilingual by default and make sane assumptions about common scenarios. As a result, there are several important things to keep in mind to build the best integration possible.
In this session, we will walk through:
Working with language APIs, and the language your data is in.
Making your output strings translatable: t() and its friends, but also in twig templates
Why you should and how to code translatable content entities.
Customizing your field properties translatability so site builders can choose.
Configuration translation: translating your configuration entities
INTENDED AUDIENCE
Drupal developers working with contrib or custom modules that are designed for multilingual or non-English sites would benefit from this session (that means nearly every Drupal developer out there).
Drupal themers intending to make their theme templates translation ready.
Attendees will walk away with knowledge to add Drupal 8 multilingual support to your modules, themes and distributions.
SKILL LEVELS
This session is suitable for beginners or intermediate Drupal users. It is best if you come to the session with some exposure to OOP, Drupal 8 code and twig templates, but even if you don’t have that foundation I’m sure you can catch up.
PHP is a server-side scripting language that allows developers to add dynamic content to websites. PHP code is embedded within HTML and executed on the server before the page is sent to the browser. PHP supports many databases and is free to download and use. It works by processing PHP files, communicating with databases and servers, and delivering HTML pages to the browser.
The document discusses PHP functions for ZIP files, filesystems, and calendars. It provides examples of ZIP functions like zip_open() and zip_read() to open and read ZIP files. Filesystem functions like basename() and is_writable() are described to manipulate system files. Calendar functions like cal_days_in_month() and cal_to_jd() allow working with different calendar formats by converting between Julian dates and calendar representations. Code examples demonstrate using several of these functions.
Perl is an interpreted, general-purpose programming language originally developed for text manipulation and now used widely for a variety of tasks including system administration, web development, and more. It has a small number of basic data types (scalars, arrays, hashes) and supports both procedural and object-oriented programming. Key elements of Perl include its C-style syntax, dynamic typing, and emphasis on practical solutions over purity.
La investigación-acción es un proceso cíclico que articula la teoría con la práctica para lograr un cambio en la sociedad educativa. Tiene como propósito mejorar la práctica educativa a través de la planificación, acción, observación y reflexión. Aunque involucra a todo el sistema educativo, enfrenta desafíos como la resistencia al cambio y falta de recursos.
The document appears to be lyrics for a rap song titled "Tha Total Elimination! Pt.1" composed of multiple verses and choruses discussing various religious and spiritual topics from a perspective of empowerment and righteousness. It promotes living according to God/Allah's will and avoiding negative influences while achieving success and fulfillment.
Criminal class loc's in ultra motion.Pt.3.Pic.docMCDub
The document appears to be lyrics for rap songs that emphasize themes of staying positive and avoiding negative influences. The lyrics are divided into sections with titles like "Aaliphate! Pt.3", "Trully What LORD’S Will... Meanted!", and "Anit No NeedFoe A Ultra Exam!" which are then further divided into verses and choruses. The verses contain lyrics with repetitive lines emphasizing not needing negativity or exams, while staying true to oneself. The choruses also reiterate these themes in a call-and-response format. The overall message conveyed is one of empowerment, spirituality and self-betterment.
This document appears to be lyrics to songs from an album called "Tha Price Of War! Pt.3". The lyrics discuss themes of not needing negativity, flaws, weakness or dishonesty. They emphasize being strong, positive and true to oneself. The lyrics are broken into sections for different songs/tracks on the album.
Vijaya Maley has over 4.5 years of experience in IT recruitment, including 3 years experience managing the full recruitment lifecycle. She is currently a Senior IT Recruiter at Beta Bulls Technologies, where she sources candidates through job portals, social networks, and references for clients such as NTT Data, TCS, UST Global and Oracle. Previously, she has worked as an IT Recruiter for People Frame IT, Wisdom IT Services, and Prime Hospitals. She holds an MBA from Andhra University and is proficient in MS Office applications and computer fundamentals.
The National Film and Television School (NFTS) needed a way to securely deliver thousands of hours of video content to students and studios. It installed MediaTank, Skylab's online video platform, which could host hundreds of thousands of hours of secured footage. MediaTank provided password protected channels, integration with social media platforms, and encoding that allowed playback on all devices. The Director of NFTS said MediaTank offered flexibility and could scale to host their growing collection of film footage.
This 3 sentence summary provides the essential information about the document:
The document outlines a 3 mile walking tour of locations significant to the life of Scottish scientist James Clerk Maxwell in Edinburgh, Scotland. The tour includes his birthplace, the homes of relatives he lived with, his school Edinburgh Academy, the university he attended, and churches he was affiliated with. Detailed directions and coordinates are provided for each of the 12 stops on the route, with background information about Maxwell's connections to each location.
The document discusses the challenge of developing an employer brand for HCA (Hospital Corporation of America), which owns several well-known London hospitals but has a less recognizable corporate brand itself. To solve this, the agency conducted research including reviewing materials, holding workshops, and consulting management to understand how staff currently view the organization. This informed a detailed brand strategy establishing the identity, communication, launch, and management of the new employer brand. The strategy was then realized through various creative materials and channels.
Kiểm soát tình hình kinh doanh mọi lúc mọi nơi
Nắm bắt tức thời doanh thu, lãi lỗ, tồn kho, thu & chi...
Không cần cài đặt, dữ liệu an toàn tuyệt đối
Hoạt động trên : Máy tính, Iphone, Ipad, Android...
www.banhang365.com
Hasselblad wanted to engage its global network of photographers so it commissioned Skylab to develop an online video platform called Hasselblad TV. Skylab created over 240 films from Hasselblad's exclusive archive and educational content to populate the multi-lingual platform. The platform saw extremely high traffic from over 4,000 cities in 140+ countries in its first couple days, dramatically impacting Hasselblad's engagement with photographers worldwide.
Sitting at a computer for long periods can cause neck, shoulder, and lower back stiffness or pain. This document provides a 5-minute stretching routine to help alleviate these issues. The routine involves 12 stretches targeting the neck, shoulders, back, arms, and legs that should be done once or twice a day or whenever stiffness is felt. Following the stretches, the document states you will feel better.
4260 CIMA Thinking the Unthinkable web bChris Langdon
This interim report analyzes the new vulnerabilities facing executive leadership in both corporations and public services due to the increasing rate and impact of "unthinkable" events. Through interviews with 60 current and former leaders, the report found that leaders often feel overwhelmed by constant crises and changes in the digital age. While signs of potential crises existed, leaders tended to ignore or deny them due to a reluctance to consider unpalatable possibilities. The accelerating pace of change outpaces the ability of organizations and leaders to adapt. The report raises concerns about leaders' capacity to anticipate and address complex global problems and calls for new strategic thinking to strengthen leadership resilience.
Este documento describe los orígenes y antecedentes históricos de la teoría de la administración. Explica las principales funciones de la administración como la planificación, organización, dirección y control. También resume varias teorías clave sobre la administración como la jerarquía de necesidades de Maslow, la teoría de los dos factores de Herzberg, y las teorías X y Y de McGregor. Además, menciona teorías como la teoría del desarrollo organizacional, la teoría de las organizaciones de March y
Hermindo nasceu e mora em Anápolis, Goiás. Ele gosta de ensinar e seu ponto forte como professor é ajudar os alunos, embora fale demais às vezes. Os maiores segredos para uma vida feliz para ele são ter saúde e estar cercado por pessoas queridas.
This document discusses how computer technology has impacted work and labor markets in developed countries. It begins by outlining the rapid improvements in computing power and declining costs predicted by Moore's Law. While some argue this heralds a "Second Machine Age" that could automate many jobs and lead to widespread unemployment, others believe technological change is slowing. The document then examines lessons from history on how technological developments have affected employment, finding that overall employment is relatively unchanged as jobs shift between sectors. Computers are shown to contribute more to rising inequality by replacing routine tasks and polarizing the job market. The main policy challenges are changing skill demands and inequality, not mass unemployment.
1. The document appears to be lyrics from a rap album titled "Murad Camarad Wysinger C.D.Pt.1" written by Murad Camarad Wysinger and others.
2. The lyrics contain many repetitions of phrases like "Anit no need foe" and references to being Aztexcian, Egyptian, staying hardcore, and ruling the afterlife.
3. The album contains multiple songs or tracks including "Title!", "Miss Me! Pt.1", "Season!", and "Nurose-Chaos! Pt.1" that continue in a similar style across the lengthy document.
La andragogía se refiere a la educación y aprendizaje de adultos y se basa en principios como la horizontalidad y participación. Se diferencia de la pedagogía, la cual se enfoca en la enseñanza de niños y está basada en una relación vertical entre el estudiante y el maestro. Mientras que la andragogía ha sido aplicada con éxito recientemente en la Escuela Superior de las Fuerzas Armadas del Perú, promoviendo una interacción más dinámica.
Kinross Gold Corporation presented at the BMO Capital Markets Global Metals & Mining Conference on February 28 - March 2, 2016. Kinross delivered strong operational performance in 2015, meeting or exceeding production guidance and coming in at the low end of cost guidance. For 2016, Kinross expects gold equivalent production of 2.7-2.9 million ounces at a cost of sales of $675-735 per ounce and all-in sustaining costs of $890-990 per ounce. Kinross has organic growth opportunities from projects such as La Coipa and exploration at Bald Mountain, as well as a diversified portfolio of operating mines globally.
The document is about health and contains two parts of a song called "The Price of Health". The song discusses trying to get help and avoid getting unhelp, doing things for oneself, and having wealth. It says that these things are called "the price of health".
This document discusses advanced Perl concepts including finer points of looping, using pack and unpack, working with files and directories, eval, data structures, packages, modules, objects, and interfacing with the operating system. It provides examples and explanations of continue blocks, multiple loop variables, subroutine prototypes, determining calling context, packing and unpacking data, opening, reading and writing files, getting file information, working with directories, using eval, defining arrays of arrays, packages, modules, BEGIN and END blocks, and the basics of defining objects and classes in Perl.
Perl is a programming language that was originally released in 1987. It has become widely used for tasks like CGI scripting, databases, and XML processing. Perl is known as a "glue language" because it can interact with many popular applications.
The Comprehensive Perl Archive Network (CPAN) provides a comprehensive library of Perl extension modules, similar to frameworks like J2EE and .NET. CPAN has helped Perl integrate with other languages like C, C++, and Java.
Perl's strength comes from its active user community which maintains resources like CPAN, documentation sites, and local user groups. Perl powers many popular websites and is often called the "duct tape of the Internet" due to its
This document discusses user-defined functions in Perl. It provides examples of how to declare functions using the 'sub' keyword, pass parameters to functions, and set default parameters. It also covers calling functions, returning values from functions, and variable scope within functions. The examples show how functions can be used to split code into reusable pieces and pass data between different parts of a program.
This document provides an introduction to basic Perl programming. It begins with a simple "Hello World" program and explains each line of code. It then discusses running and debugging programs, scalar variables, arithmetic operations, string interpolation, array variables, and basic file handling in Perl. The key topics covered are printing output, assigning variables, accessing array elements, and opening/reading/closing files.
The document discusses several topics related to Perl including file handling, opening and reading files, writing files, closing files, the eval function, error handling with eval, packages, modules, object oriented programming in Perl, interfacing with the operating system, and creating internet applications. Some key points include how to open, read, and write files in Perl; using eval to trap errors; how packages create namespaces to prevent naming collisions; the structure of modules; the basic concepts of objects, classes, and methods in OOP; and how Internetware systems can adapt to dynamic environments like the internet.
This document provides instructions for encapsulating dynamic libraries (dylibs) within a framework in Xcode and ensuring the framework and any applications using the framework can locate the embedded dylibs. Key steps include copying dylibs into the framework, using install_name_tool to change library search paths, adding run scripts to apply changes on build, and configuring framework and application build settings to locate embedded libraries.
A book for learning puppet by real example and by building code. Second chapters takes you through all basics of Puppet and enough ruby to work with Puppet.
java notes, object oriented programming using java, java tutorial, lecture notes, java programming notes, java example programs, java programs with explanation, java source code with output, java programs, java coding, java codes, java slides, java notes,packages in java, java packages notes, java packages notes,different types of packages in Java,packages with an example, packages in Java
The document discusses hashes in Perl programming. It explains that hashes allow the storage of key-value pairs and do not maintain order. It provides examples of creating a hash, accessing values using keys, and iterating through keys and values. It also discusses using hashes to store the genetic code and amino acid translations.
The document provides an introduction to the Bund programming language. Some key features of Bund include:
- It is a simple, stack-based functional language tightly integrated with Python
- Functions are first-class citizens
- Namespaces provide scoping instead of modules
- Support for delayed execution, reverse and direct stack coding, partial application, code as data, and dynamic code generation
- The author created Bund to experiment with PEG parsers and teach himself new tricks as an experienced programmer
The document provides a summary of the most common code changes needed when migrating Puppet code from version 3 to version 4. It outlines several key differences including:
1) Numbers being treated as numbers rather than strings, requiring file modes to be quoted.
2) Only undefined and false being treated as false, not empty strings.
3) Variable names needing to start with lowercase letters.
4) Other minor changes like hyphens not being allowed in class names and ERB variables requiring @ prefixes.
The document recommends using tools like puppet parser validate, puppet-lint, catalog_diff and catalog_preview to automatically check for issues when migrating code to Puppet 4. Overall,
Managing Perl Installations: A SysAdmin's ViewBaden Hughes
This document discusses managing Perl installations from a system administrator's perspective. It outlines various tools that come with Perl to help administrators manage modules, including which modules are installed (perldoc, ExtUtils::Installed, pmtools), installing and removing modules (CPAN.pm, PPM), and creating bundles of modules. It also describes how users can install modules to their own spaces using alternative module locations, PERL5LIB, and a customized CPAN configuration via MyConfig.pm. The goal is to empower users while reducing the administrative overhead for system administrators.
Packages in Java prevent naming conflicts, control access to classes, and make classes easier to locate and use. A package is a grouping of related classes and interfaces that provides namespace management and access protection. Common Java packages include java.lang for core classes and java.io for input/output classes. Programmers can define their own packages to organize related classes. The package name becomes part of the class name and the package directory structure must match the class file locations.
This document provides an overview and steps for a Perl/CGI tutorial. The tutorial will solve the problem of extracting data passed to a program through the Common Gateway Interface (CGI) and constructing an HTML response.
The tutorial assumes familiarity with UNIX but no Perl experience. It breaks the problem down into steps including setting up the Perl framework, printing "Hello World", adding CGI headers, and printing the response in HTML. Later steps demonstrate accessing environment variables passed from the server and data passed through STDIN.
This document provides an overview and steps for a Perl/CGI tutorial. The tutorial will solve the problem of extracting data passed to a program through the Common Gateway Interface (CGI) and constructing an HTML response.
The tutorial assumes familiarity with UNIX but no prior Perl experience. It breaks the problem down into 7 steps: 1) Perl framework and mechanics, 2) Hello World, 3) Hello World from CGI, 4) Hello World in HTML, 5) Echo environment variables, 6) Echo STDIN variables, 7) Perl library. Each step builds on the previous to introduce Perl concepts and features needed to accomplish the task of passing data between a web server and client.
Functions allow programmers to organize and reuse code. Defining a function involves using the def keyword followed by the function name and parameters. Functions create a new local scope, and variables are searched in local, then global, then built-in scopes. Arguments passed to functions are assigned to parameter variables in the local scope. Functions can return values, and mutable objects like lists can be modified in-place by functions. Python also supports anonymous lambda functions defined with a single expression.
Perl is an interpreted programming language used for text processing and web development. It allows for both procedural and object-oriented programming. Perl is efficient for system administration tasks and manipulating text, but efficiency is not a primary focus as interpretation allows for quicker development and changes compared to compiled languages. Perl can be run on many platforms and includes features like database integration, support for HTML/XML, Unicode, and large libraries of third-party modules.
This document provides an overview of aspect-oriented programming (AOP) in Perl using the Aspect.pm module. It defines key AOP terminology like join points, pointcuts, advice, and aspects. It describes the features of Aspect.pm like creating pointcuts with strings, regexes, or code references to select subroutines, and writing before, after, and around advice. Examples show creating reusable aspects for logging, profiling, and enforcing design patterns.
The document provides guidance on packaging applications for the Maemo platform. It discusses finding software to package, creating the initial package files and structure using dh_make, the necessary files like changelog, copyright and control, how debhelper automates common packaging tasks, tracking dependencies, and other tools that can help like pbuilder and cowbuilder. While Maemo uses Debian packaging tools, it is not Debian and has its own build systems and conventions that allow it to innovate independently from Debian.
1. In Perl parlance a ‘package’ is a way of
specifying a namespace, before we
examine the syntax of a package let’s
look at what a namespace is and the
benefits they can provide.
A rose by any other name
In essence a namespace is used to isolate
variables and functions into separate
“compartments” to help avoid name-
space pollution and collision.
Within a program all of the functions
and variables (including filehandles) are
from the ‘main’ package, to determine
which package the currently executing
code is in Perl provides the
‘__PACKAGE__’ constant:
print "Current package is: '";
print __PACKAGE__, "'n";
The ‘__PACKAGE__’ constant cannot be
placed within a double quoted string and
still be interpolated, by including it in
double quotes the literal value is
returned instead.
Creating a new package by using the
‘package’ function with the name of the
package you wish to create (Listing 1). A
package’s scope is terminated by the end
of the file, exiting the block the package
was declared in or declaring another
package afterward, as
shown in Listing 2.
Using a namespace
we can reuse variable
names in each package
using the ‘our’ key-
word to declare the
variables to exist with
a specific value within
a package (Listing 3).
This code will
compile and run but
give warnings.
Modules – Scratching Itches
Now you have been introduced to how
packages work you may be wishing you
had stopped reading at the copy and
paste coding section. Now that you have
seen the cost of code re-use the right way
we can introduce you to the benefits,
namely building modules.
A module is quite simply a package
placed in a separate file, where the file
name is the same as the package name
with a ‘.pm’ suffix so that Perl readily
recognizes the file as a “Perl Module”.
The code below is from a file called
Toaster.pm:
#this should be placed in
#a file called Toaster.pm
package Toaster;
our $VERSION = 1.00;
my $num_slots = 2;
my $toasting_time = 10;
sub roast_toast {
sleep $toasting_time;
print "Toast is donen";
return 0;
}
1;
The first line of a module IS ALWAYS the
package declaration, ensure the case of
the name matches the file-name. The
62 Dec 02 / Jan 03 www.linux-magazine.com
O
nce your code begins to grow
beyond a small script and into
large applications you will often
need to re-use small snippets, functions
or even collections of functions that you
have written in new applications. There
are two main ways you can set about
this re-use:
• copy and paste
• code abstraction
Unlike most choices in Perl there is only
one sensible way to do it.
Copy and pasting code may seem like
a quick and easy way to reproduce the
functionality you need but it has a
number of drawbacks that far out-weigh
any temporary time-savings.
The greatest of these issues is bug-
fixing, if you find a bug (and it WILL
happen) in a piece of code you have
manually copied and pasted into
multiple files then you will have to track
down each and every occurrence of the
code (Potentially even in files on
different machines so a simple find and
replace will not make the task any less
arduous for you) and make the change
numerous times.
You will also find that you frequently
make small incremental adjustments
to the code to make it fit better to the
task, so any enhancements will have
to be copied too. If just one instance
of the code is overlooked, then there are
different solutions to the same problem.
Fixing a bug in this manner will cost you
far more than any time you saved by
adopting this approach. Are you sure
you fixed that bug everywhere?
Now that we have covered the worst
way of implementing code re-use let’s
explain the principles behind the
preferred methods, packages and
modules. The commonly adopted
approach to code reuse is to write
functions and put them into a file in an
accessible location. The functions within
a file should be logically grouped
together by purpose. Functions whose
tasks have a similar theme are usually
placed in the same file.
To fit in with the festive season this month we are going to look at presents,
well packages to be exact but you can still think of them as little bundles of
coding joy.BY DEAN WILSON AND FRANK BOOTH
Thinking In Line Noise
Pre-wrapped Packages
Perl Tutorial: Part 7PROGRAMMING
#in the default package
print "Current package is '", __PACKAGE__, "'n";
package Huey;
print "In package ", __PACKAGE__, "'n";
package Louey;
print "In package ", __PACKAGE__, "'n";
package Dewey;
print "In package ", __PACKAGE__, "'n";
package main;
print "In package ", __PACKAGE__, "'n";
Listing 1: __PACKAGE__
2. module name should begin with an
uppercase letter, as a rule only pragmas
begin with a lowercase letter.
In the Toaster module we declare two
variables and a function. If you’re
wondering what the ‘1;‘ line at the end
of the code block is there for (in a real
module this would be at the end of the
file), it is required as all Perl modules
must evaluate to ‘true’ when they’re
compiled.
Although the value of the last evalu-
ated expression in the module would be
returned this is not guaranteed to evalu-
ate to ‘true’ as we can see by the
function ‘roast_toast’ returning ‘0’ so for
clarity and simplicity we explicitly return
‘1’ to ensure a correct compile and load.
Loading the Toaster
We now need to actually load the
module into our perl program when we
run the application so we can access the
functionality it provides.
Perl tracks the modules it has available
for use by storing a list of paths as a list
within which it looks for ‘.pm’ files. This
list is known as ‘@INC’ and is available
within perl itself for modification. Before
we move on to showing you how to add
your own directories let’s show two
possible ways to display the default
value of ‘@INC’.
The first way to do this is by allowing
Perl itself to do the work and show us
where it searches:
perl -V
You will then be shown a number of
details that describe many of the options
that this Perl interpreter was compiled
with. Underneath those details you will
find a section that resembles:
/usr/lib/perl5/5.6.0/i386-linux
/usr/lib/perl5/5.6.0
/usr/lib/perl5/site_perl/5.6.0/U
i386-linux
/usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl
This information shows the default
locations that perl will search when you
have a ‘use’ statement in your code.
Two items of interest are that many
of the site directories have the version
number contained within them allowing
many versions of Perl to live happily on
the same machine while still allowing
easy identification of which version the
modules belong to.
The machine this was written on has
five versions for backwards compatibility
testing. The second item of interest is
that the current directory ‘.’ is included
by default.
The second way to show the searched
directories by using actual Perl code,
from the command line you can issue:
perl U
-we 'print map {
"$_n" } @INC;'
To generate a list of the default
directories that are printed to screen in
this format:
/usr/lib/perl5/5.6.0/i386-linux
/usr/lib/perl5/5.6.0
/usr/lib/perl5/site_perl/5.6.0/U
i386-linux
/usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl
Recognize the directories it returns? This
is the same information that the Perl
interpreter itself told us about but the list
is available from within Perl itself.
Now we have provided a number
of different techniques
to retrieve and display
the current and default
values of ‘@INC’ we
will move on and step
though the list of ways
to coerce Perl into
looking in additional
locations for additional
modules including:
• ‘-I’ command line
switch
• Modifying @INC in
a BEGIN block
• ‘use lib’ pragma
The ‘-I’ method can
be a very long-winded
way of specifying
additional directories
and suffers from an
important drawback:
You have to remember
to add it with every
invocation of the
program.
# nvoke 'buildscript with
# build/directory added to @INC
perl -I build/directory U
buildscript.pl
In the above example of ‘-I’ we add the
‘build/directory/‘ to the ‘@INC’ list of
the ‘buildscript.pl’ script. Where ‘-I’
comes into its element is when used in
quick prototyping of very small projects,
however once your requirements grow to
the level where you need to specify
multiple additional include directories
you will begin to see the use of ‘-I’ as a
limiting factor to how far your project
can scale. We have not yet covered Perl’s
special blocks such as BEGIN or END in
this article but it is worth mentioning
this technique at this stage as a refer-
ence, although it is an oversimplification
at a basic level if you have a BEGIN
block in your code then its contents will
be executed before anything else in the
application is, including module loading.
# notice this should be executed
# first as it is before the
# BEGIN block
print "Normal Hellon";
BEGIN {
# this sections runs first
print "I'm run firstn";
}
63www.linux-magazine.com Dec 02 / Jan 03
PROGRAMMINGPerl Tutorial: Part 7
#in the default package
print "Current package is '", __PACKAGE__, "'n";
# Exiting the block the
# package was declared in
{
package Larry;
print "In package ", __PACKAGE__, "'n";
}
# Back to main package
print "In package ", __PACKAGE__, "'n";
# Closing a package by
# declaring a new package
package Moe;
print "In package ", __PACKAGE__, "'n";
# in this case the new
# package is main again.
package main;
print "In package ", __PACKAGE__, "'n";
# Package terminated by
# end of file.
package Curly;
print "In package ", __PACKAGE__, "'n";
Listing 2: Exiting the block
3. BEGIN block is inside
the Perl application it
is possible to use Perl
functions to alter the
values in ‘@INC’ and
so dynamically build-
ing a list of directories
is made simple with
very little additional
code or complexity
required.
The last of the more
common approaches
is using a pragma
known as ‘use lib’ to
specify the desired
additions. Using this
method is actually one of the simpler
ways of specifying new paths, it’s as sim-
ple as adding a call to the pragma at the
top of your program:
# !/usr/bin/perl -w
use strict;
use lib("/home/dwilson", U
"/home/wanttogo");
use CustomModule;
print "In main bodyn";
print "=" x 25, "n";
print join("n", @INC);
When this code snippet is run the two
additional directories are added to
‘@INC’ and then made available to the
rest of the program. If you ‘use’ modules
like this then you should always specify
the name of the module in a ‘use’ state-
ment AFTER the ‘use lib’ otherwise you
will get run-time errors, as shown in
Listing 4.
Although we did not define our own
BEGIN block in this code the module
loading is still done at this phase and the
error is caught before we go on any fur-
ther. The ease of use provided by ‘use
lib’ is significant and has a very low
learning curve that allows it to be used
in most of the cases where you would
want to add additional paths, once you
find yourself needing more flexibility
than this you will often have to resort
back to using BEGIN blocks with all the
power they provide, albeit at the cost of
greater complexity.
Invoking the mighty toaster
After wading through the coverage of
how to create your own packaged name-
space and then reading the details
surrounding the loading of modules you
are probably getting the itch to test your
new found knowledge with some
concrete code examples.
The examples throughout the rest
of this section assume that you have
the “Toaster” module in one of the
locations specified in ‘@INC’ so if
you have skipped past the previous
text you are going to be unable to
progress until you have gone back and
read it all.
You can test that you can access
“Toaster” correctly by running:
perl -MToaster -e 'print U
$Toaster::VERSION, "n";'
This should return ‘1’, if you see “Can’t
locate Toaster.pm in @INC” then the
module is not in the ‘@INC’ path and
you need to amend your configuration as
per the instructions given above ( in the
“Loading the Toaster” section ) before
64 Dec 02 / Jan 03 www.linux-magazine.com
As you would expect, it has a
corresponding END block. The code
contained within the block is ALWAYS
run just before the program finishes its
own execution.
print "running happily in ";
print __PACKAGE__, "n";
END {
print "exiting at ";
print scalar localtime();
print "n";'
}
Although we will delay the detailed look
at the full range of functionality these
two block types provide the more com-
mon uses of these blocks make sense
even without knowing all their intimate
details, END blocks are ideal places to
put clean up or summary code and
BEGIN blocks are a perfect place to alter
‘@INC’ as shown below:
# !/usr/bin/perl -w
use warnings;
use strict;
# this is our module
use CustomModule;
BEGIN {
# this will be executed before
# the rest of the code
unshift(@INC, "/home/dwilson");
}
print "In main bodyn";
print "=" x 25, "n";
print join("n", @INC);
We use the BEGIN block to place another
directory at the start of the ‘@INC’ array
( array index zero ) pushing the other
directories one position back. We do this
so that our additional directory is the
first one that is checked for the module.
The execution then moves back to the
top of the file and begins running the
code in its usual order and includes the
“CustomModule” before moving on to
the print statements. If you run this code
you will get a list of the directories in
‘@INC’ including our additional one, the
change we made is still effective.
Adding additional paths like this via
the BEGIN block is a common practice
when you either have a large number of
custom paths you wish to have included
or when you want to actually do
conditional inclusion of modules. As the
Perl Tutorial: Part 7PROGRAMMING
Can't locate NotExist.pm in @INC (@INC contains: /home/dwilson
/home/wanttogo /usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0
/usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl .) at module_error.pl line 5.
BEGIN failed--compilation aborted at begin_module.pl line 5.
Listing 4: Runtime errors
use warnings;
use strict;
our $fred = 'blah';
print "Current package is '", __PACKAGE__, "'n";
package Huey;
print "In package ", __PACKAGE__, "'n";
our $fred;
package Louey;
print "In package ", __PACKAGE__, "'n";
our $fred;
package Dewey;
print "In package ", __PACKAGE__, "'n";
our $fred;
Listing 3: Reusing variable names
4. you can run the code samples. If we
want to use the ‘roast_toast’ function at
the moment we need to qualify the call
with its full package name:
Toaster::roast_toast();
Although using the full package name as
a prefix to all external calls may seem
like just an inconvenience at the moment
once you begin to use multiple modules
with long names it will begin to have an
effect on the clarity of your code.
Another important reason to avoid using
this approach is with data access, or
encapsulation as it is often known as.
At the moment we can reach in and
change the value of any variable that we
like with no regard toward the internal
structure of the module, as an example
of this if we look at the ‘$toasting_time’
variable we can see that it is numeric
and is used internally in the module.
Look at the consequences of making a
change like this:
use Toaster;
$Toaster::toasting_time = U
"Thirty Seconds";
Toaster::roast_toast();
If we run without warnings with code
like this we will see strange behaviour as
Perl converts ‘$toasting_time’ into a
number from a string when ‘roast_toast’
uses it and the sleep time will become
erratic.
Instead of this direct action we should
use the functions provided to manipulate
any required variables, a practice called
data encapsulation, that is one of the
tenets of Object Orientated development
and a good design decision even in pro-
cedural code like ours.
By encapsulating data we protect our-
selves from tying our code too tightly
with the module’s own functions, all we
want to do is ‘roast_toast’, we do not
care if the time taken changes, we simply
want the action to be performed, in a
robust design the implementation should
be hidden to us.
We can address both of the above
concerns by using a feature of Perl’s
module system called ‘Exporter’. The
Exporter module allows module writers
to specify a list of the variables and
functions that they wish to expose to the
calling application so that they are
loaded into the current namespace. In
the example below we add some
additional Exporter related code to show
how little is needed before we start to
see the benefits:
#revised Toaster module
use strict;
use warnings;
package Toaster;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = U
qw($num_slots roast_toast);
our $VERSION = 1.50;
my $num_slots = 2;
my $toasting_time = 10;
sub roast_toast {
sleep $toasting_time;
print "Toast is donen";
return 0;
}
1;
The newly revised Toaster module ( with
free set of knives ) required just three
new lines included to take advantage of
these benefits, before we detail those
lines here is a small sample script that
can use the module:
use Toaster;
roast_toast();
This is an extremely simple example of
how all the explicit declarations can be
removed to cut down on the amount of
line noise in the code while retaining the
full functionality. If we try to change the
‘$toasting_time’ with the first example
below it fails:
use Toaster;
$toasting_time = 23;
The error we receive is “Global symbol
‘$toasting_time’ requires explicit
package name” due to no variable called
‘$toasting_time’ being present in the
‘main’ package and Toaster not
exporting its own ‘$toasting_time’. While
we can still modify the variable the same
way we did in previous examples using a
fully qualified package name this is
willfully ignoring the module writer’s
wishes and becomes more a case of
coder beware.
If the module author changes the way
the module is implemented ( which is
allowed as long as the public functions
are left alone ) then your code could
break and you would have no recourse.
There is probably a very good reason
why the module author did not expose
those variables and finding out why
could be painful.
Going back to our revised version of
the Toaster module we first pull in the
‘Exporter’ module and we then assign
Exporter to ‘@ISA’, this allows your
module to ‘inherit’ functionality from
the Exporter module. Inheritance is a
topic more related to object orientated
programming so we will gloss over the
details, for now just think of these two
lines as the code that enables your
module to export symbols.
The @EXPORT line controls which
functions and variables are to be
exported by default. Any entries in this
array will be exported to the calling
namespace when this module is ‘use’d.
If the caller only wants to pull out a
single function from your module and
keep the memory footprint of her own
application down then it is possible to
amend the ‘use Toaster;‘ code so that the
module only exports what is desired:
use Toaster qw(roast_toast);
This code sample will only import the
‘roast_toast’ function, if you now try and
modify the ‘$num_slots’ variable that
the module has in its ‘@EXPORT’ array
then you will get an error as it is no
longer available in this package.
use Toaster qw(roast_toast);
#this works
roast_toast();
#this fails with an error
$num_slots = 23;
Now we have covered the basic rules
and functionality of Exporting from one
module into an application, let’s look at
a slightly more complex scenario. If a
module has a basic level of functionality
that it always wants to provide, but it
also has some niche functions that are
only useful in specialized applications
but require too much memory to export
by default, rather than forcing the caller
to use fully qualified package names
65www.linux-magazine.com Dec 02 / Jan 03
PROGRAMMINGPerl Tutorial: Part 7
5. show you that the entry barrier is not as
high as it might seem we now move on
to one of the best examples of code reuse
on the Internet, CPAN.
Getting Modules
While Perl can stand feature for feature
with other modern programming
languages its true ‘killer app’ may be
CPAN (http://www.cpan.org), the
Comprehensive Perl Archive Network, a
large online repository of modules built
by the Perl community.
The modules in CPAN are themselves
good examples of why extra effort is
required to build a generic module .
However the effort is its own reward,
CPAN’s stock of code mostly originates
from coders “scratching their own itch”
and donating the code back to the
community to save other people from
reinventing the wheel. CPAN is one of
the more successful examples of the
“Cathedral” development methodology
whereby a pool of developers raise the
standard of the code base.
Once an author is registered on CPAN
they can begin the process of uploading
modules. Before a module can be
uploaded the name and purpose of the
module has to be announced to
‘modules@perl.org’ where the hard
working volunteers ensure there are no
duplications with existing work and the
module uses an appropriate namespace.
Once the module details have been
accepted the module is uploaded to the
server where it comes under the scrutiny
of the Perl QA Smoke testers.
The smoke testers are another group
of volunteers that donate processing
time on a variety of operating systems
and architectures, using batched scripts
new arrivals and updates on CPAN are
tested and the results are posted back to
CPAN showing which platforms the
module ran on. Finally the module is
propagated though the CPAN mirrors
until it becomes fully available every-
where.
Retrieving a Perl module can be done
in a number of ways:
• CPAN
• CPAN++
• manual install
• PPM
• Native package installer (apt-get, rpm
or similar)
The example given below shows the
typical install procedure for a module
that is being installed manually and then
we introduce you to the cpan shell that is
made available by the CPAN.pm module.
We will not be covering the other
methods of installation as they are not as
universally available.
Once the module’s ‘.tar.gz’ file is
downloaded from one of CPAN’s module
pages the following steps should be
taken to install it:
# extract module
$ tar -zxvf U
<modulename>-<version>.tar.gz
$ cd <modulename>-<version>
$ perl Makefile.PL
$ make
$ make test
$ make install
Stepping through the above example we
unpack the module and then change in
to its directory. Running ‘perl
Makefile.pl’ causes perl to generate a
Makefile for the module filling in many
of the required details with the
information Perl discovered about the
system when it was built and installed.
To show how much work this saves
consider that a Makefile.pl of 25 lines is
expanded to a ready for use Makefile of
over seven hundred lines.
We then run a ‘make’ to do any
building required for a module before
running the modules test harness with
‘make test’. Not all modules have a set of
tests to run. The Perl QA effort has
progressed to the point where all the
core modules have a test harness.
Although not having tests should
not stop you from using a module
their presence indicates a conscientious
author and an indication of robust code,
providing all the tests pass…
We then run ‘make install’ to perform
the work of installing the module in one
of the paths which Perl searches for its
libraries. An important often overlooked
detail is that this is the only step of
installing modules that actually requires
you to be root: all of the other stages can
be executed as an unprivileged user.
The extra privileges are needed
because it writes to directories that most
people will not have access to. Now that
you have seen the procedure for
66 Dec 02 / Jan 03 www.linux-magazine.com
and break some of the laws of good
design Exporter allows a second array to
be populated. This array is called
‘@EXPORT_OK’ and only exports what
the caller requests.
package Kettle;
require Exporter;
use strict;
use warnings;
our @ISA = qw(Exporter);
our @EXPORT = qw(boil);
our @EXPORT_OK = qw(whistle);
our $VERSION = 1.00;
my $boil_time = 2;
my $pints_held = 4;
sub boil {
print "Kettle has been $$
boiled...n";
}
sub whistle {
print "Whhhhhhheeeeeeeeen";
}
1;
The package above shows a very simple
implementation of a Kettle that has the
essential kettle function, ‘boil’ while also
providing the seldom requested ‘whistle’.
If we just ‘use Kettle’ then we only get
‘boil’ as that is the only element in the
‘@EXPORT’ array and if we explicitly
ask for ‘whistle’ with the ‘use Kettle
qw(whistle)‘ then we lose the ability to
‘boil’. To solve this problem Perl allows
you to ask for the entire ‘@EXPORT’
array and then any additional functions
that you would like:
use Kettle qw(:DEFAULT whistle);
boil();
whistle();
By using the special ‘:DEFAULT’ label to
import the values that are in the
‘@EXPORT’ array and also providing the
name of the features that you need in
your package you can make generic
modules that allow a large scope of
reuse. Working through the correct path
of code reuse has taken a lot more initial
effort than the simple copy and paste
approach does, but hopefully you will
have been convinced to do things
correctly by the additional power that
modules provide.
We have barely breached the surface
of Perl’s module system provides. To
Perl Tutorial: Part 7PROGRAMMING
6. installing a module by hand you can
appreciate the abstraction that installing
via CPAN provides. The other major
selling point of the CPAN approach is
dependency tracking.
When you try and install a module by
hand that depends upon additional
modules you must first install those
manually otherwise the install fails due
to unsatisfied dependencies. This could
take several iterations if the modules that
are listed as dependencies have further
dependencies of their own.
Installing via the CPAN module uses a
shell similar in many ways to bash,
including command completion and
history – if the required modules are
installed. The first time you invoke the
CPAN shell you will be prompted with a
list of configuration options that you will
be asked to confirm or edit. These
include which mirrors to download
from, where certain binaries are located
on the system and whether to
automatically follow dependencies.
To invoke the CPAN shell from the
command line you must type:
perl -MCPAN -e shell
And the prompt will change to ‘cpan>‘.
The invocation line causes the perl inter-
preter to load the module specified by
the upper case ‘-M’, in this case the
CPAN module while the ‘-e’ calls the
function ‘shell’ which has been exported
from the CPAN.pm module.
From within the cpan shell you can
easily search for and install additional
modules with a very important
advantage over installing them by hand,
CPAN.pm will track and install
dependencies for you.
Depending on the values you supplied
when you ran CPAN.pm for the first
time, this tracking dependencies would
be done either automatically without a
prompt, only after you answer yes to
install at a prompt or the module install
would fail. As you would expect the last
option is seldom chosen.
Navigating around the CPAN shell is
very simple once you have a grasp of a
few basic principles, if you are unsure of
the command required to carry out a
task then type ‘help’ at the prompt and it
will return a list of the valid commands
and what they do.
The commands are in three main
groups:
• Querying commands
• Module installation
• Meta-commands
The querying commands are the best
place to start as they are often the
commands you use the most, to view the
collection of modules under the XML
namespace type in ‘m /XML::/‘ and
press return, a list of all the modules will
scroll past along with some additional
details such as the author name and
module version. When you look along
the selection of XML modules you may
see a module that looks promising for
the task at hand, for example
XML::XPath.
Once you have found a module that
may be suitable you can install it by
issuing ‘install XML::XPath’ at the
prompt, the module will then be
downloaded to the machine and the
manual steps described above will be
run via the CPAN.pm module. If the
module has any tests defined for itself
then they will be run at the install and a
report of the successes and failures will
be shown.
If the module fails its tests then the
installation of the module will be
aborted. If the module passes its own
tests but fails because of unsatisfied
dependencies then CPAN.pm will go and
track down those dependencies and
install then going through as many
iterations of this as needed until either
the modules are all installed or one of
them fails.
Similar Code
When you have begun to use a number
of CPAN modules you may find that the
standard of code provided is high
enough that you would like to see what
else the author has contributed.
The author of ‘XML::XPath’, Matt
Sergeant, a Perl luminary responsible for
a large number of CPAN’s more popular
has an impressive collection of modules
that can be viewed without leaving the
comfort of the CPAN shell.
We rerun the search for the
‘XML::XPath’ module but this time as we
know the full name we do not use a reg-
ular expression search and instead we
enter ‘m XML::XPath’. ‘m’ is the keyword
that tells CPAN.pm we are searching for
a module, you can also use ‘a’, ‘b’ or ‘d’
to search for authors, bundles or distrib-
utions but those are out of the scope of
this article.
The ‘m XML::XPath’ command will
then go and get a list of all the modules
that are currently listed in the author’s
home directory and display them on
screen with some additional details such
as the files last update time, the version
number of the module and even the file
size of the complete module. From here
if we wanted to install another module
we could do a simple ‘install XML::SAX’
and the CPAN.pm module would take
care of it for us.
Now that we have shown you how to
install modules we’re going to show you
how to be a little more choosy in the
modules you actually download, to find
out more information than the name and
brief summary you can use the
CPAN.pm shell to retrieve and display
the modules own readme file. To do this
for XML::SAX you would type the
intuitive ‘readme XML::SAX’, CPAN.pm
will go and download the file and then
the pager you chose in the initialization
of the CPAN.pm module will be invoked
to read it.
The last installation example we will
show is a little different from the
previous ones as it applies to CPAN.pm
itself, whenever a new release of the
CPAN.pm module is issued CPAN detects
this the next time it is run and offers the
chance to upgrade. Although it may
seem a little strange to use CPAN.pm to
upgrade the CPAN.pm module, the
process is very reliable and requires very
little additional effort beyond a normal
module install.
After you have issued an ‘install
CPAN’ command and the module has
been downloaded and the tests run you
finish off the install by issuing a ‘reload
cpan’ command, the screen will have
a little process counter of dots appear
and a summary of the total number of
subroutines that have been reloaded by
CPAN.pm itself is shown marking the
successful completion of the upgrade.
When you have completed your work
in the CPAN shell to exit back to your
command shell just enter ‘q’ on a line by
itself and press return, the lock-file will
be removed and the CPAN shell will then
be closed. ■
67www.linux-magazine.com Dec 02 / Jan 03
PROGRAMMINGPerl Tutorial: Part 7