Git Product home page Git Product logo

symbol-approx-sub's Introduction

Symbol::Approx::Sub

Build Status Coverage Status

What is Symbol::Approx::Sub?

Symbol::Approx::Sub is a Perl module which allows you to call subroutines using approximate names.

Of course, why you might want to do that is a completely different question. You almost certainly don't want to do it in production code as it will make your program almost completely unmaintainable.

I only wrote this module to test my understanding of typeglobs and AUTOLOAD. I really don't expect it to have any sensible uses at all (but if you find one, I'd be interested in knowing what it is).

How Do I Install It?

Symbol::Approx::Sub uses the standard Perl module architecture and can therefore by installed using the standard Perl method which, in brief, goes something like this:

   gzip -cd Symbol-Approx-Sub-X.XX.tar.gz | tar xvf -
   cd Symbol-Approx-Sub-X.XX
   perl Makefile.PL
   make
   make test
   make install

Where X.XX is the version number of the module which you are installing.

If this doesn't work for you then creating a directory called Symbol/Approx somewhere in your Perl library path (@INC) and copying the Sub.pm file into this directory should also do the trick.

Prerequisites

As of version 1.03, Symbol::Approx::Sub uses Devel::Symdump to do all of the clever glob-walking stuff, so you'll need to get that from CPAN and install it before installing Symbol::Approx::Sub.

Where is the Documentation?

All of the documentation is currently in POD format in the Approx.pm file. If you install the module using the standard method you should be able to read it by typing

   perldoc Symbol::Approx::Sub

at a command prompt.

Latest Version

The latest version of this module will always be available from CPAN.

Copyright

Copyright (c) 2000, Magnum Solutions Ltd. All Rights Reserved.

This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Anything Else?

If you have any further questions, please contact the author.

Authors

Dave Cross

Email: [email protected]

symbol-approx-sub's People

Contributors

ankit01ojha avatar danielksan81 avatar davorg avatar dependabot[bot] avatar gaurav1911 avatar manwar avatar tvroom avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

symbol-approx-sub's Issues

Better Tests

The tests are very much of the time they were written (or, perhaps, of my level of knowledge at the time they were written). There's a lot of stuff like ok(&sub eq 'string') which sohld be changed to is(sub(), 'string').

Also we should get rid of the explicit plans and use done_testing().

Improve test coverage

Missing tests:

  • Invalid matcher
  • Undef matcher
  • Coderef chooser
  • Invalid chooser
  • Default chooser

Bug in AUTOLOAD

The code in the generated AUTOLOAD has an obvious bug. Line 385 is currently

@match_ind = @subs[1 .. $#subs];

I think that should be.

@match_ind = 1 .. $#subs;

But I'd like to see a failing test before fixing it.

Better module loading

Currently we have our own code for loading plugins. Let's look at Module::Load or something like that instead.

(Bonus points for considering something like Module::Pluggable as well.)

Better $@ checks

A few tests just check $@ for truth. They should probably be more explicit about what they are testing for - otherwise tests might pass because things fail for the wrong reason.

Test::Excpetion

Would be nice to use Text::Exception in the tests that throw exceptions.

Missing tests

A couple more tests will get us to 100% coverage.

  • matcher => undef
  • chooser => sub { ... } (or, alternatively, chooser => \&some_chooser_sub)

Remove svn artifacts

This module used to be stored in a subversion repository. There are still some svn artifacts in the code (e.g. $Id$).

Check all of the files and remove these.

Add descriptions to tests

Currently most of the tests are just ok($something) or is($something, $something_else). It would be nice to add descriptions to the tests so a maintenance programmer has more chance of understanding what is going on.

This might be tricky. I'm not sure that I understand what all of the tests are doing currently :/

What is "canon"?

One of the tests includes a canon => ... option when loading Symbol::Approx::Sub. Symbol::Approx::Sub doesn't have a "canon" option.

I suspect that "canon" should be renamed to "transform". But more investigation is required.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.