iterate over the use-d modules

2024-10-01 Thread Luca Ferrari
Hi all, is there a way to iterate over the used modules, I mean every symbol loaded with use? I would like to do something like: use Foo; use Bar; say ${ $_ }::VERSION for ( @used ); and get something like say $Foo::VERSION; say $Bar::VERSION; Thanks, Luca -- To unsubscribe, e-mail: beginne

[OT] converting a script to a distribution

2017-11-29 Thread Luca Ferrari
Hi all, This is not quite tied to Perl itself, but I'm trying to migrate a few stand-alone scripts I've written to fully distributions, may be uploaded to CPAN. Now, using a tool like distzilla, or alike, and assuming each script has already its git story and configuration files laying around, what

Re: is there a way to shorten these lines?

2017-11-27 Thread Luca Ferrari
On Mon, Nov 27, 2017 at 11:57 AM, Duncan Ferguson wrote: > Are you after "dirname", past of File::Basename? > http://perldoc.perl.org/File/Basename.html Ups...I was sticking with File::Spec! Thanks, that was I was looking for. Luca -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org Fo

is there a way to shorten these lines?

2017-11-27 Thread Luca Ferrari
Hi all, I cannot figure how but I think it is possible to reduce the following to a nested single stamente: my @remote_dirs = File::Spec->splitdir( $remote_path ); pop @remote_dirs; $remote_path= File::Spec->catdir( @remot

postderef with subroutines

2017-05-11 Thread Luca Ferrari
Hi all, according to the documentation the postderef for code blocks $ref->&* and $ref->() have different meanings While I can use the following: my $sub_ref = sub { say "Hello world: @_ !" }; $sub_ref->( 'and the camels go' ); &{

[OT] app (ncurses?) mechanizer?

2017-03-27 Thread Luca Ferrari
Hi all, I've to run a very old application from the command line (unix), it seems to me a ncurses application but I'm not sure that is the real case (let's say it seems ncurses). Anyway, I have to launch the application with a file name, do a couple of menu interactions and exit, then do it again f

multiple named captures with a single regexp

2017-03-01 Thread Luca Ferrari
Hi all, I'm not sure if this is possible, but imagine I've got a line as follows: command arg1 arg2 arg3 arg4 ... I would like to capture all args with a single regexp, possibly with a named capture, but I don't know exactly how to do: my $re = qr/command\s+(?\w+)+/; the above of course is goin

Re: application starter kit

2017-01-23 Thread Luca Ferrari
On Mon, Jan 23, 2017 at 10:39 AM, Chas. Owens wrote: > I think you are saying you want to be able to create one file you can give > to someone else and have them run a Perl 5 program you have written without > having to install all of the modules (and possibly even perl itself). If > this is the

application starter kit

2017-01-23 Thread Luca Ferrari
Hi all, now this should be really trivial, so please point me to documentation if I'm missing something. I have collected a bunch of perl 5 applications to do some tasks, and I would like to make them modular, in the sense make them as individual distributions. I would like to have some module-star

deprecated idiom to simulate state variables

2017-01-10 Thread Luca Ferrari
Hi all, I guess it was in Modern Perl that I saw this deprecated idiom to simulate state variables: sub foo{ my $initialized_once = 1 if 0; ... } Now, why is that working and initializing the variable the first time? I mean, each time such row i

Re: suggestion for print format string based on configuration

2017-01-03 Thread Luca Ferrari
On Wed, Jan 4, 2017 at 12:22 AM, Chris Fedde wrote: > my ($condition, @fields) = parse_data($source_item); > print sprintf $formats[ $condition ], @fields; > > Or something. Well, I've simplified the example and effectively, in my code, the formats is an hash instrumented by the condition

Re: suggestion for print format string based on configuration

2017-01-03 Thread Luca Ferrari
On Tue, Jan 3, 2017 at 5:58 PM, Shlomi Fish wrote: > Perhaps try looking at this page about generating text in Perl - > http://perl-begin.org/uses/text-generation/ (note that Perl-Begin is a site > which I maintain). This page on my personal website, which is not > Perl-specific, but which may hav

suggestion for print format string based on configuration

2017-01-03 Thread Luca Ferrari
Hi all, I've a program that needs to print some fields formatted in different ways according to some conditions. The solution I come up is working, but I'm looking for a suggestion for something more elegant. What I do is something like the following: print sprintf $formats[ $condition ], @fields;

Re: cannot install modules

2016-12-22 Thread Luca Ferrari
On Thu, Dec 22, 2016 at 3:56 PM, Luca Ferrari wrote: > What am I missing here? I found I had a mess configuration with PERL5_MB_OPT and PERL5_MM_OPT variables set to a different location respect to thos cpanm was installinga packages. Removing/unsetting the variables fixed the problem. L

cannot install modules

2016-12-22 Thread Luca Ferrari
Hi all, running perl 5.25.8 on kubuntu 16.10 via perlbrew I try to install Net::SCP but got this strange stuff: % cpanm Net::SCP ... Successfully installed Net-SSH-0.09 ... Successfully installed String-ShellQuote-1.04 ! Installing the dependencies failed: Module 'String::ShellQuote' is not instal

feeding www:mechanize from a set of files

2016-03-09 Thread Luca Ferrari
Hi all, I'm building my own robot to do some stuff with a few interactive pages. Since I know that, after filling a form and hitting the button, I'll be redirected to another form/page to fill and so on for a few steps. What I would like to do is to test my robot against a static copy of the pages,

[OT] get ready to party video?

2015-02-18 Thread Luca Ferrari
Ok, this is not a code related question, but anyone has an idea of when/how/if it will be available the video of the FOSDEM Larry's talk? https://fosdem.org/2015/schedule/event/get_ready_to_party/ I'm very curious about it! Luca -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For addi

Re: is faster a regexp with multiple choices or a single one with lower case?

2015-01-08 Thread Luca Ferrari
Hi Bill, On Thu, Jan 8, 2015 at 1:36 AM, $Bill wrote: > Why not just ignore the case ? Sure it's an option. > Why does the script care what the case is ? Is there a rationale for > checking it ? Of course there's, and of course my script does different things depending on what I'm looking at.

is faster a regexp with multiple choices or a single one with lower case?

2015-01-06 Thread Luca Ferrari
Hi all, this could be trivial, and I suspect the answer is that the regexp engine is smart enough, but suppose I want to test the following: $extention =~ / \.bat | \.BAT /x; is the following a better solution? $extension = lc $extension; $extension =~ / \.bat /x; In other words, when testing f

puppet-like Perl application

2014-11-20 Thread Luca Ferrari
Hi all, this is not strictly related to Perl programming, but I would like to learn a Perl-based configuration management, but according to this page http://en.wikipedia.org/wiki/Comparison_of_open-source_configuration_management_software there are not so many out there. Any suggestion? Thanks, L

Re: cannot install DBD::Oracle

2014-04-02 Thread Luca Ferrari
On Wed, Apr 2, 2014 at 9:06 AM, Zapp Prefect wrote: > That means you should Make Sure you have defined the Environment Variable > $ORACLE_HOME First! > Find where you installed the Oracle, and add this into your .bashrc, then > relogin: > export ORACLE_HOME="/path/to/Oracle" Thanks, but it was cl

cannot install DBD::Oracle

2014-04-02 Thread Luca Ferrari
Hi all, I'm running a linux box with the Oracle SQL Developer installed. The DBD::Oracle module refuses to install claiming it cannot find a value for ORACLE_HOME and/or an oralc einstallation. Do I need to install something else for the perl module to work or does it suffice to point ORACLE_HOME t

padding values depending on a list

2014-03-28 Thread Luca Ferrari
Hi all, I've a problem that has to presents data into an array in a set of string with a variable left/right padding depending on the field position in the arrat. Therefore I'm building a very long printf format string to be used as: print @array; What I don't like in this solution is that the

Re: error installing catalyst via cpan

2014-02-10 Thread Luca Ferrari
On Mon, Feb 10, 2014 at 6:22 PM, Octavian Rasnita wrote: > Try installing Catalyst with cpanm. Or join Catalyst mailing list and ask > there. There may be more that know the answer. Thanks, I was able to install it via cpanm, even if I wonder why CPAN should not work Luca -- To unsubscribe

Re: error installing catalyst via cpan

2014-02-10 Thread Luca Ferrari
On Mon, Feb 10, 2014 at 5:24 PM, Rodney Simioni wrote: > Can you upgrade CPAN? I did. I reloaded the CPAN shell and try it again, but the error remains the same. I was able to install it via cpanm. Luca -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail:

error installing catalyst via cpan

2014-02-10 Thread Luca Ferrari
Hi all, while installing Catalyst::Devel on my machine I got the following: Fetching with LWP: http://www.planet-elektronik.de/CPAN/authors/id/D/DC/DCANTRELL/CHECKSUMS Catching error: "'' trapped by operation mask at (eval 308) line 1.\cJ at /usr/share/perl/5.14/CPAN/Distribution.pm line 1463.\cJ\

Re: baby perl to get the right date

2014-01-28 Thread Luca Ferrari
On Wed, Jan 29, 2014 at 5:59 AM, Rob Dixon wrote: > It is probably best to use the Time::Piece module, which has been part of > core Perl 5 since version 10 so you shouldn't need to install it. > Thanks, I was not aware of it. And it does what I need. Luca -- To unsubscribe, e-mail: beginners-

baby perl to get the right date

2014-01-27 Thread Luca Ferrari
Hi all, often I find myself writing something like the following to get the "human" date: my ($day, $month, $year) = (localtime())[3..5]; $month++, $year += 1900; print "\nToday is $month / $day / $year \n"; I was wondering if there's a smarter pattern to get the right value in one single line.

Re: regexp as hash value?

2014-01-25 Thread Luca Ferrari
On Sat, Jan 25, 2014 at 4:12 PM, Paul Johnson wrote: > $ perl -E '$h = { a => qr/y/ }; say $_ =~ $h->{a} for qw(x y z)' Thanks, but then another doubt: having a look at http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators I dont understand how I can use the regexp for substitution, th

regexp as hash value?

2014-01-25 Thread Luca Ferrari
Hi, I'm just wondering if it is possible to place a regexp as a value into an hash so to use it later as something like: my $string =~ $hash_ref->{ $key }; Is it possible? Should I take into account something special? Thanks, Luca -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For a

Re: question about perl 6 sigils

2013-09-24 Thread Luca Ferrari
On Tue, Sep 24, 2013 at 5:27 PM, Andy Bach wrote: > Did you read the exegesis? Damian is one of the smartest guys you'll ever > hear speak (his book "Perl Best Practices", for one, is worth it's weight in > classrooms - er, something like that). It's not that you're wrong or that > the argument

Re: question about perl 6 sigils

2013-09-24 Thread Luca Ferrari
On Tue, Sep 24, 2013 at 12:52 AM, Andy Bach wrote: > I liked it, after I > understood it. I posted the question for the same reason: I believe that having the sigil meaning what you (are thinking) you are accessing was a great idea. What I don't understand here is why we have to keep the true sig

question about perl 6 sigils

2013-09-23 Thread Luca Ferrari
Hi all, I'm having a look at Perl 6 syntax and I don't get the rationale in having different sigils for scalars, hashes and arrays while having a scalar access being with the same type sigil. In other words, in Perl 5 it does make sense (to me) that accessing a single value into a list or hash has

Re: help for an array refence within an hash pattern

2013-09-23 Thread Luca Ferrari
On Mon, Sep 23, 2013 at 2:32 PM, Jing Yu wrote: > Hi Luca, > > Doesn't it autovivify $hash_ref->{$key} when you push $new_value to it? > > At least when I tested the following code, it worked. > > push @{ $hash_ref->{$key} }, $new_value; > Correct! How did I not come to this? Thanks, Luca -- T

help for an array refence within an hash pattern

2013-09-23 Thread Luca Ferrari
Hi, in my applications often I end up with an hash ref that contains array refs, and each time I have to insert a new element in the array for a specific key I write something like: if ( ! exists $hash_ref->{ $key } ){ $hash_ref->{ $key } = []; } push @{ $hash_ref->{$key} }, $new_value; Is

Re: module installation dir, site_perl, and perl -V:sitelib

2013-07-25 Thread Luca Ferrari
On Thu, Jul 25, 2013 at 2:15 PM, Christophe Martin wrote: > Hello, > > Le 24/07/13 20:29, Luca Ferrari a écrit : >> On Wed, Jul 24, 2013 at 2:28 PM, Christophe Martin >> wrote: > The question remains. How can I get the name of a/the < name in @INC, not version/arch s

Re: module installation dir, site_perl, and perl -V:sitelib

2013-07-24 Thread Luca Ferrari
On Wed, Jul 24, 2013 at 2:28 PM, Christophe Martin wrote: > Do all (or 95%) of perl installation have a site_perl dir ? I'll bet the answer is not. However, what would make sitelib so much important with regard to other @INC entries? I mean, using a non-arch directory is fine without any regard

Re: cpan App::cpanminus

2013-07-23 Thread Luca Ferrari
On Tue, Jul 23, 2013 at 8:59 AM, *Shaji Kalidasan* wrote: > Rohit, > > You might be behind a firewall which blocks http or https requests > originating from non browsers. This type of blocking will be typically be > categorized into Dos attack (denial-of-service attack). Your network > administrat

Re: Social network map

2013-07-15 Thread Luca Ferrari
On Mon, Jul 15, 2013 at 4:47 PM, wrote: > Something like Facebook contacts, email contacts. I want to have a map of > these contacts, which will include all type of interaction information . I don't get what you are trying to do. If the aim is to render a phone-book like application, that shoul

Re: SSH connection to different network devices

2013-07-15 Thread Luca Ferrari
On Sun, Jul 14, 2013 at 10:06 PM, Kolya Gromivchuk wrote: > Hello, > > I need some advice which library or module to use for multiple connection to > network devices. For example change status of ports on the hundred switches. > > I don't see any reason to get it concurrently, rather to process e

Re: beginners@perl.org and netiquette

2013-07-14 Thread Luca Ferrari
On Sun, Jul 14, 2013 at 5:55 PM, David Christensen wrote: > Someone wrote: >> >> Can you please make the subject line read like a Perl topic rather than a >> personal message in future? > > Cirrect! > People posting on beginners@perl.org can be beginners with mailing lists > too. "'Tsall good"

Re: A Look At My Utility Library

2013-07-09 Thread Luca Ferrari
On Sun, Jul 7, 2013 at 9:18 PM, Shawn H Corey wrote: > I am creating a utility module and will be posting about it on my blog. So far it seems to me much more a configuration setup than an "utility module", but we'll see. However, once you have something more complete please push it to some repo

Re: errors building CRYPT:: DES on 64 bit perl usimng Solaris studio 12.3 Solaris 10

2013-07-03 Thread Luca Ferrari
On Sat, Jun 29, 2013 at 12:26 AM, Dariusz Dolecki wrote: > rl10/5.18.0/lib/5.18.0/sun4-solaris-64/CORE" des.c > "des.h", line 1: cannot find include file: I suspect the problem is here. I don't have a solaris machine right now, but for instance on my FreeBSD installation the most similar thing

Re: how to make perl program run continue when i press control+s to pause screen output

2013-06-06 Thread Luca Ferrari
On Wed, Jun 5, 2013 at 1:18 PM, Nemana, Satya wrote: > Hi > > > > I am having a slight difficulty in getting this accomplished. > > When my perl program keeps running, I sometimes need to pause the screen > output and check some things on the output. > > But, I want my program to still keep runnin

[OT] is the book on Perl 6 outdated?

2013-06-03 Thread Luca Ferrari
Hi, since I'm pretty new to Perl 6, is this book http://shop.oreilly.com/product/9780596007379.do outdated or is it worth reading? I ask because the book has been published in 2004, so I guess Perl 6 development has gone miles away now. Luca -- To unsubscribe, e-mail: beginners-unsubscr...@perl.

Re: help with something strange

2013-05-28 Thread Luca Ferrari
On Tue, May 28, 2013 at 8:05 PM, Rahim Fakir wrote: > I wanted to do C:\cpan Foo::Bar and something strange happened, the > following lines, pls help: > > C:\Users\Rahim\Documents>cpan Foo::Bar > Base class package "DBIx::Class::Schema" is empty. > (Perhaps you need to 'use' the module which d

Re: what's the problem with a system call

2013-05-13 Thread Luca Ferrari
On Tue, May 14, 2013 at 5:35 AM, xiaolan wrote: > Hello, > > what's the disadvantage when calling a system command from Perl? > i.e, system call to "rsync" rather than using the File::Rsync module. > is it hard to control the signals between the caller process and the called > system command? We

Re: curiosity about the usage of my

2013-05-11 Thread Luca Ferrari
On Thu, May 9, 2013 at 6:22 PM, Brandon McCaig wrote: > It's a good trait for programmers to avoid waste, but not if it > comes at the expense of reliability, security, or robustness. > Using my() and our() takes very little effort and is well worth > the investment. Thanks for the explanation,

curiosity about the usage of my

2013-05-09 Thread Luca Ferrari
Hi, the usage of "my" to scope variables is a good habit, and under "strict" is almost a need. But just today I realized that having to write "my" in front of each block of variables does not seem to me a perl-ish way of doing things: it requires extra effort to a quite simple task (variable decla

Re: problem with File::Util::readlimit

2013-05-08 Thread Luca Ferrari
On Wed, May 8, 2013 at 8:24 PM, Brandon McCaig wrote: > Looks like it raises an exception if the argument doesn't match a > NON-"digit" character. Which seems like the opposite of what is > wanted. > In fact I was discovering it too reading the code, I've submitted a bug report for this. Thanks

problem with File::Util::readlimit

2013-05-08 Thread Luca Ferrari
Hello, I'm encountering a problem with File::Util that I'm not able to see, and I'm sure it's trivial: my $handle_file = new File::Util; my $files_for = {}; my $max_file_size = int( 1024 * 1024 * 1024 ); $handle_file->readlimit( $max_file_size ); that once run produces the following trace: PRO

Re: Perl scope like cscope

2013-04-26 Thread Luca Ferrari
I use Emacs, so etags seems a natural choice for jumping across code. Luca -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

PAdES verifiers?

2013-02-28 Thread Luca Ferrari
Hi all, anybody knows of any utility/module that allows me to check and verify signatures in PDF files done with PAdES? I'm not interested in signing document by myself, rather to get signature information and validity. Thanks, Luca -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For a

Re: problem about run perl script in java

2013-02-26 Thread Luca Ferrari
I've never used, but this should be what you are looking for: http://search.cpan.org/dist/Inline-Java/Java/PerlInterpreter/PerlInterpreter.pod Anyway, I suspect if you cannot install a Perl version on the machine you will not succeed in running Perl from Java. Luca On Tue, Feb 26, 2013 at 8:48 A

Re: .profile not being read

2013-02-20 Thread Luca Ferrari
This is becoming a bit too long and somewhat not related to Perl (at least in my opinion). Quick and dirt suggesion: link .bash_profile to .profile to see if it solves the problem, and that means that the Bash is reading one file instead of the other. If that works, remove the other file (see below

Re: .profile not being read

2013-02-17 Thread Luca Ferrari
I suspect this has something to do with the PATH variable and alike. And it could have been set up at system wide level, for instance on /etc/profile. Luca -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: some transformations on file

2013-01-20 Thread Luca Ferrari
Ehm...what problem are you encountering in doing that? Luca On Sun, Jan 20, 2013 at 3:33 PM, samuel desseaux wrote: > Hi, > > I work on file for our library. > > I have one file with all biblio records and one with items. A biblio record > can have one or more than one item. > > First operation: