Perl does not provide any special syntax for class definitions

Perl 不提供任何特殊的语法对于类的定义

A package is simply a namespace containing variables and subroutines. The only difference is that in a class, the 

subroutines may expect a reference to an object or the name of a class as the first argument. This is purely a 

matter of convention, so a class may contain both methods and subroutines which don't operate on an object or 

class.

一个包是一个简单的名字空间包含变量和子程序。唯一的区别是在一个class里,

子程序可能被期望一个引用到一个对象或者 类的名字作为第一个参数

这是一个纯粹的惯例,因此一个class可能包含方法和子程序  不操作在对象或者类上。

l does not provide any special syntax for defining a method. A method is simply a regular subroutine, and is 

declared with sub. What makes a method special is that it expects to receive either an object or a class name as 

its first argument.
Perl does provide special syntax for method invocation, the -> operator. We will cover this in more detail later.
Most methods you write will expect to operate on objects: 我不提供任何特殊的符号用于一个方法, 一个方法是一个简单普通子程序, 并且是以sub定义。 让一个方法特别是他期望接收一个对象或者类名作为第一个参数 Perl 提供了特别的符号用于方法调用 ->操作符

perl 调用方法 子例程说明的更多相关文章

  1. [No000085]C#反射Demo,通过类名(String)创建类实例,通过方法名(String)调用方法

    using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using Sy ...

  2. ThinkPHP跨控制器调用方法

    跨控制器调用方法 1. 先造对象,再调用里面的方法 $sc=new \Home\Controller\IndexController();  用绝对路径找echo $sc->ShuChu(); ...

  3. perl 调用shell脚本

    perl调用shell命令 perl调用shell shell调用perl Perl执行shell命令的几种方式及其区别

  4. C# 反射之调用方法谈

    反射的定义 反射提供了描述程序集.模块和类型的对象(Type 类型). 可以使用反射动态创建类型的实例,将类型绑定到现有对象,或从现有对象获取类型并调用其方法或访问其字段和属性. 如果代码中使用了特性 ...

  5. 利用反射调用方法时,处理ref,out参数需要注意的问题(转)

    转自:http://www.68idc.cn/help/buildlang/ask/20150318283817.html 项目中如下的泛型方法,因为要在运行时,动态指定类型参数,所以要利用反射来实现 ...

  6. Struts2 Action下面的Method调用方法

    1. 在struts.xml中加入<constant name="struts.enable.DynamicMethodInvocation" value="tru ...

  7. 完整的分页存储过程以及c#调用方法

    高效分页存储过程 USE [db] GO /****** 对象: StoredProcedure [dbo].[p_Page2005] 脚本日期: // :: ******/ SET ANSI_NUL ...

  8. MySql 存储过程及调用方法

    存储过程实例: DELIMITER $$drop procedure if exists ff $$CREATE /*[DEFINER = { user | CURRENT_USER }]*/ PRO ...

  9. jquery ajax success 函数 异步调用方法中不能给全局变量赋值的原因及解决办法

    jquery ajax success 函数 异步调用方法中不能给全局变量赋值的原因及解决办法   在调用一个jquery的ajax方法时我们有时会需要该方法返回一个值或者给某个全局变量赋值,可是我们 ...

随机推荐

  1. uvalive 2322 Wooden Sticks(贪心)

    题目连接:2322 Wooden Sticks 题目大意:给出要求切的n个小木棍 , 每个小木棍有长度和重量,因为当要切的长度和重量分别大于前面一个的长度和重量的时候可以不用调整大木棍直接切割, 否则 ...

  2. highchats与php结合生成动态统计图

    series: [{ type: 'pie', name: 'Browser share', data: [ ['Firefox', 45.0], ['IE', 26.8], { name: 'Chr ...

  3. 自定义UISlider的样式和滑块

    又做完一个项目,遂到了写帖时间了,要跟大家分享的是:自定义UISlider的图片和滑块,先看一下效果: 然后是实现了,我们使用的是UISlider的setMinimumTrackImage,和setM ...

  4. 使用Git上传代码到GitHub详细的不能再详细教程

    据说不会用GitHub的程序员连菜鸟都不算,确实,GitHub上有大量优秀的代码,我们也可以将自己的代码分享上去. 首先,你要有一个GitHub的账号,https://github.com/在官网注册 ...

  5. WEB开发:如何用js来模拟服务器的ajax响应,不依赖服务器来编写前端代码

    一.问题的提出 目前web前端开发,主流的思路是: 1)编写静态的html文件(不使用模板技术,与服务器无关) 2)页面通过ajax与服务器交互,进行数据的传输,数据格式为json格式 这里存在一个问 ...

  6. Maven创建项目: Failed to execute goal org.apache.maven.plugin( mvn archetype:create)

    一.概述: 在使用mvn 命令mvn archetype:create -DgroupId=com.chuanliu.c11 -DartifactId=c11searcher在控制创建maven项目和 ...

  7. lucene 索引查看工具

    luke 是 lucene 索引查看工具,基于 swing 开发的,是 lucene.solr.nutch 开发过程中不可或缺的工具.在测试搜索过程,进程出现搜不到东西或者搜到的东西不是想要的结果时, ...

  8. 神奇的矩阵 NOI模拟题

    神奇的矩阵 题目大意 有一个矩阵\(A\),第一行是给出的,接下来第\(x\)行,第\(y\)个元素的值为数字\(A_{x-1,y}\)在\(\{A_{x-1,1},A_{x-1,2},A_{x-1, ...

  9. Ruby学习-第一章

    第一章 字符串,数字,类和对象 为了证明Ruby真的好用,hello world也能写的如此简洁: puts 'hello world' 1.输入/输出 print('Enter your name' ...

  10. 180China丨the Agency for Brand Engagement and Experience

    180China丨the Agency for Brand Engagement and Experience Welcome to 180. Welcome to Creativity. Thank ...