English 中文(简体)
我如何在一揽子使用基数中设定子路?
原标题:How do I create subroutines in package on use base ?

Im试图建立一个小型的互联网用户图书馆,供在网上使用。 我已经发展了Rubys数据中心,如果可能的话,愿意效仿它的一些行为。

在数据图表中,你可以混合资源,然后在表格中增加所有方法,例如:

# User.rb
class User
    include Datamapper::Resource;
end
...

# Application.rb
users = User.all

对于我的图书馆,Im试图在从基础模型继承的单元中增加一些一揽子功能,以实现类似行为。

从本质上讲,我希望能够做一些与以下方面相近的事情:

# User.pm
package User;
use base Model;
...

# Application.pm
my @users = User::all();

我先看一看一看一看一看一看一看一看一看一看一看一看一看一看一看一看一看一看一去就看一去看一看一看一去,一看一看一看一看一看一看一去,一看一看一看一看一看一看一看一去,一看一看一看一看一看一看一看一看,一看一看一看一看,一看一看一看一看一看一看一看一看一看一看,一看一看一看一看一看一看,一看一看一看一看一看一看一看一看一看一看一看一看,一看一看一看一看一看一看一看一看一看一看一看一看一看,一看一看一看一看一看一看一看一看一看,一看一看一看一看一看一看,一看一看一看一看一看一看一看一看一看一看一看一看一看一看,

下面是:

  • Alternate perl patterns that achieve similar elegance in a more idiomatic fashion
  • Ability to inherit subroutines on the package level, as well as the object level
  • Ability to execute code on use in the scope of the current package, or
  • Have the current package passed to code that is executed on use
  • A guide to meta-programming in Perl
  • A existing declarative ORM library that supports easily creating mock-adapters as well as DB2, and MySQL

理想的情况是,我想尽量避免大街上扬。

任何帮助都将受到高度赞赏。

最佳回答
问题回答

暂无回答




相关问题
Why does my chdir to a filehandle not work in Perl?

When I try a "chdir" with a filehandle as argument, "chdir" returns 0 and a pwd returns still the same directory. Should that be so? I tried this, because in the documentation to chdir I found: "...

How do I use GetOptions to get the default argument?

I ve read the doc for GetOptions but I can t seem to find what I need... (maybe I am blind) What I want to do is to parse command line like this myperlscript.pl -mode [sth] [inputfile] I can use ...

Object-Oriented Perl constructor syntax and named parameters

I m a little confused about what is going on in Perl constructors. I found these two examples perldoc perlbot. package Foo; #In Perl, the constructor is just a subroutine called new. sub new { #I ...

Where can I find object-oriented Perl tutorials? [closed]

A Google search yields a number of results - but which ones are the best? The Perl site appears to contain two - perlboot and perltoot. I m reading these now, but what else is out there? Note: I ve ...

热门标签