[ANNOUNCE] Getopt::Attribute 0.02
NAME Getopt::Attribute - Attribute wrapper for Getopt::Long SYNOPSIS use Getopt::Attribute; my $verbose : Getopt(verbose!); my $all : Getopt(all); my $size: Getopt(size=s); my $more: Getopt(more+); my @library : Getopt(library=s); my %defines : Getopt(define=s); sub quiet : Getopt(quiet) { our $quiet_msg = 'seen quiet' } usage() if my $man : Getopt(man); ... # Meanwhile, on some command line: mypgm.pl --noverbose --all --size=23 --more --more --more --quiet --library lib/stdlib --library lib/extlib --define os=linux --define vendor=redhat --man -- foo DESCRIPTION This module provides an attribute wrapper around `Getopt::Long'. Instead of declaring the options in a hash with references to the variables and subroutines affected by the options, you can use the `Getopt' attribute on the variables and subroutines directly. As you can see from the Synopsis, the attribute takes an argument of the same format as you would give as the hash key for `Getopt::Long'. See the `Getopt::Long' manpage for details. Note that since attributes are processed during CHECK, but assignments on newly declared variables are processed during run-time, you can't set defaults on those variables beforehand, like this: my $verbose : Getopt(verbose!) = 1; # DOES NOT WORK Instead, you have to establish defaults afterwards, like so: my $verbose : Getopt(verbose!); $verbose ||= 1; BUGS None known so far. If you find any bugs or oddities, please do inform the author. AUTHOR Marcel Grunauer, <[EMAIL PROTECTED]> COPYRIGHT Copyright 2001 Marcel Grunauer. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO perl(1), Getopt::Long(3pm), Attribute::Handlers(3pm). Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
Re: Inline::PERL
On Sunday, June 3, 2001, at 05:56 AM, David H. Adler wrote: > On Fri, Jun 01, 2001 at 09:40:49AM +0100, Cross David - dcross wrote: >> >> Inline::PERL gives you the power of the PERL programming language from > > And what, exactly, is the PERL programming language? It is the wicked, twisted spectre of Perl that haunts the minds of script kiddies. In some cultures it is known as CGI; other cultures have no name for it. Well-informed people normally run when they encounter it. A saving throw against mental instability applies. Marcel -- $ perl -we time Useless use of time in void context at -e line 1.
Re: crazy golf
On Friday, June 1, 2001, at 10:41 PM, Redvers Davies wrote: >> I find it strange that the only surviving English/British religion, > > Nah, you want an interesting old religion, look at the Celts. Drinking > blood has gone out of style though... Has it? Angel drinks blood; Spike does as well. Oops, wrong thread... Marcel -- $ perl -we time Useless use of time in void context at -e line 1.
Re: crazy golf
On Friday, June 1, 2001, at 02:07 PM, Paul Mison wrote: > On 01/06/2001 at 13:03 +0100, Greg McCarroll wrote: > >> so when is the next bang holiday weekend? > > 2001-08-27. Hence the crazy golf must be on 2001-08-25. (Palm Desktop)++ Cool; I might actually be in London that weekend. Marcel -- $ perl -we time Useless use of time in void context at -e line 1.
Montreal
Who is going to be at YAPC::NA in Montreal? I'm going to be there from June 9-18 and seeing that the conference is from June 13-15, there are a few days to do sightseeing / hacking / whatever. Is anyone else there before the conference so we might meet up early? Also, any tips on what do to in Montreal would be appreciated (there are city guides, of course, but if someone has first-hand experience it'd be good). Marcel -- my int ($x, $y, $z, $n); $x**$n + $y**$n = $z**$n is insoluble if $n > 2; I have discovered a truly remarkable proof which this signature is too short to contain. (20 Aug 2001: Pierre de Fermat's 400th birthday)
Re: OSCon London
On Thursday, May 31, 2001, at 12:00 PM, Cross David - dcross wrote: > This one, however, had an advert on the from about the Open Source > Convention. Not the San Diego Open Source Convention, but one in London > on > October 22 - 25. That's currently all I know, but I'll see what else I > can > find out. Couldn't find anything on the O'Reilly site, events or conferences. Maybe someone working for them who is also on this list might have some information? Marcel -- my int ($x, $y, $z, $n); $x**$n + $y**$n = $z**$n is insoluble if $n > 2; I have discovered a truly remarkable proof which this signature is too short to contain. (20 Aug 2001: Pierre de Fermat's 400th birthday)
[ANNOUNCE] Attribute::Overload 0.02
NAME Attribute::Overload - Attribute that makes overloading easier SYNOPSIS use Attribute::Overload; sub add : Overload(+) { ... } DESCRIPTION The `Overload' attribute, when used on a subroutine, declares that subroutine as handler in the current package for the operation(s) indicated by the attribute options. Thus it frees you from the implementation details of how to declare overloads and keeps the definitions where they belong, with the operation handlers. For details of which operations can be overloaded and what the overloading function gets passed see the `overload' manpage. Note that you can't overload constants this way, since this has to happen during BEGIN time, but attributes are only evaluated at CHECK time (at least as far as `Attribute::Handlers' is concerned). BUGS None known so far. If you find any bugs or oddities, please do inform the author. AUTHOR Marcel Grunauer, <[EMAIL PROTECTED]> COPYRIGHT Copyright 2001 Marcel Grunauer. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO perl(1), overload(3pm), Attribute::Handlers(3pm). Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
[ANNOUNCE] Attribute::Util 0.02
NAME Attribute::Util - A selection of general-utility attributes SYNOPSIS use Attribute::Util; # Alias sub color : Alias(colour) { return 'red' } # Abstract package MyObj; sub new { ... } sub somesub: Abstract; package MyObj::Better; use base 'MyObj'; sub somesub { return "I'm implemented!" } # Memoize sub fib :Memoize { my $n = shift; return $n if $n < 2; fib($n-1) + fib($n-2); } $|++; print fib($_),"\n" for 1..50; # SigHandler sub myalrm : SigHandler(ALRM, VTALRM) { ... } sub mywarn : SigHandler(__WARN__) { ... } DESCRIPTION This module provides four universally accessible attributes of general interest: Memoize This attribute makes it slightly easier (and modern) to memoize a function by providing an attribute, `:Memoize' that makes it unnecessary for you to explicitly call `Memoize::memoize()'. Options can be passed via the attribute per usual (see the `Attribute::Handlers' manpage for details, and the `Memoize' manpage for information on memoizing options): sub f :Memoize(NORMALIZER => 'main::normalize_f') { ... } However, since the call to `memoize()' is now done in a different package, it is necessary to include the package name in any function names passed as options to the attribute, as shown above. Abstract Declaring a subroutine to be abstract using this attribute causes a call to it to die with a suitable exception. Subclasses are expected to implement the abstract method. Using the attribute makes it visually distinctive that a method is abstract, as opposed to declaring it without any attribute or method body, or providing a method body that might make it look as though it was implemented after all. Alias If you need a variable or subroutine to be known by another name, use this attribute. Internally, the attribute's handler assigns typeglobs to each other. As such, the `Alias' attribute provides a layer of abstraction. If the underlying mechanism changes in a future version of Perl (say, one that might not have the concept of typeglobs anymore :), a new version of this module will take care of that, but your `Alias' declarations are going to stay the same. Note that assigning typeglobs means that you can't specify a synonym for one element of the glob and use the same synonym for a different target name in a different slot. I.e., sub color :Alias(colour) { ... } my $farbe :Alias(colour); doesn't make sense, since the sub declaration aliases the whole `colour' glob to `color', but then the scalar declaration aliases the whole `colour' glob to `farbe', so the first alias is lost. SigHandler When used on a subroutine, this attribute declares that subroutine to be a signal handler for the signal(s) given as options for this attribute. It thereby frees you from the implementation details of defining sig handlers and keeps the handler definitions where they belong, namely with the handler subroutine. BUGS None known so far. If you find any bugs or oddities, please do inform the author. AUTHOR Marcel Grunauer, <[EMAIL PROTECTED]> COPYRIGHT Copyright 2001 Marcel Grunauer. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO perl(1), Attribute::Handlers(3pm), Memoize(3pm). Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
Re: SQL statements to DB Schema (dia ?)
On Wednesday, May 30, 2001, at 10:51 AM, Cross David - dcross wrote: >> I have no DB schema, and as such could dump the SQL schema (via >> mysqldump) - and I was wondering if there was a super thing that could >> translate the create table stuff into a diagram I could print, and then >> look at If this worked on Linux and involved perl and Dia then it >> would be fab. > > > If GraphViz doesn't do this already - it will by the end of the day :) > It did - for some time. GraphViz::DBI, by yours truly, does precisely that. It relies, at this time, on a certain table/field naming convention (but is subclassable so you can implement your own convention). In a future version it'll be aware of constraints (for foreign keys and such). Marcel -- my int ($x, $y, $z, $n); $x**$n + $y**$n = $z**$n is insoluble if $n > 2; I have discovered a truly remarkable proof which this signature is too short to contain. (20 Aug 2001: Pierre de Fermat's 400th birthday)
Re: Grammar -> Class creation
On Tuesday, May 29, 2001, at 11:49 AM, Paul Makepeace wrote: > Surely it should be possible to specify the underlying *functionality* > of the system and then have a perl source filter (or other component of > perl's mind-addling n-tier parsing architecture) that > rewrites/re-presents the interface in the API style du jour... Separate the end-user API from the parser's action API. I.e., each parser module specifies the grammar and uses a fixed style of action that creates something like an abstract syntax tree. Then have several end-user APIs to access that AST. I.e., one that traverses the tree and makes callbacks for each node. Or one that uses an XPath-like syntax to get at certain nodes in the tree. Or, in the spirit of the model-view controller, make it a tree model and have various tree viewers (Leon will recognise this idea; as I've been going on about this since before the German Perl Workshop...) so you could also 'view' the tree as an XML document, as a Data::Dumper-like output, as a directory hierarchy (where nodes are directories and leaf entries are files), or whatever one's sick mind can come up with. Marcel -- my int ($x, $y, $z, $n); $x**$n + $y**$n = $z**$n is insoluble if $n > 2; I have discovered a truly remarkable proof which this signature is too short to contain. (20 Aug 2001: Pierre de Fermat's 400th birthday)
Re: Grammar -> Class creation
On Tuesday, May 29, 2001, at 11:18 AM, Simon Wistow wrote: > I started looking into this when I first started doing the SWF stuff ... > a kind of YACC for file formats. Describe it in a BNF-a-like language > and then run a program over it et voila - you have a library for reading > and creating that file format (he says, glossing over lots of > complications and gotchas). Write that program for each different > language and lots of different languages/systems have access to lots of > different fiel formats and every time a format changes the spec gets > updated and everyone runs their grammar->library programs again and > everybody's got full functionality again. As Leon points out, Parse::RecDescent is One Way To Do It. However, it's mostly used to parse some input according to some grammar and to construct the desired result directly. If you need a different result from the same grammar, you have to specify the grammar and actions again. It might be an idea to have grammars packed up in modules (i.e., reusable) and make the actions callbacks (some sort of autoaction might do that), much like HTML and XML parsers do it. I imagine lots of little Parse::* modules (Parse::Regex, Parse::PDF, Parse::RPN etc.). Is that a) a good idea, b) a bad idea, c) common practice anyway and I just haven't found it? Marcel -- $ perl -we time Useless use of time in void context at -e line 1.
Re: Tie::Hash::Regex vs Tie::RegexpHash
On Friday, May 25, 2001, at 03:18 PM, Cross David - dcross wrote: > It's all very clever, but I'm not convinced how useful it is. Since when has that ever stopped us? Marcel -- $ perl -we time Useless use of time in void context at -e line 1.
Re: [announce] Tie::Hash::Rank
On Tuesday, May 22, 2001, at 09:32 PM, David Cantrell wrote: > I've just put a complete version of Tie::Hash::Rank on my webshite for 'webshite'? shurely shome mishtake? > your enjoyment. I'd be grateful if some of you could download it and > test it before I submit it to CPAN. > > http://www.cantrell.org.uk/david/tech/Tie-Hash-Rank-1.0.tar.gz > > It has what I hope is a comprehensive test suite anyway, but many eyes > make bugs leap out of the screen and bash me over the head :-) Looks good. Also works with Attribute::TieClasses (once I had replaced the '#!/usr/bin/perl -w' with 'use warnings', mysteriously). Marcel -- $ perl -we time Useless use of time in void context at -e line 1.
Attributes galore
This is something like a request for comments. Playing around with attributes (as per Attribute::Handler), I've done several more attribute handlers and have also bundled a few into one module but am not quite sure what to call it. First, here are examples of those handlers: 1) Attribute::Tools sub fib :Memoize { ... }# like Attribute::Memoize sub foo :Abstract { ... }# like Attribute::Abstract sub color :aka(colour) { ... }# alternative names sub mywarn : SigHandler(__WARN__) { ... } # instead of $SIG{__WARN__} = \&mywarn; # keeps you free from implementation details sub myadd : Overload(+) { ... } # instead of use overload '+' => \&myadd; The above five attributes are in one module called Attribute::Tools, but maybe someone has a better name for them. It seems like a waste to have a separate CPAN module for each of those. Now some more attributes: 2) Attribute::Export use Attribute::Export; sub hello : Export { "hello there" } sub askme : ExportOk { "export is ok" } # shields you from the Exporter arrays 3) Attribute::INC use Attribute::INC; sub traceinc : INC { my ($self, $file) = @_; print "looking for $file?\n"; return; } # installs a coderef-in-@INC 4) Attribute::Documentation use Attribute::Documentation 'document_module'; document_module Description => 'Just a sample module', Author => 'Marcel Grunauer <[EMAIL PROTECTED]>'; sub new : Description(The constructor) { bless {}, shift } sub old : Deprecated :Public { print "something\n" } # remembers this documentation in a hash structure so you # can query it later or generate POD from it (on a related note, it'd be nice to use Class::Contract and/or Class::MethodMaker to autogenerate documentation for the classes generated by them) 5) Future idea: XML template match attributes An XSL-like declarative XML transformation mechanism using a multimethod-like mechanism implemented via attributes: sub apply :XPathMatch(//xyz[@name="abc"]/def) { ... } which is expected to return the transformed text, much like an XSL template does, except it has the power of Perl behind it 6) Future idea: PreAttrHook, PostAttrHook, AUTOATTR Attribute::Handler could be extended so it recognizes those three new attributes and calls the PreAttrHook handler before the first attribute handler on a symbol, and the PostAttrHook handler on the last one. This way you could override the behavior of any other handlers, or just keep track of what attributes there are (so you can report on them later). If any attribute is used for which there isn't a handler, but there is an AUTOATTR handler, that one is called instead. 7) Future idea: DefaultAttr Maybe using a source filter, it might be possible to add an attribute (let's call it ':DefaultAttr') to each symbol that can possibly have an attribute, so you can use attributes to do things to each and every variable and subroutine. This would be really useful for bringing in aspect-oriented programming. For example, if you wanted to trace all calls to sub in the Foo package, you might say: sub DefaultAttr : ATTR(CODE) { my ($pkg, $symbol) = @_; print STDERR "entering $symbol\n" if $pkg eq 'Foo' } Any comments, ideas, or contact details of the nearest psychiatric clinic would be appreciated. -- $ perl -we time Useless use of time in void context at -e line 1.
Re: Marcel Grunauer left on all night
On Monday, May 21, 2001, at 10:39 AM, Simon Wistow wrote: > .. get some sleep boy, you're making the rest of us look bad :) Someone forgot to terminate my program. Hello. Hello? As I was on all weekend as well, expect some more attribute stuff rsn. Marcel -- my int ($x, $y, $z, $n); $x**$n + $y**$n = $z**$n is insoluble if $n > 2; I have discovered a truly remarkable proof which this signature is too short to contain. (20 Aug 2001: Pierre de Fermat's 400th birthday)
base64 encodings...
I've just been informed and shamed to see that all these postings came through as base64 encoded because of the umlaut in my surname. I'll get rid of that (no one pronounces that correctly anyway) for future postings. Sorry again. Marcel -- $ perl -we time Useless use of time in void context at -e line 1.
[ANNOUNCE] GraphViz::ISA 0.01
NAME GraphViz::DBI - graph database tables and relations SYNOPSIS use GraphViz::DBI; print GraphViz::DBI->new($dbh)->graph_tables->as_png; DESCRIPTION This module constructs a graph for a database showing tables and connecting them if they are related. While or after constructing the object, pass an open database handle, then call `graph_tables' to determine database metadata and construct a GraphViz graph from the table and field information. METHODS The following methods are defined by this class; all other method calls are passed to the underlying GraphViz object: new( [$dbh] ) Constructs the object; also creates a GraphViz object. The constructor accepts an optional open database handle. set_dbh($dbh) Sets the database handle. get_dbh() Returns the database handle. is_table($table) Checks the database metadata whether the argument is a valid table name. is_foreign_key($table, $field) Determines whether the field belonging to the table is a foreign key into some other table. If so, it is expected to return the name of that table. If not, it is expected to return a false value. For example, if there is a table called "product" and another table contains a field called "product_id", then to indicate that this field is a foreign key into the product table, the method returns "product". This is the logic implemented in this class. You can override this method in a subclass to suit your needs. graph_tables() This method goes through all tables and fields and calls appropriate methods to determine which tables and which dependencies exist, then hand the results over to GraphViz. It returns the GraphViz object. TODO * Test with various database drivers to see whether they support the metadata interface. * Provide the possibility to name edges to specify the type of relationship ('has-a', 'is-a', etc.). BUGS None known so far. If you find any bugs or oddities, please do inform the author. AUTHOR Marcel Grünauer <[EMAIL PROTECTED]> COPYRIGHT Copyright 2001 Marcel Grünauer. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO perl(1), GraphViz(3pm). Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
[ANNOUNCE] GraphViz::DBI 0.01
NAME GraphViz::DBI - graph database tables and relations SYNOPSIS use GraphViz::DBI; print GraphViz::DBI->new($dbh)->graph_tables->as_png; DESCRIPTION This module constructs a graph for a database showing tables and connecting them if they are related. While or after constructing the object, pass an open database handle, then call `graph_tables' to determine database metadata and construct a GraphViz graph from the table and field information. METHODS The following methods are defined by this class; all other method calls are passed to the underlying GraphViz object: new( [$dbh] ) Constructs the object; also creates a GraphViz object. The constructor accepts an optional open database handle. set_dbh($dbh) Sets the database handle. get_dbh() Returns the database handle. is_table($table) Checks the database metadata whether the argument is a valid table name. is_foreign_key($table, $field) Determines whether the field belonging to the table is a foreign key into some other table. If so, it is expected to return the name of that table. If not, it is expected to return a false value. For example, if there is a table called "product" and another table contains a field called "product_id", then to indicate that this field is a foreign key into the product table, the method returns "product". This is the logic implemented in this class. You can override this method in a subclass to suit your needs. graph_tables() This method goes through all tables and fields and calls appropriate methods to determine which tables and which dependencies exist, then hand the results over to GraphViz. It returns the GraphViz object. TODO * Test with various database drivers to see whether they support the metadata interface. * Provide the possibility to name edges to specify the type of relationship ('has-a', 'is-a', etc.). BUGS None known so far. If you find any bugs or oddities, please do inform the author. AUTHOR Marcel Grünauer <[EMAIL PROTECTED]> COPYRIGHT Copyright 2001 Marcel Grünauer. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO perl(1), GraphViz(3pm). Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
[ANNOUNCE] DBIx::Lookup::Field 0.01
NAME DBIx::Lookup::Field - Create a lookup hash from a database table SYNOPSIS use DBI; use DBIx::Lookup::Field qw/dbi_lookup_field/; $dbh = DBI->connect(...); my $inst_id = dbi_lookup_field( DBH => $dbh, TABLE => 'institution' KEY => 'name', VALUE => 'id', ); print "Inst_A has id ", $inst_id->{Inst_A}; DESCRIPTION This module provides a way to construct a hash from a database table. This is useful for the situation where you have to perform many lookups of a field by using a key from the same table. If, for example, a table has an id field and a name field and you often have to look up the name by its id, it might be wasteful to issue many separate SQL queries. Having the two fields as a hash speeds up processing, although at the expense of memory. EXPORTS dbi_lookup_field() This function creates a hash from two fields in a database table on a DBI connection. One field acts as the hash key, the other acts as the hash value. It expects a parameter hash and returns a reference to the lookup hash. The following parameters are accepted. Parameters can be required or optional. If a required parameter isn't given, an exception is raised (i.e., it dies). DBH The database handle through which to access the table from which to create the lookup. Required. TABLE The name of the table that contains the key and value fields. Required. KEY The field name of the field that is to act as the hash key. Required. VALUE The field name of the field that is to act as the hash value. Required. WHERE A SQL 'WHERE' clause with which to restrict the 'SELECT' statement that is used to create the hash. Optional. BUGS None known at this time. If you find any oddities or bugs, please do report them to the author. AUTHOR Marcel Grünauer <[EMAIL PROTECTED]> COPYRIGHT Copyright 2001 Marcel Grünauer. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO DBI(3pm). Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
[ANNOUNCE] Devel::SearchINC 0.02
NAME Devel::SearchINC - loading Perl modules from their development dirs SYNOPSIS use Devel::SearchINC '/my/dev/dir'; use My::Brand::New::Module; DESCRIPTION When developing a new module, I always start with h2xs -XA -n My::Module This creates a directory with a useful skeleton for the module's distribution. The directory structure is such, however, that you have to install the module first (with `make install') before you can use it in another program or module. For example, bringing in a module like so: use My::Module; requires the module to be somewhere in a path listed in `@INC', and the relative path is expected to be `My/Module.pm'. However, `h2xs' creates a structure where the module ends up in `My/Module/Module.pm'. This module tries to compensate for that. The idea is that you `use()' it right at the beginning of your program so it can modify `@INC' to look for modules in relative paths of the special structure mentioned above, starting with directories specified along with the `use()' statement (i.e. the arguments passed to this module's `import()'). This is useful because with this module you can test your programs using your newly developed modules without having to install them just so you can use them. This is especially advantageous when you consider working on many new modules at the same time. TODO Test on different platforms and Perl versions. BUGS None known so far. If you find any bugs or oddities, please do inform the author. AUTHOR Marcel Grünauer, <[EMAIL PROTECTED]> COPYRIGHT Copyright 2001 Marcel Grünauer. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO perl(1). Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
[ANNOUNCE] Attribute::Abstract 0.01
NAME Attribute::Abstract - implementing abstract methods with attributes SYNOPSIS package SomeObj; use Attribute::Abstract; sub new { ... } sub write : Abstract; DESCRIPTION Declaring a subroutine to be abstract using this attribute causes a call to it to die with a suitable exception. Subclasses are expected to implement the abstract method. Using the attribute makes it visually distinctive that a method is abstract, as opposed to declaring it without any attribute or method body, or providing a method body that might make it look as though it was implemented after all. BUGS None known so far. If you find any bugs or oddities, please do inform the author. AUTHOR Marcel Grünauer, <[EMAIL PROTECTED]> COPYRIGHT Copyright 2001 Marcel Grünauer. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO perl(1). Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
[ANNOUNCE] Attribute::TieClasses 0.01
NAME Attribute::TieClasses - attribute wrappers for CPAN Tie classes SYNOPSIS use Attribute::TieClasses; my $k : Timeout(EXPIRES => '+2s'); # loads in Tie::Scalar::Timeout and tie()s $k with those options DESCRIPTION Damian Conway's wonderful `Attribute::Handlers' module provides an easy way to use attributes for `tie()'ing variables. In effect, the code in the synopsis is simply use Attribute::Handlers autotie => { Timeout => 'Tie::Scalar::Timeout' }; Still, going one step further, it might be useful to have centrally defined attributes corresponding to commonly used Tie classes found on CPAN. Simply `use()'ing this module doesn't bring in all those potential Tie classes; they are only loaded when an attribute is actually used. The following attributes are defined: Attribute name(s) Variable ref Class the variable is tied to = = Alias HASH Tie::AliasHash AliasedHASH Tie::AliasHash Cache HASH Tie::Cache CharArray ARRAY Tie::CharArray CounterSCALARTie::Counter Cycle SCALARTie::Cycle DBIHASH Tie::DBI Decay SCALARTie::Scalar::Decay Defaults HASH Tie::HashDefaults Dict HASH Tie::TieDict DirHASH Tie::Dir DirHandle HASH Tie::DirHandle Discovery HASH Tie::Discovery Dx HASH Tie::DxHash Encrypted HASH Tie::EncryptedHash FileLRUHASH Tie::FileLRUCache Fixed HASH Tie::SubstrHash FlipFlop SCALARTie::FlipFlop IPAddrKeyedHASH Tie::NetAddr::IP InsensitiveHASH Tie::CPHash Ix HASH Tie::IxHash LDAP HASH Tie::LDAP LRUHASH Tie::Cache::LRU ListKeyed HASH Tie::ListKeyedHash Math HASH Tie::Math Mmap ARRAY Tie::MmapArray NumRange SCALARTie::NumRange NumRangeWrap SCALARTie::NumRangeWrap (in Tie::NumRange) Offset ARRAY Tie::OffsetArray OrderedHASH Tie::LLHash PackedInt ARRAY Tie::IntegerArray PerFH SCALARTie::PerFH Persistent HASH Tie::Persistent RDBM HASH Tie::RDBM Range HASH Tie::RangeHash RangeKeyed HASH Tie::RangeHash Rank HASH Tie::Hash::Rank Ranked HASH Tie::Hash::Rank RefHASH Tie::RefHash Regexp HASH Tie::RegexpHash RegexpKeyedHASH Tie::RegexpHash Secure HASH Tie::SecureHash Sentient HASH Tie::SentientHash Shadow HASH Tie::ShadowHash Shadowed HASH Tie::ShadowHash Sort HASH Tie::SortHash Sorted HASH Tie::SortHash Strict HASH Tie::StrictHash Substr HASH Tie::SubstrHash TextDirHASH Tie::TextDir TimeoutSCALARTie::Scalar::Timeout Toggle SCALARTie::Toggle Transact HASH Tie::TransactHash TwoLevel HASH Tie::TwoLevelHash VecARRAY Tie::VecArray Vector ARRAY Tie::VecArray WarnGlobal SCALARTie::WarnGlobal::Scalar I haven't had occasion to test all of these attributes; they were taken from the module descriptions on CPAN. For some modules where the name didn't ideally translate into an attribute name (e.g., `Tie::NetAddr::IP'), I have taken some artistic liberty to create an attribute name. Some tie classes require the use of the return value from `tie()' and are as such not directly usable by this mechanism, AFAIK. No censoring has been done as far as possible; there are several attributes that accomplish more or less the same thing. TIMTOWTDI. If you want any attribute added or renamed or find any mistakes or omissions, please contact me at <[EMAIL PROTECTED]>. EXAMPLES # Tie::Scalar::Timeout my $m : Timeout(NUM_USES => 3, VALUE =
Fun with Attributes
Thanks to Damian's Attribute::Handlers it's now possible to do what I wanted to do for some time (but haven't quite gotten around to) and very easily (and it's on its way to CPAN; suggestions/patches welcome): use Attribute::Memoize; sub fib :Memoize { my $n = shift; return $n if $n < 2; fib($n-1) + fib($n-2); } $|++; print fib($_),"\n" for 1..50; package Attribute::Memoize; use warnings; use strict; use Attribute::Handlers; use Memoize; our $VERSION = '0.01'; sub UNIVERSAL::Memoize :ATTR(CODE) { my ($package, $symbol, $options) = @_[0,1,4]; $options = [ $options ] unless ref $options eq 'ARRAY'; memoize $package . '::' . *{$symbol}{NAME}, @$options; } 1; Marcel -- $ perl -we time Useless use of time in void context at -e line 1.
Re: The scary man...
On Wednesday, May 16, 2001, at 10:47 AM, Dean wrote: > Some interesting stuff: > http://www.perl.com/pub/2001/05/08/exegesis2.html Exegesis unimatrix-1: print "Hello, World!\n" RFC28 hard at work here! Marcel -- $x**$n + $y**$n = $z**$n is insoluble if $n > 2; I have discovered a truly remarkable proof which this signature is too short to contain. (20 Aug 2001: Pierre de Fermat's 400th birthday)
Re: (Ab)Using substr
On Thursday, May 10, 2001, at 12:24 PM, Robin Houston wrote: > On Thu, May 10, 2001 at 09:16:25AM +0100, Cross David - dcross wrote: >> #!/usr/bin/perl -w # how to (ab)use substr >> use strict; >> my $pi='3.14159210535152623346475240375062163750446240333543375062'; > > Well, it's more just taking advantage of the fact that most people > don't know more than six decimal places of Pi :-) Well, Dave *did* say my $pi It's not the official one. Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
Re: Stuffed camel
On Sunday, April 29, 2001, at 08:25 PM, Leon Brocard wrote: > Stuffed Camel > Can *someone* please pick a date to go visit the camel? Mouth-watering, eh? I take it the tube strike's off then, since you no longer consider the camel to be public transport? Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
davorg, evil destroyer of privacy
On Thursday, April 26, 2001, at 07:23 PM, Niklas Nordebo wrote: > Gets a 9, apparently. > > http://slashdot.org/article.pl?sid=01/04/26/1229238&mode=thread I like the following comment (I know you've seen it, Niklas): =for amusement Boycott This Book!!! (Score:2, Troll) by none on Thursday April 26, @12:10PM EST (#22) (User #161746 Info) Have you stopped to consider the consequences of the information contained in books like this? This type of effort should not be supported by the Free Software community. Books like this give corporations the tools they need to destroy our privacy and strip us of our rights. How do you think Double Click puts the information about you it sells into useable form? With techniques it learns from this type of book. Same goes for the corporate websites you visit, your supermarket, etc. Information wants to be free, but not the information in this book. Data mining and Data munging techniques should never have left the hallowed halls of academe. Once they enter the public domain, they are immediately exploited by greedy corporations. The author should have thought about that before writing a book like this. If you buy or support books like this, you have lost any right to complain about your privacy being violated. If you are serious about privacy, boycott this book! =cut Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
Re: More Natives
On Monday, April 23, 2001, at 10:43 AM, Cross David - dcross wrote: > Yea, I usually _AM_ the right one. WOW, I was wrong _1_ _fucking_ > _time_. > Ooohhh, Davey intimidates me! That's why I kill people for a job, and > you > write about perl... > > OOh, I'm scared. > > I'll shove a howitzer up _ALL_ of your asses. (Except those who defend > me, > of course)... I believe there is a cure for Tourette Syndrome. Maybe he'd like to try it. > Now, take yer lame ass fountain pens, and leave me alone. I'm in > Hereford, > England on business, and have _NO_ time to deal with this I'm right/your > wrong/i kill/you write crap. Obviously in Hereford they don't teach them grammar. > Data munging--- bah. Munging? If you note AOL dictionary... The only > definition is for "mung bean". Maybe this just says something about the AOL dictionary. Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
Re: next social meeting vs tube strike
On Thursday, April 19, 2001, at 05:40 PM, Mike Wyer wrote: >> I recommend public camels. Maybe now would be the time for a trip to >> the >> zoo. > > Camels are quite hard to see at London Zoo at the moment, owing to the > foot 'n mouth situation. I was there a couple of weeks back, and the > heffalump house was shut. The penguins ain't bad, though. So you recommend to piggyback a penguin (penguinback?) to get to the meeting in time? Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
Re: next social meeting vs tube strike
On Thursday, April 19, 2001, at 03:37 PM, dcross - David Cross wrote: > Hmmm... You're assuming that Perl Mongers use public transport. I > thought we > all swanned about in taxis and limos. I recommend public camels. Maybe now would be the time for a trip to the zoo. Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep" Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
Re: BtVS : Best Male
On Thursday, April 19, 2001, at 02:59 AM, Greg McCarroll wrote: > i seem to remember something about spike looking better with out his > bleached hair look according to MG Practically everybody looks better without bleached hair. > Also Oz might be the outsider here. Hm. There's something about Oz; maybe it's his laid-back attitude. But Riley, as Greg suggested at the meeting, is really BtVS' male bimbo. Doesn't do much (hence no need for a Riley.pm), but v. good-looking. Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
Re: Mourning clothes for London.pm
On Thursday, April 19, 2001, at 12:36 AM, David H. Adler wrote: > On Wed, Apr 18, 2001 at 04:43:09PM +0100, dcross - David Cross wrote: >> From: Mike Jarvis <[EMAIL PROTECTED]> >> Sent: Wednesday, April 18, 2001 4:30 PM >> >>> CNN reports that BtVS's SMG will wed Freddie Prinz. >> >> Why would that bother us? Remember, we're all Willow fans here. > > Heh. A friend of mine just asked me if I was upset about this, and my > response was similar... Likewise. However, to both I'd have to prefer Riley. Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
Re: The Natives are Revolting
On Thursday, April 19, 2001, at 12:12 AM, Neil Ford wrote: > On Thu, Apr 19, 2001 at 12:03:20AM +0200, Marcel Grunauer wrote: >> >> (Apologies if this comes through as HTML mail - i'm trying to get mail >> set up on OS X, but can't get nmh to work, so I'm using OS X's Mail at >> the moment. Will hack tools in Perl, though.) >> > Use Mutt :-) You'll have to re-compile ncurses (the port is > b0rked :-( ), but > it works lovely. > > Neil. I have installed mutt, but just can't warm to it. I like nmh, and using the Mail::Box family of modules, I'll rewrite those tools in Perl (sometime this summer, where there will be SpareTime). Until then, Mac Mail seems to do. It seems like a good opportunity to question taking the availability of a lot of things as a given. For example, nmh. And graphviz - just can't get it to work, and not just because of fonts. Or sendmail - I haven't really used it much, just to route my personal mail; but if certain basic tools were available in Perl, they'd run wherever Perl runs. Ah, independence. Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
Re: The Natives are Revolting
On Wednesday, April 18, 2001, at 11:55 PM, Neil Ford wrote: > One does have to wonder about someone called [EMAIL PROTECTED] :-) > Kinda say's it all > > Neil. > Apparently 13 years old. Bless. (Apologies if this comes through as HTML mail - i'm trying to get mail set up on OS X, but can't get nmh to work, so I'm using OS X's Mail at the moment. Will hack tools in Perl, though.) Marcel -- Damnit, where did the .sig go?
Re: Technical Meeting - 19th April
On Mon, Apr 09, 2001 at 04:56:28PM +0100, Struan Donald wrote: > > nowhere we might be tempted to sit by the thames till the wee small > hours generating tremendous hangovers :) "sit"? IIRC, you tried to lean against a bench but unfortunately were standing between two benches, landing on the ground face-down. Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
Re: Debian question ...
David Cantrell writes >is there an easy way of getting a list of all the packages which are >currently installed? I dislike dselect intensely, and the docs for >dpkg et al don't say anything useful. dpkg -l | grep '^ii' Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
Re: ISO8601 [was] Re: Pointless, Badly-Written Module.
Jonathan Peterson writes: >Please use: >ISO planet code, ISO country code, POSTCODE, Building Number[, apartment >number][, business name] [snippage] >Peterson, Jonathan >Earth, UK, W1H 6LT, 40, Ideashub >2001-03-21 > That works for the UK, but in Austria, post codes also require a street name, since post codes are too broad to identify individual blocks. And what if the Martians have completely different systems? What about coordinates of things moving through space (i.e. on their way to Mars)? I suggest introducing the concepts of "unimatrix", "grid" and "node". These can be extended into n-dimensional space. Enjoy. Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"
Re: Module of the Year contender...
>At Tue, 20 Mar 2001 17:01:19 +, Michael G Schwern <[EMAIL PROTECTED]> wrot >e: >> On the shoulders of such giants as Date::Christmas, Date::Discordian >> and Date::Tolkien::Shire stands Date::MMDDYY! >> >> http://search.cpan.org/search?dist=Date-MMDDYY >> >> Reason #120398 why I need to get CPANTS off the ground. Or IPAN, the Incomprehensible Perl Archive Network. Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"