Re: UI::Dialog Security Ideas
On Tue, Aug 20, 2013 at 11:39 AM, Kevin C. Krinke ke...@krinke.ca wrote: Hi all, I've just noticed (yes, I've been way out of the loop on my own projects for far too long) the user reviews of my module UI::Dialog. In particular: http://cpanratings.perl.org/user/avian What really spoils the good impression is that it's full of security issues. Don't use for displaying any untrusted strings as it is trivial to trick the module into executing arbitrary shell commands. I like using Tie::Function for providing interpolation-time sanitization for data that is to get interpolated. One could do something like this: use Tie::Function; tie our %SE, 'Tie::Function', sub {\Q$_[0]\E}; # Shell Escape and then whenever the module does a system call, wrap the tainted variables. That is, if you've currently got something like system($command $arg1 $arg2); # suboptimal, but works for this example that would become, assuming $command is coder-provided and the args are from the user, system($command $SE{$arg1} $SE{$arg2}); This approach also works well for entity-encoding data that goes in hidden field value elements in HTML forms, and preventing other types of code injection.
Re: Alien::XXX needs something more
and for windows is meant Strawberry, Activestate, Cygwin, or other?
Re: license information and link to source code repository from your CPAN distribution
Recently I checked and only 50% of the CPAN distributions have a link to a public version control system: http://blogs.perl.org/users/gabor_szabo/2013/01/50-of-the-new-cpan-uploads-lack-a-repository-link.html uh, CPAN /is/ a public version control system. You have a favorite VCS and want to make diffs easily? Download, unpack, init, add, commit, work, diff. I do admit I've started experimenting with adding github repos for my modules, but I'm not at all certain that it is any improvement, and demanding that as a requirement seems unnecessary. On the other hand, a comprehensive CPAN by git as an additional CPAN feature would have a measure of awesome to it, as an alternate distribution and synchronization method. The converse interpretation of the data -- fully half of new CPAN uploads contain a link to a non-CPAN VCS -- seems like a valid cause for celebration, rather than alarmed finger-pointing at the non-adopters. dln
Re: license information and link to source code repository from your CPAN distribution
On Tue, Jan 8, 2013 at 12:14 PM, Olaf Alders o...@wundersolutions.comwrote: uh, CPAN /is/ a public version control system. You have a favorite VCS and want to make diffs easily? Download, unpack, init, add, commit, work, diff. That doesn't sound easy at all. ;) For example, if you want to send a simple doc patch to an author who has the source code on Github, you can either jump through the hoops you're describing or a) fork the project on Github b) edit the file in place on Github c) click the pull request button That strikes *me* as much easier and you get built in request tracking. actually, for a small patch without an explicit VCS framework, the antediluvian workflow of unpacking twice, editing once, and using diff -U to make the patch is a little simpler. Of course you can't do that in a web browser that I know of. At some point I switched to mercurial for such one-offs, and as I'm still more comfortable with command line editing tools than editing in place on Github, my workflow for editing something that's on github still consists of checking it all out, editing it, then pushing it back. I should look into editing in place with Github's web browser editor.
Re: license information and link to source code repository from your CPAN distribution
On Tue, Jan 8, 2013 at 12:28 PM, John M. Gamble jgam...@ripco.com wrote: It was not intended as a constantly synchronized central repository of all of CPAN. That's what I meant, and it was something of a straw man.
Re: RFC: a universal tidier
On Sun, Apr 29, 2012 at 7:56 AM, Jonathan Swartz swa...@pobox.com wrote: Comments and suggestions for names welcome. Devel::MultiTidy? I like the Any:: name space for things that offer single interfaces to multiple back-ends. One could argue that Tidying really doesn't fit there though. And that argument could be countered with hypothetical examples involving large projects with different styles, enforced by different tidying engines, for different parts of it, and the desire for the scripts called at check-in time to run the correct tidying engine by looking up per-file metadata. -- In this document, the key words MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL are to be interpreted using situational ethics.
Re: Proposal for building module info
At the moment I have everything internally under a CPAN::Curation:: namespace, but if released separately I don't think that's appropriate. CPAN::Module::Metadata for the data class? CPAN::Module::GetMetadata for the builder? CPAN::Module::Metadata::Factory? I like Curation. Museums are cool. Strengthening the CPAN is Museum, with even more stuff in the basement than what you see by strolling through the galleries idea may help with the endless stream of criticism from people who want CPAN to be something other than what is is. -- Digital artists often sneer when they effect an effect because sometimes affect affects an effect's effect.
metacpan logo contest voting?
I like http://entries.contest.metacpan.org/2012/01/andy-walker-3.html the best but it isn't clear how to register this, aside from giving it a Google plus point. -- Digital artists often sneer when they effect an effect because sometimes affect affects an effect's effect.
Re: The CPAN Morass
Bzzzt! Anachronism. I hereby retract my proposal to refund Linda W's fees. Perl is, of course, four years older than Linux. On Sat, Dec 3, 2011 at 12:21 AM, Linda W perl-didd...@tlinx.org wrote: What compiler on linux -- where perl was born, would you suggest?
Re: The CPAN Morass
I would like to nominate Linda W. for receipt of a full refund of her CPAN subscription fees.
Re: MetaCPAN is quickly becoming the de-facto interface to CPAN
On Sun, Aug 28, 2011 at 2:38 PM, Arthur Corliss corl...@digitalmages.com wrote: Google switching to SSL by default is as pointless as metacpan. In the former case it's the protection of delivery to/from an entity that not only doesn't have your best interest at heart, but has a business built on exploiting *your* information for *its* benefit. Utterly pointless. I'll take this bait, swallow it, and hopefully bite off the line: Yes, Google is going to use query data for its gain. But, Google's business model also involves *aggregation* and *respecting individual privacy*. The SSL to Google Search is supposed to protect one from eavesdropping, as has been pointed out, by the other people in Starbucks. And it does this. Say you're sitting in Starbucks, searching for clues concerning an embarrassing medical condition. Your risk is, Mallory will intercept your packets and tell his buddies and they will huddle and point. If some Google tech sees your query among the millions of other queries and points it out to /his/ buddies and they huddle and point, that doesn't affect you the same way, if at all. They won't be pointing at you, the victim of an embarrassing medical condition, they will be merely pointing at an evidence of your existence. And such attention might actually bring more attention, in general, to the problem of severe triskaidekaphobia or whatever, which would be a good thing for you -- in the aggregate. The resulting open discussion of severe triskaidekaphobia might help lift the crippling stigma that has followed the victims for so long, without any unpleasant direct confrontations.
Re: Looking for people to take over maintenance of my Perl modules on CPAN
On Tue, Aug 2, 2011 at 11:03 AM, Terrence Brannon scheme...@gmail.com wrote: I read the docs for your Logic::Kleene ( http://search.cpan.org/~rrwo/Logic-Kleene-0.05/lib/Logic/Kleene.pm ) and although I cant imagine a practical case where I would return undef as opposed to an explicit true or false, my instinct tells me that this module might be useful. I'm not familiar with Kleene logic theory either, but i wonder if wedging in some kind of deferral completion semantic would make sense. Give a juggler enough coffee and he'll try to make everything both non-blocking and synchronous.
Re: MetaCPAN is quickly becoming the de-facto interface to CPAN
On Fri, Jul 29, 2011 at 8:17 AM, David Golden wrote: I think MetaCPAN is a great project and is evolving quickly, but hyperbole doesn't serve any real benefit. didn't someone here used to have sure it's hyperbole, but you can never have too much hyperbole as their .sig?
Re: Handling C++ structs with XSpp
Have you considered using Inline::CPP and writing your accessors as needed? Its another layer of indirection, but there may be fewer surprises.
Re: CPAN In The Comics
we could finish the composition Hey I code all day Well I code all night It's been six days since I saw sunlight I'm in troglodyte mode Troglodyte mode Got the Algol rhythm Got the Assam blues The lab is empty I took off my shoes The lights are out sunglasses on glowing pixels syntax errors . On Wed, Mar 23, 2011 at 11:01 AM, John M. Gamble jgam...@ripco.com wrote: Rhymes With Orange has a perlish flavor today: http://www.rhymeswithorange.com/2011/03/March-23-2011/ For those of you with worse eyesight than mine, the modules listed are: Algorithm::Checkdigits SMS::Send HTTP::OAI Congratulations Mathias Weidner, Adam Kennedy, and Tim Brody. -john -- simple interpolable credential obfuscator: perl -ple 's/(.)/sprintf \\%03o,ord $1/ge;'
One possible future of parsing Graph::Easy input texts
On Sun, Mar 20, 2011 at 6:42 PM, dhu...@hudes.org wrote: In terms of considering parser improvements or reimplementation, the first step is to come up with a formal grammar for the language. Preferably a Context Free Grammar (CFG) expressed in BNF or EBNF. Once we have that we have options - any of several Perl implementations including Parse::Yapp / Parse::Eyapp - using bison to generate a parser in C and then gluing that in with XS or even Inline::C One could describe the Graph::Easy format grammar as a state machine, draw the state machine with Graph::Easy, then implement a parser from your diagram, with Graph::Easy::StateMachinehttp://cpan.uwinnipeg.ca/htdocs/Graph-Easy-StateMachine/Graph/Easy/StateMachine.html , for a future Graph::Easy that is self-hosting. How cool would that be or what? -- This is not a 'bug'. Being documented, it is merely a 'restriction'. -- Intercal manual
Re: One possible future of parsing Graph::Easy input texts
On Mon, Mar 21, 2011 at 4:04 PM, dhu...@hudes.org wrote: An interesting concept but describing the syntax as a grammar is not the same as an FSA. The FSA is part of the parser and lexer. I disagree. State Machine is a powerful abstraction that is useful in many places. The thing about parsing and Perl is that your lexer can be based on regular expressions which Perl of course understands itself. Regardless, the first step is to come up with a formal grammar. The RHS of the productions are calls to Graph::Easy. Regular expressions describe state machines, for instance. Regex is a descriptive (opposed to procedural) language. So is Graph::Easy. At this time, we have a working parser for Graph::Easy regardless of how it was created. While a formal grammar is wonderful for documenting that language, why are we looking at replacing the parser in the first place? what size /complexity input is causing such a performance problem? Or is that new features for the language are desired and it is difficult to implement them in the existing system? Yes, yes! Perhaps Shlomi will explain exactly what the itch is that he's scratching? I'm just guessing: does the existing Graph::Easy have issues with mixed-direction unicode? -- simple interpolable credential obfuscator: perl -ple 's/(.)/sprintf \\%03o,ord $1/ge;'
Re: best practices for module renaming
On Tue, Feb 8, 2011 at 6:29 AM, David Cantrell da...@cantrell.org.uk wrote: On Mon, Feb 07, 2011 at 08:59:40PM +0100, Xavier Noria wrote: Hi, I am the author of Net::FluidDB, which let's you talk to FluidDB. FluidDB has been renamed to Fluidinfo, and I should rename the module in accordance. Is there a recommended way to do this? Or should I just upload a different distribution and document the rename? I'd upload a new distribution, rename the module, and also include a backward-compatibility wrapper module. I would do nothing until there is a change in Fluidinfo that makes the FluidDB module stop working. I would also continue to use the old name inappropriately to annoy the marketeers. And if the change really is name-only, I might upload a very light Fluidinfo module that simply aliases the name space -- probably using direct symbol table manipulation, instead of using the Alias module.
Re: Top level naming suggestion
Before I upload the code (which is already written, for all methods MetaCPAN allows, and more) to CPAN and Github, I just wanted to know that taking a top-level namespace here makes sense and get any input on it. Here are some notes: 1. It does not use Mechanize, LWP, or anything for which the WWW:: namespace would make sense. naming something after its implementation details doesn't make sense. Including the name of a framework in the name of a plugin makes sense, but that's different. 2. Tiny and concise, as to be an official completely workable API implementation (currently using Mouse - or rather, Any::Moose - and HTTP::Tiny). 3. I prefer not to bury this inside a low namespace (WebService::PerlRelated::MetaCPAN::API::Implementation::Sawyer). 4. I've spoken to Olaf Alders from MetaCPAN and he assured me they have no problem with the name, and that they would use it themselves once it's out. how about MetaCPAN::API since that's what it provides? So MetaCPAN::FAQ and MetaCPAN::Server can be at the same level. But that's redundant isn't it; if one wants to use MetaCPAN one is going to need to use the API -- including ::API may be toxic clarity.
Re: Discussion question: what is the best syntax for documenting a coderef parameter?
On Wed, Dec 8, 2010 at 7:59 PM, Eric Wilhelm enoba...@gmail.com wrote: If you can, avoid the need to document I will pass a callback to your callback. --Eric Continuation-style programming requires that all the time.
Discussion question: what is the best syntax for documenting a coderef parameter?
The pod for AnyEvent::Handle contains SNIP on_connect = $cb-($handle, $host, $port, $retry-()) This callback is called when a connection has been successfully established. The peer's numeric host and port (the socket peername) are passed as parameters, together with a retry callback. SNIP Is C$retry-() the best way to represent that a coderef is required there? It's clear, but I would have written it C\retry. And I would have written something confusing. I think Marc Lehmann has done it the right way.
Re: What hurts you the most in Perl?
We hear the same argument in reverse that people should work on Perl 5 instead of Perl 6, as if the people who are working on Perl 6 would _of course_ be working on Perl 5 if 6 didn't exist. There's no reason to think this is true, and many reasons to think it's not. Many Perl 6 people never contributed to Perl 5 the way they do with 6. Maybe there are others that said that, but I have said something related and I want to be more clear. I wasn't attributing this idea to you. The idea that Perl 6 has drained development resources from Perl 5 has come up many times over the years. For some reason this reminds me of the idea that's come up several times, that learning DBIC is quicker and easier than learning SQL if you don't know SQL already. Another idea I don't agree with, although I concede the idea that people would be working on Perl 6 if it weren't for Perl 5 focus is pure assumption based on no real evidence; much like the idea above. As I recall, there was something of a glut of volunteers in 2000 gumming up the perl 5 maintenance works: one thing the perl 6 project immediately succeeded at was, reduce the noise in p5p. Also: ECMAscript is a standard, and is perfectly fine for what it is, migrating systems other than client-side web page automations to it continues to be wise. Also: going the way of FORTRAN or COBOL looks, based on statistical facts, to be a good thing -- an immense installed base of mission-critical systems -- opposed to, say, going the way of Simula or ALGOL, and being a fascinating historical footnote. COBOL is the rivets in Big Iron. -- It is merely a matter of persistence. -- Albert Camus
Re: Reducing rsync cost (was: Re: Using a better compression than .gz for one's CPAN modules)
On Mon, Nov 22, 2010 at 4:37 AM, David Landgren da...@landgren.net wrote: Yeah, this is the killer. In an ideal world, we would kill the symlinks such as authors/id/*, modules/by-category/*, modules/by-module/* and so on. These could be recreated via shell scripts locally on mirrors for people who wish to maintain these legacies. Cutting that out would diminish the rsync burden considerably. David or re-engineer CPAN as a sqlite+FTSE database, and re-engineer the mirroring process as a database mirror via a TBD compact database diff protocol (I have no intention of doing any of this myself; good morning) -- It is merely a matter of persistence. -- Albert Camus
Re: Please advise before I submit to CPAN
one surprising aspect of perl is that Cbless affects the object, not the reference, so it is possible to rebless things, which is handy if you use package-based state machines D:\perl -le bless $o=[],'abc';print $o; sub f{$l=shift; bless $l,'DEF'} f $o; print $o abc=ARRAY(0x3e5444) DEF=ARRAY(0x3e5444) because after C my $self = shift you can bless $self and the invocant will get reblessed. So whenever anyone says a Perl object is a blessed reference they're speaking procedurally, not descriptively. Descriptively, a Perl object is a reference to a blessed thingy. (I think that's correct terminology, please correct if wrong)
Re: Storable Stream - Module namespace help
On Sun, Aug 8, 2010 at 4:58 AM, Marco Neves [ModAuthors] perl-module-auth...@knowhunter.cjb.net wrote: Hello, In need for a way to transfer a large amount of small datastructures I created a module that stores and retrieves a stream of storables in a file. I'm confused -- a stream can't be stored in a file, because it is continually generated. Also, what is different about this freezer/thawer that makes it superior to, for instance, YAML or compressed Data::Dumper dumps? That is, for what general class of use cases would one prefer the Neves data marshalling system to the available others? Also, if you're reusing other things in it -- you say storables are you doing something like prefixing length and colon to the output of Storable and jamming a bunch of those together? -- the underlying technology and then stream might make sense, especially if it can take an open handle instead of a file name in its constructor. Such a thing could be nice for creating an abstracted pipe between distributed processes for instance.
Re: Roles on the CPAN
package that; use Moose; with 'fries'; # do we want this?
Re: Frozen Bubble 2.2.1
It appears that your use case -- you want to publish the beta version on CPAN without having the non-beta-testers get it too -- is not supported by xdg's essay. I see two possible approaches: 1: leapfrogging. Release the beta versions with version numbers that are less than the latest release version. This approach might require some planning, possibly including bumping the version number on the current stable to make space. The beta testers will have to jump through something of a hoop, depending on their tools and skill with them, so you'll have to support them in that. 2: release beta versions in an entirely separate name-space, so instead of having the beta after Awesome::Application 3.003 having confusing version number just call it Awesome::Application_betatest 3.004 and let them coexist. Some research may be required to figure out the best way to do that -- you don't want CPAN.pm pulling in the Betatest version of something unreleased because it includes something that it thinks is a proper upgrade, for instance. The additional end-user control over what code is participating in the testing, for a module, with less risk, could be good, too, for a module.
Re: Opinions about constants
On Thu, Jul 29, 2010 at 3:28 PM, Bill Moseley mose...@hank.org wrote: Wondering what you use for constants in your modules. I actually do stuff like BEGIN { my %SmallEnglishNumbers = qw/ ONE = 1 TWO = 2 TWELVE = 12, INF = -1 , ZAPHOD = 42 /; my $block; while (my ($k,$v) = each %SmallEnglishNumbers){ $block .= sub $k() { $v }\n; } eval $block 1 or die Whoops, botched block:\n$block\n with err:\n$@ } pretty regularly. The thing Constant:: will give you that this approach doesn't is dualvars.
Re: Usage of wantarray
On Wed, May 12, 2010 at 7:08 AM, Shlomi Fish shlo...@iglu.org.il wrote: On Wednesday 12 May 2010 00:55:13 Lutz Gehlen wrote: Hello everybody, recently, I read the following statement in a CPAN Ratings entry: this package also uses wantarray (a transgression amongst interface sensibilities). Cwantarray is how to distinguish between array, scalar, and void contexts. When you want to distinguish between numeric, string, scalar-ref, array-ref, and hash-ref scalar contexts, Coverload works for that. The sensibilities allegedly transgressed may be peculiar to the author of that comment. -- To avoid both financial loss and jail time, we provide security mechanisms, including access control. -- Mike Burrows, 2006
Re: When and how to throw exceptions?
On Fri, Apr 9, 2010 at 1:54 AM, Ovid publiustemp-moduleautho...@yahoo.comwrote: (Javaesque psuedo-code): try { customer.read(); } catch ( Exception::IO::NotFound e ) { ... } catch ( Exception::IO::CantOpen e ) { ... } catch ( Exception::IO::CantRead e ) { ... } catch ( Exception::IO e ) { ... } catch ( Exception e ) { panic(I don't know what type of exception I have! . e); } Yeah, the example is overkill :) The point here is that you try more specific exceptions first and drill down to less specific ones, including a catch-all exception. However, what happens if you get rid of the NotFound, CantOpen and CantRead? If the exception thrown is one of those types and assuming they're really subclasses of Exception::IO, then the Exception::IO catch will catch them rather the incorrectly falling through to the panic. If these were merely shoved in a hash, you'd have to try to fall back to parsing either the messages (or the key) to figure out that you don't really have a panic. I've never understood what's wrong with using string exceptions for this kind of thing. Maintaining a discipline about properly dieing is required both ways, and defined ($nextline = INPUT) or die IO CANTREAD: eof on INPUT?' seems more concise than abstracting an exception type hierarchy behind a class hierarchy only to unabstract it later: eval { $customer-read(); 1 } or do {{ # double openers to create block to last out of my $e = $@; $e =~ m/^io notfound/i and do { ...; last }; $e =~ m/^io CantOpen/i and do { ... ; last }; $e =~ m/^io CantRead/i and do { ... ; last }; $e =~ m/^io /i and do { ... ; last }; die $e UNEXPECTED; # filename, line number, newline added by die }}; Either way, you still need to maintain the meaning of the string prefixes or the various exception types in a project-wide data dictionary. I don't want to start (or restart) some kind of big argument; my understanding is that coders coming from a Java background simply prefer to use classes for everything.
Re: Trimming the CPAN - Automatic Purging
It hasn't been done because its outside of the scope of design for rsync. It's meant to sync arbitrary filesets in which many, if not all, changes are made out of band. It's decidely non-trivial to implement in that mode unless you're willing to accept a certain window in which your database may be out of date. But, in a situation like PAUSE, where the avenues in which files can be introduced into the file sets is controlled, it does become trivial. It's the gatekeeper, it knows who's been in or out. so the requirements for the Solution To The Problem Which Solves A More General Problem Than The Immediate Problem And Will Therefore Make Whoever Sets It Up A Hero include a replacement for the current mirroring technology stack that is tailored to mirroring distributions possibly including on-demand caching and expiration and that is trivial to install -- something like perl -MCPAN -e 'install STTPWSAMGPTTIPAWTMWSIUAH::Mirrorsuite' nohup nice nice perl -MSTTPWSAMGPTTIPAWTMWSIUAH::Mirrorsuite -e 'mirror cpan.org .'
what's a good name for a pure-perl OnScopeExit mechanism?
local_onExit is how it is now http://davidnicol.diaryland.com/onExit.html The semantics should be exactly the same as Scope::OnExit, but the syntax is somewhat convoluted, abusing the Clocal mechanism as it does. Scope::OnExit::PurePerl would seem to imply the same syntax, which would be misleading. -- question doubt
Re: Trimming the CPAN - Automatic Purging
On Wed, Mar 31, 2010 at 10:45 AM, David Landgren da...@landgren.net wrote: On 31/03/2010 06:52, David Nicol wrote: new proposal: Make modules pay rent in order to remain on a mirror. Rent could be in the form of actual user interest, or good reviews. Use as a dependency could count as rent. Put a value tag on things and people will game the system to ensure their files are up on top. Doomed to failure. I'm not suggesting that there be any kind of who-is-on-top game, the game is who falls out the bottom. If someone cares enough to want to game the system to ensure their files don't fall out, those files will surely stay. pay rent here is intended to mean something like tracking usage over a long period in order to authoritatively identify old and useless based on metrics and a policy. Especially combined with a Dnews-like trick file server that's really a cache and only stores things people actually ask it for, which responds to the OP's pain as I understand it, which is a frustration that their CPAN mirror contains a lot of cruft. Although it still isn't clear why that is a problem. Purpose-based partitioning could be performed like deferred sidewalks: put the pavement where the students make the trails in the grass.
Re: Trimming the CPAN - Automatic Purging
On Sun, Mar 28, 2010 at 2:32 PM, Elaine Ashton eash...@mac.com wrote: On Mar 28, 2010, at 12:48 PM, Randy Kobes wrote: Has some sort of disk quota system for CPAN author accounts ever been considered? Not specifically, no, at least not that I'm aware of. That would have to be implemented on PAUSE and quotas frequently end up not solving the real problem and create a headache both for the sysadmin and the users. new proposal: Make modules pay rent in order to remain on a mirror. Rent could be in the form of actual user interest, or good reviews. Use as a dependency could count as rent. Or simple downloading. A mirror server that functioned more as a cache than a mirror would also work: only the files that are actually requested need be stored, as long as the mirror server knows how to get something else if requested. If the root cause of The Pain turns out to be full mirroring then do partial mirroring, and automate the partition with a policy instead of trying to plan the partition. -- question doubt
Re: Help with naming a module
I like the word Foliage. Also, there are many here among us who cannot help but smirk at the sight of the word shrubbery. Smirking is good.
Re: RFC: Proposal to simplify, speed-up /i regex matching while fixing things
On Sat, Dec 26, 2009 at 7:37 AM, Dr.Ruud rvtol+use...@isolution.nl wrote: Is there a module that provides a Cfc keyword that foldcases its input? No unfortunately not. Its a good idea tho, it would be useful. There is: perlapi ibcmp_utf8 to_utf8_fold Unicode::UCD::casefold() to_utf8_fold would be the thing to wrap and apply over a string or multiple strings to create the subroutine exported by the module, called foldcase or fc. I'd use it isntead of lc in code that parses configuration files, allowing non-ascii keywords that could still be case-insensitive.
Re: Why you don't want to use /dev/random for testing
there's always http://fourmilab.ch/cgi-bin/Hotbits?nbytes=128fmt=hex although I don't know what their massively parallel availability is. Probably less than google charts. -- http://twitter.com/HankSwap tweets approximately every 36 hours using random delays. Promotional excerpts are fair use!
Re: module name for test data?
you could put the word corpus in there somewhere, since you're publishing some test data. For others to use it, who might be looking for test data, that's what a corpus is in test data jargon (i believe.) Test::Corpus::audio::mpd would set an example of publishing test data to CPAN under the Test::Corpus prefix.
Re: I'd like a way to abandon a module
On Thu, Aug 13, 2009 at 7:38 AM, Andy Lestera...@petdance.com wrote: On Aug 13, 2009, at 6:43 AM, Adrian Howard wrote: Make an ABANDONED PAUSE user and give modules to it? I thought of that, but unless somehow the modules came out of PETDANCE into ABANDONED's directory, I still look like the owner. Rig some automation so ABANDONED verifies the legitimacy of the abandonor, then gets the latest version, bumps the version number, adds some THIS MODULE IS AVAILABLE FOR ADOPTION boilerplate, and republishes? -- I don't listen to what art critics say. I don't know anybody who needs a critic to find out what art is. - Jean-Michel Basquiat
Re: Naming advice for retry manager module
On Tue, Apr 21, 2009 at 3:11 PM, Bill Ward b...@wards.net wrote: Something like Object::Retry maybe? Then things can inherit from it? The proposed module sounds more like a has-a than an is-a. Or maybe just a new method that would get included in the caller's namespace. Set the defaults at import time, then call it with a single coderef: use retry MIN_SLEEP = 3, MAX_SLEEP = 10, TIMEOUT = 120 my $asdf_server_connection; retry sub { $asdf_server_connection = connect ( (new socket), ...) or die } # whatever the retry::retry routine would be something like sub retry::retry($) { my $start_time = time; my $result; for(;;){ eval { $result = $_[0]; 1 } and return $result; my $E = $@; $LOGGER and $LOGGER-( $E invoked from @{[caller]}); time - $start_time $TIMEOUT and die $E\n; sleep ($MIN_SLEEP + rand ( $MAX_SLEEP - $MIN_SLEEP )) } } Everything in all-caps would be retry:: package variables, or scalars tied to a per-caller(1)[0] hash to mitigate AAAD surprises. Or incorporated into the particular Retry::Object, as you are wisely suggesting. I've written stuff like that often enough that it would be cool to be able to have a standard name and API for it, too. -- Your appreciation is my glorious gratuity. -- Herman Melville on IP rights
Re: Science, Engineering, Craft (was once: something about hash references)
On Tue, Mar 3, 2009 at 6:54 PM, Eric Wilhelm enoba...@gmail.com wrote: Perhaps we should charge by the pound for CPAN modules? Not lines of code, but some kind of metric which appropriately conveys heft (toughness/strength/finish are, of course, premium.) Executions without problem? That would be a hella software metric. The pie would have to get spread really thin to even bother with it. Maybe they made the wrong decision in '68 with regard to letting vendors charge for software. Better model: software is not a product; the service is the product. Software quality can (must?) be driven by liability concerns? -- Nah, we straight.
Re: Name for barcode-reading module?
http://www.barcodehq.com/primer.html#READERS seems to indicate that decoder would be the term to use. On Sat, Feb 21, 2009 at 11:58 AM, sawyer x xsawy...@gmail.com wrote: I think Barcode::OCR depicts by the name exactly what it does. It does OCR of barcodes. Perfect. The rest I would have to open to read what they do exactly. Barcode::OCR is sself explanatory, IMHO. But doing OCR of barcodes is ambiguous. Optical character recognition often captures style info as well as character sequences, at least the one that came with my scanner a few years ago does, and very well too -- scanning magazine articles into pdfs resulted in images that looked just like the pages, except that the text in the middle of the page was clipboardable while towards the spine, where things got skewed, there was a big vertical image -- I was, and remain, impressed. Based on that as an experience with OCR, I might expect Barcode::OCR to somehow allow barcodes to pass through an OCR process intact, perhaps by adjsuting image compression parameters within their boundaries. I think Barcode::Decoder depicts by the name exactly what it does. It decodes barcodes. Perfect. The rest I would have to open to read what they do exactly. Barcode::Decoder is sself explanatory, IMHO. -- Freedom's colors are red, white and black and blue.
Re: RFC: String::Tagged
there is also intersection with the concept of ropes rather than strings as I understand the term,
Re: RFC: String::Tagged
On Fri, Jan 30, 2009 at 2:46 PM, Paul LeoNerd Evans leon...@leonerd.org.uk wrote: On Fri, Jan 30, 2009 at 02:00:13PM -0600, David Nicol wrote: there is also intersection with the concept of ropes rather than strings as I understand the term, A rope is a data structure designed to make string concat an O(1) operation, where you store a tree, or a linked list of substrings. That isn't the case here - in fact, the string data itself is just stored in here as a single perl string. The tags are stored in as a list of [start, length, name, value] objects beside it. The other advantage is that the substrings can have attributes.
Re: Module for base 85 encoding
On Mon, Nov 24, 2008 at 12:56 PM, Bill Ward [EMAIL PROTECTED] wrote: How about contacting the owner of Math::Base85 and see if you can somehow join forces? It seems to me this would make sense to have a single module that can output in either format. 1: RFC 1924 is an April fool. Those who are not aware of that need to be. See http://en.wikipedia.org/wiki/Ascii85#RFC_1924_version 2: joining forces or subclassing Math::Base85 or otherwise using it is silly as it would create a finished good containing more glue than wood. http://search.cpan.org/src/TMONROE/Math-Base85-0.2/Base85.pm reveals two trivial functions, both quite readable and therefore not particularly inspired in terms of efficiency hacks; for instance the letter=number encoding could be done as an array of values indexed by chr($d) or pack/unpack with the N specifier for translating between binary strings and 32-bit big-endian, presumably both features present in Mr. Clark's to-be-unveiled String::Base85 module. Unless he followed MIME::Base64's example closely and wrote them in C. -- signature closed for repair
Re: Module for base 85 encoding
On Mon, Nov 24, 2008 at 1:26 PM, David Nicol [EMAIL PROTECTED] wrote: present in Mr. Clark's to-be-unveiled String::Base85 module. Unless I meant to write String::Ascii85, I stand with Darian Anthony Patrick in that preference.
Re: Integrating license related things of CPAN
On Sun, Oct 26, 2008 at 1:08 AM, Jonathan Rockway [EMAIL PROTECTED] wrote: If I use Term::ReadLine and it picks the Term::ReadLine::Gnu, is my module GPL now? JR may neither know nor care, but I think I know and I'd like to hear about it if I've got it wrong. No. You haven't distributed Term::ReadLine::Gnu. Making you a party to the goings-on in someone else's domain because you set up the possibility for that someone else to do something that they did is absurd. -- DN
Re: What's up with all these people uploading stuff under their own name.
As someone who claimed a top level CPAN domain and have been uploading things into it since (Tipjar::) some time ago, the reasons are: (1) branding good things (2) not sure if my basic things deserve to be at top level status (tipjar::fields) which is a policy I have abandoned (Macrame)
Re: Regulating Module Authorship
On Mon, Sep 22, 2008 at 10:57 AM, Aristotle Pagaltzis [EMAIL PROTECTED] wrote: * Dave Rolsky [EMAIL PROTECTED] [2008-09-22 17:55]: Note that this differs from ratings, which I don't find very useful at all. Agreed. And trust networking is how humans are wired anyway. formal trust metrics can be gamed. That's also how humans are wired. -- Fifteen million dollars just isn't what it used to be
Re: Regulating Module Authorship
On Mon, Sep 22, 2008 at 4:03 PM, Aristotle Pagaltzis [EMAIL PROTECTED] wrote: formal trust metrics can be gamed. That's also how humans are wired. Sure, but not to any useful extent if they are person-centric and there is no worthwhile gain. There is no spam in my RSS reader and none in my Twitter timeline. Okay, I concede: Once again I'm spouting straw men. Last year's flap with the possibly deliberate compromise of Debian ssh occurred at a high ring of trust that would have been the same with or without formal metrics. Or would formal metrics have raised flags early? Please, readers of the lists to which I post, alert me off-list if you feel David Nicol has been too free in sharing hypothetical contrarian positions of late; I'm experiencing guilt about wasting people's valuable time. (this, and the recent flip-flopping WRT autodie semantics.)
Re: Carp::nosigdie - needs a better name
On Wed, Sep 3, 2008 at 3:12 PM, Eric Wilhelm [EMAIL PROTECTED] wrote: Also, as a debugging tool, I would rather be able to just load the module from a perl option. yes, absolutely. Until I saw your usage example I did not get how you use this handy tool. Since the localizing is the thing you are trying to catch, how about including that in the new, improved name? Furthermore, you're enforcing a stricture, rather than enhancing Carp. Here's a briefly considered suggestion: perl -Mstrict::sigdie yourprogram.pl Maybe some day this will be a best practice: use strict; use strict::sig::die; calling it strict::sig::die opens up the strict::sig:: space for future development of pragmata that enforce strictures about other entries in %SIG, too. hopefully the amount of wind that leaks in after this opening of the door to discussion of best practices and $SIG{__DIE__} will not be unmanageable.
Re: Devel::Callsite is a better instance key than join $;,caller()[1,2]
On Wed, Aug 13, 2008 at 3:09 PM, Ted Zlatanov [EMAIL PROTECTED] wrote: I get paid by the number of CPAN modules released, so yes, this will be Devel::GetContext, one function per module :) I laughed BM If you want calls to every(5) to only return true once every five times BM even across forked processes, your going to need some sort of IPC, BM obviously. It's actually not hard to do, just tie the hash to a shared memory segment with Tie::ShareLite and ignore the $$ and context() uniqueness. But I really doubt Every.pm should provide it, it's a solution in search of a problem. it depends how far out you want your everyness context to extend, one might want to every on a condor cluster or something.
Devel::Callsite is a better instance key than join $;,caller()[1,2]
=head1 NAME Devel::Callsite - Get current callsite =head1 SYNOPSIS use Devel::Callsite; sub $site { return callsite() }; print $site-(), \n; # prints one number print $site-(), \n; # prints a different number =head1 DESCRIPTION This function returns the callsite (a number) one level up from where it was called. See the tests for an example. It's useful for functions that need to uniquely know where they were called, such as Every::every() (see CPAN for that module). =head1 HISTORY Written by Ben Morrow on perl5-porters. CPAN-ified by Ted Zlatanov. =head1 AUTHOR Ben Morrow [EMAIL PROTECTED] Ted Zlatanov [EMAIL PROTECTED] =cut -- don't let the perfect become the enemy of the good -- some politician on CNN
Re: Devel::Callsite is a better instance key than join $;,caller()[1,2]
On Thu, Aug 7, 2008 at 11:01 AM, Ted Zlatanov [EMAIL PROTECTED] wrote: I plan to add the interpreter (Perl context, actually) address when I get a chance, Ben Morrow was kind enough to point out what I was missing. Then it will be more correct than the current version. Does anyone know if the context address is unique in mod_perl and with threads? If not, what can I do? Ted it seems like if it isn't, extending the instance key using the pid and tid would be best made the application developers problem. Suggesting an approach in the Devel::Callsite documentation by providing example code that produces an instance key that will be valid in forking and threading environments, would make more sense IMO than spoiling Devel::Callsite's focus. -- don't let the perfect become the enemy of the good -- some politician on CNN
Re: Port to PyConstructs
On Sat, Jul 12, 2008 at 1:50 AM, Shlomi Fish [EMAIL PROTECTED] wrote: http://construct.wikispaces.com/ In short, it's a library that parse binary structs. Cool! http://dev.perl.org/perl6/rfc/122.html
Re: Name space: throwing exceptions easily
On Wed, Jul 2, 2008 at 5:44 PM, Aristotle Pagaltzis [EMAIL PROTECTED] wrote: * Aristotle Pagaltzis [EMAIL PROTECTED] [2008-07-03 00:25]: No one would say that they are trying to achieve slowness or inflexibility. Drafted any mission-critical change control policies recently?
Re: Must exist, right?
this presumes a hash-based object instead of a field of a hash-based object, but it can have blessed members unlike Chris Dolan's draft; it also takes multiple args to be slice keys rather than consecutive accesses into a deep AoA. Wrapping in an import function and the niftiness with closing over $fieldname has been left out, UNTESTED. package autoaccessor::ReadOnly; sub new { shift; # lose package name bless shift #return what we were given, it had better be a hashref } sub AUTOLOAD{ our $AUTOLOAD; $AUTOLOAD =~ /::DESTROY$/ and return; my ($fn) = $AUTOLOAD =~ m/([^:]+)\z/; my $obj = shift; # closed-over fieldname trick goes here my @args = @_; # without args, presume hash lookup of $fn @args or return $obj-{$fn}; # try access styles to see what works my @retval; if (wantarray){ eval [EMAIL PROTECTED] = @{$obj-[EMAIL PROTECTED];1} and return @retval; eval [EMAIL PROTECTED] = @{$obj-[EMAIL PROTECTED];1} and return @retval; }else{ eval [EMAIL PROTECTED] = @{$obj-[EMAIL PROTECTED];1} and return $retval[0]; eval [EMAIL PROTECTED] = @{$obj-[EMAIL PROTECTED];1} and return $retval[0]; } Carp::croak( Cannot figure out how to access $fn member of $obj) } 1; __END__ =pod Andy A's initial example would become package main; my $my_foo = new autoaccessor::ReadOnly { foo = [ 1, 2, 3 ], bar = { eat = 'drink', sleep = 'wake' }, }; my $two = $my_foo-foo( 1 ); my $drink = $my_foo-bar-eat; =cut
Andy differentiation
Armstrong: Hexten, London. Lester: Petdance, Chicago.
Re: Must exist, right?
Considering that Data::Dumper is entirely regular in how it will present a deconstruction of the data structure, and you have a clear concept of how you wish the example structure === accessor set thing to work, it's certainly possible, and would take maybe two hacking sessions to get right (provided you don't get swept into the lake by a mini-tsunami.) It seems like something that might not exist already, as the need to share that kind of meta-abstraction is felt by only extreme show-offs (such as various people on this list) To make your example DWITYM, Data::Auto::Objectify::Thing would presume that the structure returned by its caller has a Cnew that will return a fully populated example object when called with no arguments, and would postpone defining the accessors until the INIT phase, because the {caller()::'new'} does not exist yet at Cimport time. I would have Data::Auto::Objectify::Thing take an optional C example = ... import arg in addition to the wait-until-INIT trick, and would bless the substructures into constructed-named packages under Data::Auto::Objectify::Thing::Packages::... for example. Tipjar::fields creates accessors for named fields by imposing array object semantics on its calling package; recently I prefer to use :lvalue subroutines for accessors rather than defining both get* and put* s. In your example, you are planning on subclassing MyFoo into a whole family of kinds of hash-based objects that share this accessor set, or something. It's not clear if the elements are supposed to be extensible or not. If they aren't extensible, and there is a fixed set of them, using an array-based object and naming all the slots with lvalue accessors is the way I would do it sub new { bless [], shift }; BEGIN{ my $counter = -1; eval join '' map {$counter++; ACCESSOR} (qw/one two three eat sleep/) sub $_ : lvalue { shift()-[$counter] } ACCESSOR }; but of course I don't know exactly what you are trying to do.
Re: How to declare dependency on other modules?
On Fri, Apr 11, 2008 at 5:39 PM, Ricardo SIGNES [EMAIL PROTECTED] wrote: I don't see a really good way to automate this. -- rjbs start with an index of packages to distributions, grep the module source for Cuse statements, there you are. The function that converts the list of use statements into the dependency list would be yet another thing that the cpan.org web site does, and creating the draft section of the Makefile.PL file or equivalent could be achieved, from the module author's perspective, with something like make cpandep.
Re: Ideas for soc, Looking for mentors
shorewall-perl might be a place to start; shorewall comes up zero on cpan search, yet is a big perl program; so converting it to an O-O module should be a simple matter of time and coffee :) On Tue, Mar 18, 2008 at 5:20 PM, Eric Wilhelm [EMAIL PROTECTED] wrote: # from Juan Luis Belmonte # on Tuesday 18 March 2008 14:19: Im thinking in a module to manage iptables in an object oriented, and dynamic way. Hi Juan, That sounds like an interesting idea. Have you looked on CPAN, sourceforge, etc for prior art? -- At the bottom of this huge heap of promotional strategies, there's a product trying to chew its way out
Re: Distributing C code
On Mon, Mar 17, 2008 at 12:45 PM, Guy Hulbert [EMAIL PROTECTED] wrote: Inline::C may be easier but I don't know how much it is used. It's used less than it used to, thanks to this guy: InlineX::CPP2XS Convert from Inline C++ code to XS. InlineX-CPP2XS-0.12 - 19 Sep 2007 - Sisyphus InlineX::C2XS Convert from Inline C code to XS. InlineX-C2XS-0.12 - 19 Sep 2007 - Sisyphus
P($n,$r) and C($n,$r)
I've written a couple of little recursive routines that provide arrays or arrayrefs of arrayrefs of all the possible permutations and combinations, of sets of n items, counting from 0 to n-1, and wondering if such a thing is worth cluttering up CPAN with. I'm using them for this crazy four-dimensional chess board... -- A vote for anyone other than Ron Paul is a vote to continue paying income tax
Re: Naming convention for thin wrappers around C libfoo.so ?
On Dec 10, 2007 5:17 AM, Dominique Quatravaux [EMAIL PROTECTED] wrote: +1, imho it makes good sense to have (some future version of) Cache::Memcached depend on Lib::Memcached. me too
Re: With the Macrame macro system, Perl may now be a Lisp.
On Dec 6, 2007 6:23 PM, Bill Ward [EMAIL PROTECTED] wrote: Cute experiment, but I REALLY hope nobody tries releasing useful modules to CPAN that depend on this... Thank you After it has line number support it will be more practically useful. I'm sort of stuck on how much records of line numbers of expanded rewrites to keep and how to encode them into the filename portion of the #line comment. imagine: #line 1000 fileF.pl use Macrame; # line comments apply to the next line; this is line 1000 macro cheddar {cheese} warn cheddar; macro warn_wisconsin { warn cheddar} warn_wisconsin; __END__ the easiest thing is to keep line number information that is available during lexing and output the line number whenever it changes in the stringification: #line 1002 fileF.pl warn cheese; #line 1003 warn cheese; __END__ next tricky is to have an macros inherit their line numbers from wherever they are invoked, giving #line 1002 fileF.pl warn cheese; #line 1004 warn cheese; __END__ even if the warn_wisconsin macro is several lines long is it worth the trouble to have warnings inside macros show a full expansion history as a debugging aid? That's the current goal for the next release, with a history syntax of appending something to the filename portion of the eventual comment: #line 1002 fileF.pl warn cheese; #line 1004 fileF.pl:1003 warn cheese; __END__ when macros start appearing in different files from where they are expanded, the debugging comments will start looking something like #line 765 applicaiton.pl:maclib.pm:8970:234:basic_macros.pm:22 -- Common sense has prevailed
Re: With the Macrame macro system, Perl may now be a Lisp.
On Nov 30, 2007 7:24 PM, Jenda Krynicky [EMAIL PROTECTED] wrote: I'm missing the reason-for-being of the module it its docs. I read the whole documentation and the test script and I still don't get it. What is it supposed to be used for? Sorry, Jenda polymorphic functions / more complex prototypes creating new syntax without dealing directly with unlexed source inlining small oft-used code snippets without all those pesky function calls perl advocacy to Lisp snobs (':)') -- wheels reinvented while-U-wait
With the Macrame macro system, Perl may now be a Lisp.
Macrame 0.08 finally passes a variety of tests and has been uploaded. Please harangue it via rt.cpan.org.
what's the right way to test a source filter?
so I am closer than ever to releasing my way-cool source filter module, which is based on Filter::Simple. Big question: how do I write the test script?
Re: Name for EscapeCage
On 6/30/07, Eric Wilhelm [EMAIL PROTECTED] wrote: A dangerous animal in a sandbox will probably get out. so the most standard term i believe is jail
Re: Name for EscapeCage
String::Sandbox ??
Re: Name for EscapeCage
On 6/29/07, Bill Ward [EMAIL PROTECTED] wrote: No a sandbox is where you have a practice area where changes made have no lasting impact. For example ebay and paypal have sandbox areas where you can experiment with applications that use those services without actually buying anything. This is more of a quarantine. http://en.wikipedia.org/wiki/Sandbox_%28disambiguation%29 lists both a computer_security and software_development variant.
Re: Need naming advice
does it do SSO? It provides a generic user account management system, with features such as: [...]
Re: line numbers with Filter::Simple
On 6/1/07, Rocco Caputo [EMAIL PROTECTED] wrote: caller() is a good solution. I use it, Filter::Util::Call, and some involved #line magic to maintain sane line numbers in Filter::Template. I am preprocessing the code to add line number identifiers between all lines, then when I process the code I pull them out and tag all my lexemes with line numbers, and remove the line number IDs from the quotelike array. In a routine invoked by FILTER_ONLY, the initial line appears to be caller(3)[2] here's my line numbering code, from soon to be released Macrame.pm recursive and lexical macro system Like the name? I think its better than Macro::sweet, which was the runner-up in my fevered brain :) sub doMacrame{ $_ = (transform treeify($_))-Stringify; }; sub AddLineNumbers { my ($line, $file) = caller(3)[2,1]; my @lines = split /\n/, $_; my @linesout; for (@lines){ if ( # see perldoc perlsyn /^\# \s* line \s+ (\d+) \s* (?:\s(?)([^]+)\2)? \s* $/x ){ ($line, $file) = ($1,$3); $file =~ s/([^\w\/\\-\.])/sprintf(#%X#,chr($1))/ge; next; }; # push @linesout, $line++, '$file'); # $source =~ s/^#line (\d+) (.+)/__Macrame_LINE($1,$2)/mg; push @linesout, '__Macrame_LINE('. $line++.,$file); push @linesout, $_; }; $_ = join \n, @linesout; }; FILTER_ONLY all = \AddLineNumbers, code = \doMacrame, all = sub { print begin filter output-\n; print; print\n-- end filter output\n; };
line numbers with Filter::Simple
We can declare a line number, in source code, like so # perl foo #line 54 die smiling foo smiling at - line 54. # and counting newlines within a Filter::Simple code block is easy enough but how do I find out what line to start at, so I can insert #line comments into my filter output that will match the input? I am about to experiment with caller(N) to see how many frames back to go, then I'll use that, but I am asking here in case anyone knows a better way.
Re: taxonomy for data-structure modules?
On 5/26/07, Ken Williams [EMAIL PROTECTED] wrote: I think that's part of it. But another problem is that many people don't know the official names for the data structures they're thinking of, e.g. trie or skiplist or whatever, so they can't search very effectively for it. It does seem like a user-applied keyword tagging scheme on CPAN (e.g. search.cpan.org) would be very fruitful and would go a long way toward solving a lot of the organization-related problems people bring up on this list. -Ken Does perlmonks have a wiki with a data structures section? Wikipedia has loads of data structures documents on it -- for instance, http://en.wikipedia.org/wiki/Skiplist has links to SkipDB and an implementation in C#. Creating a norm of linking data structure modules from the wikipedia article on the structure in question would do the trick using existing infrastructure, as would other proposals that do not demand tiers of new services appear from nowhere.
anybody feel like translating some PHP to Perl?
http://news.com.com/2100-1029-6186430.html -- It is not possible to make a mistake. (customary greeting given by Bokononists when meeting a shy person)
Re: peer review for first CPAN module? (JavaScript minification)
On 5/25/07, Joshua ben Jore [EMAIL PROTECTED] wrote: You may want want to convert from UTF16 to perl native strings, then convert back. JavaScript is defined as being stored in UTF16 but that's kind of unusual elsewhere. Isn't it? As Dr. Ruud said; also, ECMAscript engine authors (at least David Leonard) seem to regard normalizing everything to UTF8 as equally bizarre. The Xerxes XML parser, for instance, uses 16 internally.
Re: (Create a new ?) namespace for applications on CPAN
On 5/23/07, Andy Lester [EMAIL PROTECTED] wrote: I meant about his irrelevant parallels to program being what you get at the opera, and script the lines of a play. So if you find non-geek usage irrelevant, what is the scope of the target demographic whose usage you seek to correct then? -- It is not possible to make a mistake. (customary greeting given by Bokononists when meeting a shy person)
script or program?
On 5/22/07, Andy Lester [EMAIL PROTECTED] wrote: On May 22, 2007, at 11:07 AM, David Nicol wrote: I'm trying hard to get people to stop saying script when referring to their Perl programs. I'd prefer that we not use it anywhere at all. outside of computers, script is a better term for the carefully tuned deliverables that software engineer produce than is program. Your basic mundane citizen considers a program a list of things that will occur in an evening, or a document they are handed when they occasionally get out to the opera, while script is something mysterious, yet cruciual for the production of television shows, produced by professionals who are legendary for failing to get the girl. None of that has any bearing on the sort of change in thinking I'm working on. Okay, Andy Petdance Lester, vent your spleen. We're all ears.
Re: (Create a new ?) namespace for applications on CPAN
On May 17, 2007, at 4:08 PM, Andy Lester wrote: I'm trying hard to get people to stop saying script when referring to their Perl programs. I'd prefer that we not use it anywhere at all. outside of computers, script is a better term for the carefully tuned deliverables that software engineer produce than is program. Your basic mundane citizen considers a program a list of things that will occur in an evening, or a document they are handed when they occasionally get out to the opera, while script is something mysterious, yet cruciual for the production of television shows, produced by professionals who are legendary for failing to get the girl.
towards TERN::macro (was Re: LISP module from CPAN)
On 5/10/07, Adrian Howard [EMAIL PROTECTED] wrote: On 9 May 2007, at 21:37, David Nicol wrote: [proposed macro syntax example:] macro hashkeyaccessor(fieldname) { sub fieldname { $_[0]- {fieldname}} }; hashkeyaccessor $_ for qw/FIELD NAMES GO HERE .../; [summary of benefits of approach] What am I missing? You're missing that you can execute code at compile time that determines what code you generate. I disagree, I think I included that, and you didn't see that I had. so to be fully lispy the extension would need to support defmacro keylookup(key) { $_[0]-{key}} defmacro hashkeyaccessor(fieldname) { sub fieldname { (keylookup fieldname) } }; (hashkeyaccessor $_) for qw/FIELD NAMES GO HERE .../; as well as www.gigamonkeys.com/book/macros-defining-your-own.html Some devils brew of source filters and eval is the closest you'll get in Perl 5 Perl 6 with its explicit lexer/parser should give you the full power of Lisp style macros. the debate response to that is, show me something besides syntax succinctness you can do with a LISP macro that you cannot do with such a code-generated string eval Adrian (recovering Smug Lisp Weenie :-) That's fun link, the story of Mac the programmer, who eventually retires. The article contains this: * When you write macros, you're writing programs that will be * used by the compiler to generate the code that will then be * compiled. Only after all the macros have been fully expanded * and the resulting code compiled can the program actually be run. * The time when macros run is called macro expansion time; this * is distinct from runtime, when regular code, including the code * generated by macros, runs. this separation of times sounds exactly the same as putting an eval of generated source in a BEGIN block. Adding a source filter to the brew has to potential to allow for succinctness and clarity that is absent from the generated source situation due to the trickiness of escaping sygills appropriately (easy to get wrong, but you only have to get it once right, then it stays working) Later in the chapter, gigamonkeys admits that LISP macros also suffer from the fact the human brain was not originially designed for programming computers: * In other words, you'll write a macro-writing macro: a * macro that generates code that generates code. While * complex macro-writing macros can be a bit confusing * until you get used to keeping the various levels of code * clear in your mind LISP feature: macros that produce macros. Perl equivalent: evalling generated source to produce functions to eval generated source. Can do it, yes. And it is a slightly bigger PITA than using LISP syntax. If I find the time to put what I learned about source filters while exploring writing a tail recursion optimizer (final result: there are too many edge cases: if you really want tail recursion optimization, learn about Cgoto subname and use it) into making my own macro syntax filter which will work as exampled above, it will work as follows: (1) remove pods and comments and abstract out quoting constructs; (2) identify defmacro constructions, whatever they look like, convert them to coderefs that take parameters and return the body as evallable strings; (3) identify expressions including defined macros, and run those expressions immediately (4) expand macros, even embedded in expressions, in results from (3) (5) allow for macros declared in macro expansions to join the list of declared macros from that point on (6) allow for lexical scoping of macros (7) allow for predeclaration of macros (? is this useful) (8,...) extend macro language What's already on CPAN: http://search.cpan.org/~segv/Macro-0.2/Macro.pod Essentially what I'm describing, but with a clunky Parse::RecDescent syntax that may be more complex than doing it yourself; and with a bugs/todo list at the bottom that restates various points made above -- I will start with Macro-02 instead of from scratch if I do this http://search.cpan.org/~autrijus/Filter-Macro-0.11/lib/Filter/Macro.pm misleadingly named, Filter::Macro appears to be Pollute::Persistent plus hints accomplished through source filtering. TERN (The Extensible Rewriting Notation) mailing list, http://lists.nongnu.org/mailman/listinfo/TERN-discuss The Take away David Nicol's internet access committee mailing list, (...) -- practical solutions to systemic problems
Re: LISP module from CPAN
On 5/9/07, Vadim [EMAIL PROTECTED] wrote: I consider eval $string as a replacement of macros. for instance, I did the following in a curl wrapper package, to make the curlies optional around the fieldnames: BEGIN { for (qw/ BUFFER CALLBACK DATA EVENT FAILURE FETCHTIMEOUT GET MAXAGE MAXSTALE MESSAGE NOCACHE POST READY STARTED UH URL USER/){ eval FIELD; sub $_ : lvalue { \$_[0]-{$_} } FIELD }} What would that look like in LISP?
Re: LISP module from CPAN
so if there were lisp-like macros available in perl, my sugar example might be something like the following? macro hashkeyaccessor(fieldname) { sub fieldname { $_[0]-{fieldname}} }; hashkeyaccessor $_ for qw/FIELD NAMES GO HERE .../; and I would save the trickiness of getting the interpolation level right. That is imagining a CPP macro... the LISP idea on macros is that the template would be created at the optree level rather than the source level, but its still a template and replacement kind of deal. What am I missing?
Re: How to name module for CPAN for common lisp connection
could your approach be made to work with the Inline:: framework? On 5/6/07, Vadim Konovalov [EMAIL PROTECTED] wrote: I want to publish perl-to-lisp bridge module to CPAN. It connects existing LISP implementation to Perl, which turns out to be robust LISP out from perl (as opposed to toy implementations).
Re: LISP module from CPAN
On 5/8/07, Vadim [EMAIL PROTECTED] wrote: no, it uses CFFI, so this should cover every implementation supporting that. Ever since reading Hackers and Painters http://www.amazon.com/exec/obidos/ISBN=0596006624/tipjartransactioA I've been defending Perl is a LISP! (which is actually quite easy, because nobody knows what I'm talking about) Are there a lot of libraries and things written to CFFI? Perl could provide a CFFI interface, that would strengthen the perl is a lisp meme.
Re: New version of perl
On 5/1/07, Adrian Howard [EMAIL PROTECTED] wrote: http://search.cpan.org/~hooo/perl-0.0017/ I suppose a new release of Pollute should handle modifications to the hints variable. -- practical solutions to systemic problems
Re: Module Proposal: Parse::Reversible
has anyone mentioned xeger yet in this discussion?
Re: Licenses in a commercial application
On 3/20/07, Adam Kennedy [EMAIL PROTECTED] wrote: Gabor Szabo wrote: On 3/18/07, David Golden [EMAIL PROTECTED] wrote: If you install your program, but say And since it installs Perl, you can also use it to write your own Perl programs! that would be overtly making the interfaces visible. If all the user ever see's is buttons and widgets, it's just fine. IANAL however. Adam K I am not a lawyer either, but I used to think I would become one -- and I think that you could even provide a script operations in this system using an application-specific dialect of the Perl language facility without violating anything. This section is presumably included to prevent commercial distributions of programs written in Perl from competing with the parallel open source distributions of Perl that are intended to encourage innovation and contributions to Perl itself. I think the Artistic License explicitly allows forking Perl. The fact that nobody has successfully pulled this off has to do with the reward to effort ratio and the bad effects of no longer being compatible with man release perl, not a legal motivation. Given the choice of installed perl to run a perl script with, I would much rather have the command line switches and so on than have to sneak an eval statement into a regular expression in an e-mail filtering system. Unless I wanted to work around access control permissions or something. Which is another reason not to allow evaluation of user-provided code, the insecurity implications. -- When the day comes that anyone can bend our country's laws and lawmakers to serve selfish, competitive ends, that day democratic government dies. And we're just optimistic enough to believe that once the facts are on the table, American public opinion will walk in with a big stick. -- Preston Tucker, June 15, 1948
Re: Licenses in a commercial application
specifically, paragraph 4.c: [you may distribnuted modifed Perl provided you] give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. So, something like Whizzomatic can be automated by writing whizz-scripts, using Perl! (To obtain Perl, see http://perl.org) would allow commercial distribution under 4.c. Para 8 allows Perl to fit into the bigger picture much like a compiler -- compile an executable and distribute the executable, that's not a distribution of the compiler. Compose an aggregation of perl and a perl script and distribute the aggregation, that's not a distributioon of Perl.
Re: Looking for a factory name
On 1/19/07, Paul LeoNerd Evans [EMAIL PROTECTED] wrote: That wasn't the intention, it's really just looking to find a class that is already installed and usable, that itself declares ability to be what you asked for. so the invention in a module that facilitates creation of portable modules by abstracting things that happen to have more than one ways to do them to a level where Factory::LeoNerd takes a specification of what functionality is required and looks at the available options -- say you want to send e-mail from your module but you don't know what other modules pertaining to e-mail sending are installed on the target, you can add Factory::LeoNerd::Email as a dependency for your CPAN module and it will make sure that the functionality is supported somehow while providing the usee with whatever Paul finds to be the best interface to that function? I doubt that I got it right that time either Dave -- Q: How do I decode unix seconds-since-the-epoch timestamps? A: xterm -T TIMESTAMP_TRANSLATOR -e perl -ple'$_= ~~localtime$_'
Re: Looking for a module name
is there a DesignPattern:: section? I did not take the time to fully understand your explanation but the gist I got was that you are comfortable with design patterns nomenclature. I know there are at least some documentary CPAN modules concerned with DP in Perl, but do not know if DP-based abstraction modules that are named for the various patterns have been organized so DP-versed coders can easily find them. hopefully someone better versed in Design Patterns lingo will also respond.
gnome planner file format?
Has anyone written a perly interface to the gnome planner file format? It's XML so it's going to be basically a breeze, but I'd rather re-use someone else's tool if available.
Re: Modules dealing with data files
On 11/10/06, David Landgren [EMAIL PROTECTED] wrote: I suppose it will default to the site_perl directory if run in batch mode, but interactive installations allow the directory to be specified. OS distribution maintainers may wish to override the default (how? an environment variable à la PERL_G_F_P_PATH=/usr/local/share/doc/insee?) A non-standard installation procedure that runs the package through a transform while installing it, allowing the path to be written into the installed module. Alternately, a .pm interface to the location of the file, just like the .pm interface to the URL of the publicly available data, but generated at install time. package Geography::FR::Postcode::INSEE_FILENOM; sub import { *{caller().'::INSEE_FILENOM'} = sub(){'/usr/local/share/doc/insee'} };1; __END__ You'll have to customize the build and install scripts either way though. -- perl -le'1while(1x++$_)=~/^(11+)\1+$/||print'
simple tail recursion code optimizer based on B::Deparse and eval
getting the invocation syntax right was kind of tricky since my first thought, which was that writing to $_[0] would overwrite the symtab entry for a subroutine when the optimizer was invoked tr_optimize(\function) turned out to be incorrect -- it will work with globs though -- no support for anonsubs or other alternate invocations although I'm leaving the name-based invocation in below for your inspection. There is obviously a lot of room for improvement especially in complex return arguments -- I'm not sure how to do a match for balanced parentheses, for instance, and sometimes Deparse terminates the return with a semicolon and sometimes it doesn't. Here's what I have just gotten working, it does deep deep deep recursion with no stack size increase: package Acme::TailRecursionOptimizer; use Exporter; @EXPORT = qw/tr_optimize/; use B::Deparse; our $dp = B::Deparse-new(qw/ -P -q -x7/); use Carp; use constant DEBUG = 0; =pod invoke tr_optimize with a glob reference to an existing subroutine. tr_optimize will replace the subroutine with a tail-recursive version that clobbers @_ so shift everything out of @_ before returning anything within your routine. complex return expressions will probably break it at this time as the code filter is not very smart. =cut sub tr_optimize($){ # my $subroutine_name = shift; # my $cp = caller(); # exists {$cp\::$subroutine_name} or # croak arg must be function name in current package; ref($_[0]) eq 'GLOB' or croak arg must be glob ref, like \\*func; my $sub_in = \{$_[0]}; # don't shift, we're going to # write back to $_[0] # my $sub_in = \{$cp\::$subroutine_name}; my $p = prototype($sub_in); $p = (defined($p)? ($p) : ''); my $deparsed = $dp-coderef2text($sub_in); DEBUG and print DEPARSED TO:\n$deparsed\n; # explicitize implied return on final statement # FIXME # rewrite return calls as goto-sub calls # the matching part of this could obviously be improved $deparsed =~ s/\breturn\s+(\w+)([^;\n]*)/do{ [EMAIL PROTECTED]($2); goto \$1}/g; DEBUG and print REWROTE TO:\n$deparsed\n; my $sub_out = eval sub$p$deparsed; $sub_out or die eval: [EMAIL PROTECTED]; DEBUG and print EVALLED TO:\n, $dp-coderef2text($sub_out),\n; *{$_[0]} = $sub_out; # *{$cp\::$subroutine_name} = $sub_out }; 1; __END__ use Acme::TailRecursionOptimizer use constant DEBUG=1; sub recursor2 { $x = shift; return recursor2(1+$x) if$x21;$x }; sub recursor3 { # print args: @_\n; $x = shift; $x % 1000 or print $x\n; if($x 21) { return recursor3(1+$x+recursor2(20)); };$x }; # tr_optimize('recursor2'); # this one could be made to work # tr_optimize(\recursor2); does not work as expected # tr_optimize(*recursor2); nor this DEBUG and print BEFORE:\n, # ... $Acme::TailRecursionOptimizer::dp-coderef2text(\recursor2),\n; tr_optimize(\*recursor2); # this one works DEBUG and print AFTER:\n, $dp-coderef2text(\recursor2),\n; DEBUG and print BEFORE:\n, $dp-coderef2text(\recursor3),\n; tr_optimize(\*recursor3); DEBUG and print AFTER:\n, $dp-coderef2text(\recursor3),\n; print Expect a return w/o OOM -- we're counting up from -10\n; print recursor2(-10); print Expect a return w/o OOM -- we're counting up from -10\n; print recursor3(-10); -- Although efforts are under way to mitigate the problem, this message may contain flippancy, hyperbole and/or confusing assertions. Please reply directly to [EMAIL PROTECTED] for clarification of any points appearing unclear, vague, cruel, frustrating, threatening, negative, dilletantish or otherwise unprofessional before taking action based on misintepretation or misconstruction of such points.
framework for tail recursion in pure perl, including Ackerman function
the attached proof-of-concept is almost as ugly as my coroutines module on CPAN, but i have succeeded in implementing a tail-recursion framework in pure perl. In order to use it, all modifications to recursive function arguments must be made directly into @_, but a method is suggested for using named arguments nonetheless instead of returning a value, the recursive routine must assign to $_[0] when a result has been achieved the magic of nonautovivifying nonexistent hash elements in argument lists is used to allow the recursive routine to return undef, if that is what it needs to return, by assigning undef to its $_[0] The Ackerman function expressed with the framework might look something like sub Ack { tr_dispatch(SUB=\tr_Ack, ARGS=[EMAIL PROTECTED]); } sub tr_Ack { my ($x, $y) = \(@_[1,2]); $$x == 0 and ( $_[0] = $$y + 1, return); $$y == 0 and ($$x--, $$y=1, return); $$x-- ; $$y= tr_dispatch(SUB=\tr_Ack, ARGS=[$$x, $$y - 1]); } Comments welcome, especially interface improvement ideas. -- David L Nicol
Re: framework for tail recursion in pure perl, including Ackerman function
On 8/30/06, Andy Armstrong [EMAIL PROTECTED] wrote: Sorry, I've missed something here - how is your 'framework' superior to a simple queue based approach? it demonstrates tail-recursion, as such, and is not intended to be a superior approach to other practices. I just realized that goto sub is a better framework for implementing such things, anyway: # perl -wle 'sub f{ f()}; f()' Deep recursion on subroutine main::f at -e line 1. Out of memory! # perl -wle 'sub f{ goto f}; f()' ^C # Oh and I can't believe you've only skimmed HOP - it's a superb book that should be mandatory reading if this is an area you're interested in. so was the textbook in Lisp class.
Re: framework for tail recursion in pure perl, including Ackerman function
On 8/30/06, Andy Armstrong [EMAIL PROTECTED] wrote: I don't think goto sub can really be described as a framework... Or if it can may I start describing if() as a decision support system too? I won't stop you :) But why are you showing us this stuff? Who is it for? I'd have thought that anyone who was interested would have already read HOP and/or worked it out for themselves. the question is, Is anyone interested in a framework for more explicit support of tail recursion optimization module? Who on this mailing list do you believe is interested in your investigations? Oh and I can't believe you've only skimmed HOP - it's a superb book that should be mandatory reading if this is an area you're interested in. so was the textbook in Lisp class. I'm surprised it covered Perl. Why is everyone being so difficult the last month?
Re: Give up your modules!
On 8/14/06, James E Keenan [EMAIL PROTECTED] wrote: In the subsequent discussion, people suggested that we need the following: 1. Place for current module authors/maintainers who wish to transfer maintenance of certain modules to so indicate. 2. Place for people who are willing to take over maintenance of CPAN modules to so indicate. 3. (And this is the delicate part ...) A way to encourage authors/maintainers whose code needs transfer to a new maintainer to effect that. My hunch is that if we get (1) and (2) up and working, it will be easier to accomplish (3). jimk Is not this mailing list both 1 and 2? Without some kind of centralized subscription service its difficult to come up with a business case for setting up systems to satisfy the mandate of 3. OTOH, a centralized subscription service that guarantees maintenance and support of modules downloaded therefrom may or may not fly. I don't think it would work; at least not any better than activestate's vetting of what becomes a PPM. -- David L Nicol all your grammar nit are belong to us
Re: This Week on perl5-porters - (12-18 June 2006)
On 6/22/06, David Landgren [EMAIL PROTECTED] wrote: Could Perl get Reversible Debugging? [...] We need a come from instruction http://xrl.us/nnuw I don't recall reading a demand for a come from instruction in that thread, but I had an idea last night that I was going to dismiss as trivial, until reading that assertion in the week in p5p summary. It's a real simply come from instruction that forks at the labels instead of branching. Not suitable at all as a replacement for goto -- if you want to branch, use goto. But may be useful for setting checkpoints/breakpoints with a minimum of surgical insult. package ComeFrom; use Exporter; @EXPORT_OK = qw/CFL ComeFromLabel CFlabel/, # all the same thing qw/ComeFrom CF/; # also all the same thing our %SubsByLabel; sub ComeFrom($\){ my ($label, $sub) = @_; push @{$SubsByLabel{$label}}, $sub; }; sub ComeFromLabel($;){ my $label = shift; foreach my $sub (@{$SubsByLabel{$label}}){ unless(fork()){ #fixme: check for -1; install sane SIG_CHLD handler, etc goto $sub; # keeping what's left of @_ after shifting off the label exit; # we're not trying to make fork bombs here } } }; # establish more than one way to do it: *CFL = *CFlabel = \ComeFromLabel; *CF = \ComeFrom; =head1 USAGE Register subroutines with the ComeFrom system with the ComeFrom::ComeFrom instruction like so: ComeFrom Jellybean = sub { print At ,~~localtime(), the bean count was , CountBeans(),\n }; Later this label can be jumped to -- this subroutine dispatched, or called, but in its own process (that's the crucial difference between this mechanism and a simple subroutine call -- subtle semantics) by inserting a 'JellyBean' CFlabel into some code that may be affecting the bean count: ... CFL 'Jellybean'; ... =head2 Differences Between ComeFromLabel and normal subroutine call * ComeFrom execution happens in own process * Multiple ComeFrom subroutines can be associated with a given label * CFL markers can be trivially edited to #CFL no-ops after debugging =head2 Why Bother? This functionality is a trivial subroutine redispatcher. In the event that it is easier for you to write your own than install mine, please don't let me stop you. =cut __END__ So.. shall I put this on CPAN? -- David L Nicol if life were like Opera, this would probably have poison in it -- Lyric Opera promotional coffee cup sleeve from Latte Land
Re: Unresponsive? How about dead?
On 4/25/06, Steve Vance [EMAIL PROTECTED] wrote: I know there is a FAQ about module authors who are unresponsive. But I'm talking about one who is unresponsive, and his e-mail addresses all bounce, and his website is gone, and, well, I fear for the worst. Insert Monty Python Dead Parrot Sketch references here. Anyway, if someone is unresponsive and never coming back, what do we do then? maintain their modules without them and prefix their names with memorial underscores -- David L Nicol Document what you do, then do what you documented