module

How to import a class from a module from a package dynamically?

This is probably really simple, but I don't understand it. The following works: foo.py class Foo: pass bar.py module = __import__('foo') foo = module.__dict__['Foo'] Afterwards, foo is the class foo.Foo as expected. Yet, if I put a.py into a package, it stops working: qux/__init__.py (empty file) qux/foo.py class Foo: ...

Test::More doesn't know if test dies - so how do I test?

I'm collecting a bunch of subroutines that are common to a bunch of my scripts into a module. (I should've done this way earlier, but started out with inherited scripts.) I'm modelling my work on the very helpful example here, using Test::More and Module::Build All of the subroutines that read or write from files all include a line op...

perl Net::Telnet module with telnet shell with no prompt character

The telnet host I am using does not have a prompt character, (it just goes into a blank newline when it is done), how then, should I use the Net::Telnet perl module? I tried setting prompt to // '' /\s/ or /\s*/ none of which worked. '' gave error saying it was invalid, and // /\s/ and /\s*/ simply timed out. my $t = new Net::Telnet ...

Add existing classes into a module

Hello, I have some existing ruby classes in a app/classes folder: class A ... end class B ... end I'd like to group those classes in a module MyModule I know I could do like: module MyModule class A ... end class B ... end end but is there a meta programming shortcut that could do the same so I could...

What tools can help build an XS project?

I've recently started learning XS using perlxstut and the tutorial suggests that I create my module using the old h2xs tool to create an ExtUtils::MakeMaker-based project. However for pure Perl projects, h2xs/EUMM has long been disfavoured in favour of Module::Install, Module::Build or Dist::Zilla. Is there a more modern way of creating...

Modules in C++0x

Hi, I just discovered this old C++0x draft about modules in C++0x. The idea was to get out of the current .h/.cpp system by writing only .cpp files which would then generate module files during compilation, which would then in turn be used by the other .cpp files. This looks like a really great feature. But my question is: why did the...

Perl Module Method Calls: Can't call method "X" on an undefined value at ${SOMEFILE} line ${SOMELINE}.

All over the place, especially in DBI, I see this message come up all the time. It's confusing, because the first thing that comes to mind is that the arguments I'm passing the function are set to undef (or something similar), but it's clearly not the case. Given a module and a corresponding script... Module: ./lib/My/Module.pm packag...

ejabberd mod_offline iphone pushed notifications

Hey guys im totally new with jabber/xmpp but i'm currently developing an chat iPhone app and so far so good for regular configuration for the ejabberd server... I want to implement Push notification when the user is "offline" and to do this I just need to run a PHP script which gets a Token device and the text message to deliver via ssl ...

Custom compound CCK field - How to display individual sub-fields in Views?

In Drupal 6, I have created a simple Pricing CCK compound field module with a "cost" and a "product" sub-field based on this excellent tutorial: http://www.poplarware.com/articles/cck_field_module function usginpricing_field_settings($op, $field) { switch ($op) { case 'database columns': $columns['cost'] = array('type' => 'v...

Using vtiger CRM module?

The older version of vtiger CRM had to ability to attach files that you have on your computer to an account or contact. When we updated to the new version I couldn't find this option. Did I miss it somewhere or is there a module that I can use the will provide a similar ability? I know about the ability to create documents within vtig...

Calling a Perl module from Python

Hi, my question is the inverse of this one. In particular, I've dozens of existing modules written in Perl, some are object oriented and others just export a group of functions. Now since I have to write certain scripts in python but still would like to call those Perl modules, I'm wondering 1) if it is achievable, and 2) if so, what ...

How can I import a python module fuction dynamically?

Assuming def my_function(): is located in my_apps.views I would like to import "my_function" dynamically without using something like exec or eval. Is there anyway to accomplish this. I'm looking to do something similar to: my_function = import_func("my_apps.views.my_function") my_function() ... code is executed ...

Why do you have to put a 1; at the end of a Perl 5 module?

Why do all Perl 5 modules have to end with 1;? ...

Looking for a best practice to filter module output in DotNetNuke

A client of me is migrating to a new CMS and the old CMS contains placeholders in the content that need to be replaced, something like (bad example ahead): {{ID:CurrentShoppingId}}, which would be replaced with the ID of the current shopper. I can think of three ways, but I'm totally open to new and better suggestions: Create a new mo...

Is is possible at build time to merge Android applications?

This question is related to this one. I have two Android projects inside Eclipse. One activity of one project calls an activity of the other project. This results in two independent applications being deployed on Android phone. Is there any way to merge at build time (inside or outside Eclipse) both applications in only one so only an A...

CMSMS module Availability with CGCalendar

*CMSMS module QUESTION * Hi all, I have asked this question on the CMSMS forum but as of yet have not received any responses, so hopefully someone here can help! I am using the 'Availability' module in conjuction with 'CGCalendar' which is great, but in stead of buttons to go the next and previous months (powered by Ajax), I need a dr...

Load multiple flex modules in one application

Hello everyone, I come from ASP.NET and I am learning Flex now. I don't know if I can do what I want in flex, so imagine this in ASP: I have an aspx page that loads a Login.ascx control, the control checks if login is correct, and if so the aspx page loads the XXX.ascx control (so there is only one control visible). I want to do more o...

How to properly use relative or absolute imports in Python modules?

Usage of relative imports in Python has one drawback, you will not be able to run the modules as standalones anymore because you will get an exception: ValueError: Attempted relative import in non-package # /test.py: just a sample file importing foo module import foo ... # /foo/foo.py: from . import bar ... if __name__ == "__main__": ...

History of Namespaces/Packages/Modules?

I've been researching how different languages manage organization of source code. It appears most modern languages use some form of named abstract container. What its called and how its implemented varies from one language to the next but it boils down to a programming construct that operates beyond file boundaries to group related code....

Are there conventions for Python module comments?

It is my understanding that a module docstring should just provide a general description of what a module does and details such as author and version should only be contained in the module's comments. However, I have seen the following in comments and docstrings: __author__ = "..." __version__ = "..." __date__ = "..." Where is the co...