Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Smonff

by Smonff (Scribe)
on Oct 24, 2012 at 13:38 UTC ( [id://1000638]=user: print w/replies, xml ) Need Help??

I am a Perl culture enthusiast since 2011.

Currently working for the Music Industry, I try to build tools using the Modern Perl toolkit, but also Debian, Docker and a bit of JavaS‎crip‎t.

Other hobbies:

See my git repos to discover more.


Posts by Smonff
Mnemonic for begin/end chars in regexes in Seekers of Perl Wisdom
9 direct replies — Read more / Contribute
by Smonff
on May 12, 2023 at 06:14

    Twelve years I started with Perl and I still can't remember EVERY TIME which one between ^ and $ anchor should be used to match begin and end of regex pattern 🤔

    Any mnemonic or memory aid? I can use a cheat sheet, but come on…

    Thanks.

    Note: this is a cross-post from plush.city

    🌸
Diary of a Zydeco experiment - E04 - Renaming in Meditations
No replies — Read more | Post response
by Smonff
on Jan 08, 2021 at 11:16

    This is the fourth episode, and after Diary of a Zydeco experiment - E03 - Errors for fun and success, I came back here to deliver some news. The project is not progressing much since I had to move recently and have to renovate a house. I never spent so much time away from my machine (how sad).

    Anyway I am seriously thinking about changing the namespace for the Art::World project and move it to the Acme:: namespace... This thing looks more and more like an experiment that will surely never be used by anybody except me and I see it humbly as an artwork by itself, but I guess it will be the final project. It's not like people would start to use it as a dependency. Or maybe only for showing examples of my bad coding practices.

    Since September 22nd, a small amount of tasks have been started:

    • switched the project to only one large module, trying to make it the Zydeco way,
    • moved the ideology documentation to a separate pod
    • added Underground, Space and Market roles
    • Nested playground and Place classes
    • Added Event, Opening, Sex, Collective, Magazine, Institution, Squat, Workshop, Website, Critic, Article, and Book classes
    • Applied Collector type constraints on class Artist and role Collectionable
    • Removed the Wildlife class since it is redundant with Art::World Agent
    • tobyink suggested the removal of duplicated attributes in nested classes
    • added a Fame role and moved the Agent reputation there
    • forced the Collector->collection to be composed of Artwork(s)
    • listed contributors of the project
    • created various Collector methods like sale() or acquire()
    • tried to use Type::Tiny more efficiently and upgrading to its last version that offered non quoted types constraints for attributes (see RT #133448)
    • adding a Makefile
    • introduced Conf::Tiny
    • added a minimal Meta toolkit
    • limited Perl version to > 5.24.0
    • Event is now a Role, not a Class because we do composition, not multiple inheritance
    • enabling the postderef feature everywhere because we are so MODERN
    Finally, it was quite a lot... Cant wait to rename to Acme::Art::World !

    🌸
Ressources for Acme namespace cultural implications in Seekers of Perl Wisdom
3 direct replies — Read more / Contribute
by Smonff
on Jan 08, 2021 at 10:16

    Hi dear Monks and happy new year to everybody.

    Got a Perl culture request. I am searching for some information (presentations, conferences, articles, etc.) about the Acme::* namespace, it's purposes and cultural meanings in the Perl community. For now, I have this list:

    Ruth Holloway described Acme as:
    A testing ground for the release process, so that a new contributor learns how to create and release new modules before doing something more serious
    In Advanced Perl Programming it's written that
    The Acme:: modules use extremely advanced or clever techniques in order to do something totally frivolous
    and that
    The Acme namespace was set aside for wacky, explosive, or Heath-Robinsonian modules, and has very quickly become one of the more densely populated namespaces on CPAN.
    For what I can understand the CPAN Acme namespace is for Perl experiments. But I also see it as a namespace for a kind of conceptual art (not only ASCII art and stuff), but really art that is made of Perl, about Perl. What makes me think of this is Acme.pm that seems to be only an auto-reflexive module all about the glory of CPAN and modularization. Those things could very much be displayed in a Museum of Modern Art, I wouldn't complain. By the way is there any records of Perl code entering the Museum? Aside than running the website ^^... I guess I kind of answered my own question by asking, but I am sure some Monks would like to give more guidelines. Thanks for reading!

    🌸
*::Tiny modules namespace origins in Seekers of Perl Wisdom
6 direct replies — Read more / Contribute
by Smonff
on Oct 08, 2020 at 05:18

    I am searching for a cultural or historic answer here.

    What's the idea behind the *::Tiny modules namespace, like Role::Tiny, Path::Tiny or Type::Tiny? I see and use more and more of them and would like to have a better cultural understanding of their underlying origins. In the past (I only started to use Perl circa 2011), I saw a lot of the similar *::Simple namespace modules and liked them quite a lot (I like easy to use things) and wonder if there is a different meaning or intention or if this is only because most of the namespaces where already taken, so Tiny is kind of a synonym for Simple?

    I am sure some respectable monk would have some clues about this. Thanks!

    🌸
Diary of a Zydeco experiment - E03 - Errors for fun and success in Meditations
1 direct reply — Read more / Contribute
by Smonff
on Sep 22, 2020 at 15:29

    So today for the third episode of this diary, and after Diary of a Zydeco experiment - E02 - History, I would like to share a nice error message that I encountered while working on the modeling of my project. It can look strange to be happy about encountering an error message, but this one made my life really easier. It is still not about Zydeco directly but about one of the stable technology it relies on. Please don't look too deeply at the examples, they are mostly sarcastic but not very well structured on the OO side for now.

    So we have this role, that summarize very naively what a Buyer can do:

    # lib/Wildlife/Behavior/Buyer.zydeco.pm role Buyer { requires money; method acquire ( Num $price ) { say "I bought !"; } method sale ( Num $price ) { say "I sold !"; } }
    There is also an Exhibit role, that I will show only for the fun, but it is mostly distraction at this point:
    # lib/Place/Behavior/Exhibit.zydeco.pm role Exhibit { has exhibition ( type => ArrayRef ); has artist ( type => ArrayRef ); has artwork ( type => ArrayRef ) method display { say "Shoooow"; } }
    Then we have a Gallerist class, that consumes the Buyer role. You will maybe notice that there is a tiny mistake in this class (we'll come back a bit later on the mistake so don't look too much):
    # lib/Art.pm package Art { use Zydeco; class Place { has space; include Place::Behavior::Exhibit; include Wildlife::Behavior::Buyer; class Gallery with Exhibit, Buyer { has artwork ( type => ArrayRef ); has artist ( type => ArrayRef ); has event ( type => ArrayRef ); has owner; has public; } } }
    A test:
    # t/gallery.t use v5.16; use Test::More; use Art; my $gallery = Art->new_gallery( space => 1000, exhibitions => [ "Foo", "Bar" ], owner => "Arty Person", money => 10_000_000 ); ok $gallery->does('Art::Exhibit'), 'Gallery does role Exhibit'; ok $gallery->exhibitions, 'Gallery got an exhibitions attribute'; ok $gallery->owner, 'Gallery got an owner'; can_ok $gallery, 'acquire'; can_ok $gallery, 'sale';
    Let's run it! But it won't go very well.
    smonff@padi:~/projects/Art-World$ prove -lv t/15_gallery.t t/15_gallery.t .. Can't apply Art::Buyer to Art::Gallery - missing + money at /home/smonff/perl5/perlbrew/perls/perl-5.32.0/lib/site_perl +/5.32.0/Moo/Role.pm line 307. BEGIN failed--compilation aborted at (eval 269) line 1. at /home/smonff/perl5/perlbrew/perls/perl-5.32.0/lib/site_perl/5. +32.0/B/Hooks/EndOfScope/XS.pm line 26. Compilation failed in require at t/15_gallery.t line 3. BEGIN failed--compilation aborted at t/15_gallery.t line 3. Dubious, test returned 2 (wstat 512, 0x200) No subtests run Test Summary Report ------------------- t/15_gallery.t (Wstat: 512 Tests: 0 Failed: 0) Non-zero exit status: 2 Parse errors: No plan found in TAP output Files=1, Tests=0, 2 wallclock secs ( 0.03 usr 0.00 sys + 2.00 c +usr 0.10 csys = 2.13 CPU) Result: FAIL
    What I want to focus on is the Can't apply Art::Buyer to Art::Gallery - missing money part.

    The error message is launched by a croak call in the _check_requires() method of Role::Tiny.

    croak "Can't apply ${name} to ${to} - missing ".join(', ', @requir +es_fail);

    Once we add the right attribut to the Gallery class, everything goes well:

    class Gallery with Exhibit, Buyer { has artwork ( type => ArrayRef ); has artist ( type => ArrayRef ); has event ( type => ArrayRef ); has owner; has public; has money; ... }
    And we run the tests again:
    smonff@padi:~/projects/Art-World$ prove -lv t/15_gallery.t t/15_gallery.t .. ok 1 - use Art; ok 2 - Gallery does role Exhibit ok 3 - Gallery got an exhibition attribute ok 4 - Gallery got an owner ok 5 - Art::Gallery->can('acquire') ok 6 - Art::Gallery->can('serve') ok 7 - Art::Gallery->can('sale') 1..7 ok All tests successful. Files=1, Tests=7, 2 wallclock secs ( 0.03 usr 0.00 sys + 2.30 cus +r 0.16 csys = 2.49 CPU) Result: PASS
    We actually don't even need to check the attributes in details.

    What I found amazing is how the error message makes sense. It just tells what should be done to fix the problem: adding a money attribute to the Gallery class. But more than that, it have a deeper meaning, that is exactly the point og this project. I mean you wouldn't have an art gallery with zero money would you? This is what I call efficient and reliable object oriented programming thanks Zydeco making a great use of the stable technologies it is built on (like Role::Tiny).

    So far, my overall use of Zydeco is very satisfactory during the application modeling phase. Some could say that I could draw some class diagrams and not coding, but the Zydeco use is so easy and non-verbose that it really make possible to focus ont the modeling and not on the coding: focusing on listing attributes, methods, roles and their relationship, not on the implementation.

    Next episode is mostly news from the brand new 2021 year...

    🌸
Diary of a Zydeco experiment - E02 - History in Meditations
No replies — Read more | Post response
by Smonff
on Sep 15, 2020 at 04:03

    So here is the history of what lead me to Diary of a Zydeco experiment - E01 - Introduction. This is a long term continuation of an art project started circa 2006.

    In 2005, I got a metal box and colored carton cards and called this Le Fichier. It was basically a database of artworks ideas. I was trashing all ideas I could have of serious or weird potential artworks. It was inspired either by Roland Barthes, who was actually working with those kind of cards, Georges Perec, who was exploring potentialities, and Édouard Levé Oeuvres, a huge catalog of potential artworks (he later comited suicide after describing his own Suicide in a book).

    2006 I initiated a FileMaker database of artworks to put the old style carton cards in computer form. I had no idea what I was doing at this time, being an art school student, at this time, programming was not massively taught as a fine art (unfortunately).

    In 2008 I benefited of an artist residency in an agricultural college with a creation grant of 10 000€. I wanted to keep working on my Art World and Creative Processes schemas projects initiated during art school. It didn't go very well because the Plastic Arts State Inspector didn't like what I was doing with her money and strongly advised to change orientation. In my opinion, it was a perfect thing that the institution itself would exhibit it's own workings. In the end, there was an exhibition, but she didn't come to the opening.

    Anyway, I ended up interviewing many Agents of the college, and went especially well with some natural sciences teacher. He recommended a manual were I found some schemas that I made some detournement: I used the geology science as a metaphor of art world. I used geology terms and language to describe social interactions that were not described in the art sociology fieldsee illustration or see full presentation.

    The residency ended up with the redaction of a rather precise documentation (maybe my first specification).

    Then I almost got beaten by a fellow artist who was participating in a collective exhibition mostly for the money and not for the fun. I guess he felt a bit provoked by my situationist theory.

    In 2008, I finally decided to start a training to learn programming and design a proper database and system for managing a virtual Art World. I became a web developer, but I totally forgot the ulterior motive.

    Sometimes I thought about it:

    • 2013 Perl try - I bootstrapped a Perl module with 5 abstract empty classes and then let it sleep on Github
    • 2017 Raku try - I restarted my project while trying to learn Raku (it was still Perl6 at this time), but learning Raku was too much effort and I abandoned again

    Thirteen years after the initial idea I am still thinking about it. This project is following me in my dreams. I'll give it another try.

    You'll tell me: this have nothing to do with OOP and Zydeco 🤔. Ok, we'll see this on Diary of a Zydeco experiment - E03 - Errors for fun and success.

    🌸
Can module building tools deal with .pl files in lib/ in Seekers of Perl Wisdom
3 direct replies — Read more / Contribute
by Smonff
on Sep 11, 2020 at 16:10

    I am playing with Zydeco and have a lot of questions those days.

    Not related to Zydeco, but this is a question that came because of the tests I did with it. This is more about the usual authoring and module building tools. I usually use Minilla because it is high level and it made my life super simple for something like 3 years, but I just encountered an issue. I then read the documentation of at least:

    • Module::Build::Tiny
    • Module::Build
    ...but didn't find an answer. I guess it would be easier to ask some fellow monks.

    So there is a very abnormal situation: I have .pl files in lib/. I know this is weird and not recommended, but I am using a third party tool from a rather experienced CPAN author, so I guess this is on my side that there is a problem. My files and directory tree looks like the following:

    $ tree ./lib/ ./lib/ Art Abstractions.pl Wildlife/ Buyer.pl Collector.pl Wildlife.pm World.pm Art.pm

    The reason that there are some .pl files in this area is something imposed by Zydeco (as far as I can understand) when you want to include some classes or roles. I don't want to open a debate on this, this is how things are. My tests are passing fine when I do something like prove -l t/.

    The issue starts to happen when I enter some traditional building and authoring. I first used Minilla, and then Module::Build::Tiny. Here is the output:

    $ mbtiny test Creating new 'Build' script for 'Art-World' version '0.06' cp lib/Art.pm blib/lib/Art.pm cp script/art.pl blib/script/art.pl cp lib/Art/World.pm blib/lib/Art/World.pm cp lib/Art/Wildlife.pm blib/lib/Art/Wildlife.pm t/01-basic.t .......... ok t/02-entities.t ....... No such file: Art/Wildlife/Buyer.pl at /tmp/ +WcGB64xtpH/blib/lib/Art/Wildlife.pm line 5. BEGIN failed--compilation aborted at /tmp/WcGB64xtpH/blib/lib/Art/Wi +ldlife.pm line 5. Compilation failed in require at t/02-entities.t line 3. BEGIN failed--compilation aborted at t/02-entities.t line 3. t/02-entities.t ....... Dubious, test returned 255 (wstat 65280, 0xf +f00) No subtests run Test Summary Report ------------------- t/02-entities.t (Wstat: 65280 Tests: 0 Failed: 0) Non-zero exit status: 255 Parse errors: No plan found in TAP output Files=5, Tests=1, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.48 cus +r 0.04 csys = 0.56 CPU) Result: FAIL
    All the different modules building and authoring tools gave me the same result: .pl files in lib/ are not copied to the build area and cannot be found. I dunno what to do with this situation and despite of searching in various configuration parameters, I didn't find promising paths. I guess I am missing something, but dunno what?

Diary of a Zydeco experiment - E01 - Introduction in Meditations
4 direct replies — Read more / Contribute
by Smonff
on Sep 10, 2020 at 07:58

    Here is the first post of a small journal I want to keep about an experiment I will do with Zydeco. I hope the Perl Monks Meditations section is appropriate for this, if not, please feel free to redirect me on a better place (especially this is almost my first post here). I started to learn using Zydeco this week after suddenly getting abnormally excited about it. I guess Toby Inkster's marketing seemed to be very effective on me.

    Where am I coming from? I was mainly trained on Java in 2009, so I am a object-native programmer. I mean, I cannot really imagine building something that wouldn't be made of objects, but also, Perl doesn't enforce object orientation, so you can still do without it. I don't know a lot about the how Perl's built-in OO works. I mostly used some modules:

    • Moose - it is the de-facto OO module, recommended in lots of books and tutorials. I went into it when some systems I designed started to grow. You can do a lots of things with it, but it's difficult to use for prototyping for example
    • Mojo::Base - It is usually not described as an independent OO system, but it provides attributes and accessors, readable source code, methods, roles (through Role::Tiny), method signatures. It is extremely simple to use even for prototyping, just use Mojo::Base. I got so used to it while working on Mojolicious projects that I usually import it even on non-web project!
    • unfortunately, I don't think I ever tried Moo seriously

    Next time I'll speak about the purpose of my experiment that is in fact an artistic project: trained as an artist, I accidentally became a professional web developer while trying to learn skills for my next conceptual art piece. But nothing went in the right way. Ten years afters, I am still working on it.

    Conttinue reading Diary of a Zydeco experiment - E02 - History.
    🌸
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-03-19 05:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found