cpan, (Makefile.PL modification time in future)
Hello list I just attempted to upgrade my Catalyst modules and from 3 modules to upgrade only Catalyst::Runtime failed with this error msg. Your installer Makefile.PL has a modification time in the future (1273266119 1273142317). This is known to create infinite loops in make. Please correct this, then run Makefile.PL again. Im running debian squeeze/sid in a virtualbox on ubuntu 10.04 Is this problem related to the useage of a virtual machine? Any help is appreciated david -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: do something after time expired
2009/11/30 Jay Savage daggerqu...@gmail.com: On Mon, Nov 30, 2009 at 1:42 PM, David Schmidt zivildie...@gmail.com wrote: On Mon, Nov 30, 2009 at 5:57 PM, John W. Krahn jwkr...@shaw.ca wrote: David Schmidt wrote: Yes my program has to continue while waiting for the timeout. You code example doesn't work for me because my program is an entire Catalyst application which I dont think is a good idea to put into an eval block. You may not need an eval block: perldoc -f alarm [ SNIP ] If you want to use alarm to time out a system call you need to use an eval/die pair. You can’t rely on the alarm causing the system call to fail with $! set to EINTR because Perl sets up signal handlers to restart system calls on some systems. Using eval/die always works, modulo the caveats given in Signals in perlipc. And besides, an eval with a block is compiled at the same time as the rest of your program and doesn't have the run-time overhead of a string eval. So basically I could create my Signalhandler for the alarm signal, do my calculations in the signalhandler and then start another alarm()? $SIG{ALRM} = { # do stuff alarm($timeout_2); }; alarm $timeout_1; And in case this works, is it a good and stable way to solve my problem? Almost certainly not. *If* it works for you it is relying on some features specific to your specific operating system and version, and is not portable, and probably not reliable. Unless have written all the modules yourself (which is unlikely, as you said this is involves catalyst), you also don't know everything else that is going on in your scope. Make sure you read the alarm and perlipc perldocs before attempting something like this, and pay special attention to both your OS and Perl version. You *may* not need eval, but it is almost certainly a good idea. Think of eval {} / if $@ as Perl's approach to the try/catch idiom of some other languages. You might also want to take a look at Exception::Base. We're still not certain what your problem is, though. That makes it difficult to give you specific advice. The purpose of an alarm or timeout is normally to interrupt the flow of the program and take some action when the time is up or if something doesn't happen in the allotted time. What you seem to be doing is setting up two independent execution paths: none of your psuedocode indicates that the alarm breaks into the main routine or that the execution paths rejoin. If that is really the case, what you probably really need to do is just spawn a child process with fork() or IPC::Open3 or similar. In any case, a real working (or not working as the case may be) example would go a long way toward helping us help you. Due to some other restrictions I had to look for a different solution and found one, namely to check if the time has expired when I am accessing the data that has to be changed. Anyways, I dont want to let this mail unanswered. The actual problem is: All the visitors have to be put in one of 4 groups. So for the first 10 minutes visitors go to group #1, next 10 minutes to group #2, ...when all 4 groups have been treated I want to calculate the new online times of each group by looking at how many visitors are in each one. If a group has very few visitors it gets a bigger share of the next 40 minutes and so on. What I am looking for now is a way to trigger this recalculation code after the first 40 minutes. (I am not alternating groups after each visitor for another reason) *** at program start my $timeslices = { 1 = 10, 2 = 10, 3 = 10, 4 = 10, }; *** after 40 minutes, group 1 had the fewest visitors my $timeslices = { 1 = 5, 2 = 10, 3 = 10, 4 = 15, }; ...and so on david -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
do something after time expired
Hello I would like to execute some Code after a certain amount of time has passed (then restart the timer but with a different time value) I looked at IO::Async::Timer::Countdown but this timer only gets started when used with a IO::Async::Loop. Basically I am looking for something as simple as my $do_it = { ... }; use MyTimer; my timer = MyTimer-new($delay, $do_it); and inside of $do_it I intend to start another timer. is there any simple class that does what I want? I failed to find it. thanks in advance david -- David Schmidt | http://www.fm5.at -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: do something after time expired
On Mon, Nov 30, 2009 at 4:55 PM, Erez Schatz moonb...@gmail.com wrote: 2009/11/30 David Schmidt zivildie...@gmail.com: Hello I would like to execute some Code after a certain amount of time has passed (then restart the timer but with a different time value) Basically I am looking for something as simple as my $do_it = { ... }; use MyTimer; my timer = MyTimer-new($delay, $do_it); and inside of $do_it I intend to start another timer. is there any simple class that does what I want? I failed to find it. Would sleep() do? (http://perldoc.perl.org/functions/sleep.html) -- Erez The government forgets that George Orwell's 1984 was a warning, and not a blueprint http://www.nonviolent-conflict.org/ -- http://www.whyweprotest.org/ Hi and thanks No because I need a non-blocking timer/countdown/delay/timeout greetings david -- David Schmidt | http://www.fm5.at -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: do something after time expired
2009/11/30 Jay Savage daggerqu...@gmail.com: On Mon, Nov 30, 2009 at 10:45 AM, David Schmidt zivildie...@gmail.com wrote: Hello I would like to execute some Code after a certain amount of time has passed (then restart the timer but with a different time value) I looked at IO::Async::Timer::Countdown but this timer only gets started when used with a IO::Async::Loop. Basically I am looking for something as simple as my $do_it = { ... }; use MyTimer; my timer = MyTimer-new($delay, $do_it); and inside of $do_it I intend to start another timer. is there any simple class that does what I want? I failed to find it. thanks in advance david Hi David, I'm not really clear on what you're trying to do, here: looking at IO::Async seems to indicate that you want your program to continue while waiting for the timer, but your sample code would seem to pause while the timer elapses. If you *don't* want to block for the timer, the normal idom would be: eval { local $SIG{ALRM} = { # usually dies }; alarm $timeout; # do something here until timeout }; if ($@) { #check $@ to make sure alarm died, not something else } Either way, you should be able to use the built-in functions to accomplish your task. See the docs for sleep(), alarm(), and select() for more info. Hi Jay Sorry for the bad explanation of my problem. Yes my program has to continue while waiting for the timeout. You code example doesn't work for me because my program is an entire Catalyst application which I dont think is a good idea to put into an eval block. I would need the timer to run in the background and once it expires it should execute the code. david -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: do something after time expired
On Mon, Nov 30, 2009 at 5:57 PM, John W. Krahn jwkr...@shaw.ca wrote: David Schmidt wrote: 2009/11/30 Jay Savage daggerqu...@gmail.com: Either way, you should be able to use the built-in functions to accomplish your task. See the docs for sleep(), alarm(), and select() for more info. Sorry for the bad explanation of my problem. Yes my program has to continue while waiting for the timeout. You code example doesn't work for me because my program is an entire Catalyst application which I dont think is a good idea to put into an eval block. You may not need an eval block: perldoc -f alarm [ SNIP ] If you want to use alarm to time out a system call you need to use an eval/die pair. You can’t rely on the alarm causing the system call to fail with $! set to EINTR because Perl sets up signal handlers to restart system calls on some systems. Using eval/die always works, modulo the caveats given in Signals in perlipc. And besides, an eval with a block is compiled at the same time as the rest of your program and doesn't have the run-time overhead of a string eval. So basically I could create my Signalhandler for the alarm signal, do my calculations in the signalhandler and then start another alarm()? $SIG{ALRM} = { # do stuff alarm($timeout_2); }; alarm $timeout_1; And in case this works, is it a good and stable way to solve my problem? david -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: cpan Audio::File fails
On Sun, Mar 22, 2009 at 8:56 PM, Owen rc...@pcug.org.au wrote: Hello I repeatedly run into problems when installing modules and I havent yet figured out a way to consistently resolve them. I want to install Audio::File but the tests fail Any help is greatly appreciated. david Running make test PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e test_harness(0, 'blib/lib', 'blib/arch') t/*.t t/Audio-File1/49 Ogg::Vorbis::Header::PurePerl: Didn't find an ogg header - invalid file? Ogg::Vorbis::Header::PurePerl: Didn't find an ogg header - invalid file? # Failed test 'Audio::File::Ogg::AudioProperties::length()' My guess is that you are missing a header file. If you are using a distribution based system, look for something like libogg-dev or/and libvorbis-dev Thank you for your reply, I did that already but without success. aptitude search libogg i A libogg-dev - Ogg Bitstream Library Development p libogg-ocaml - OCaml bindings for the Ogg bitstream library p libogg-ocaml-dev - OCaml bindings for the Ogg bitstream library i libogg-vorbis-decoder-perl - An object-oriented Ogg Vorbis decoder i libogg-vorbis-header-perl- perl interface to Ogg Vorbis information and commen i libogg-vorbis-header-pureperl-perl - A pure Perl interface to Ogg Vorbis information fie i libogg-vorbis-perl - Perl extension for Ogg Vorbis streams i libogg0 - Ogg Bitstream Library v liboggz-dev - i liboggz1 - convenience interface for Ogg stream I/O p liboggz1-dbg - convenience interface for Ogg stream I/O debugging i liboggz1-dev - convenience interface for Ogg stream I/O (developme In case you are not familiar with apt/debian, those packages with i in the first column are installed on my system. I just wonder why cpan cant tell me what libs are missing or give any other clue about whats going wrong. Anyway, Audio::File is still not working -- David Schmidt | http://www.fm5.at -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: cpan Audio::File fails
Thanks for your help, I installed said package and after that tried to install Catalyst::Plugin::Upload::Audio::File, the module I actually want (it depends on Audio::File) and got a very similiar error. Writing Makefile for Catalyst::Plugin::Upload::Audio::File cp lib/Catalyst/Plugin/Upload/Audio/File.pm blib/lib/Catalyst/Plugin/Upload/Audio/File.pm Manifying blib/man3/Catalyst::Plugin::Upload::Audio::File.3pm NHEINRIC/Catalyst-Plugin-Upload-Audio-File-0.01.tar.gz /usr/bin/make -- OK Running make test PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e test_harness(0, 'inc', 'blib/lib', 'blib/arch') t/*.t t/00_load.1/1 # Testing Catalyst::Plugin::Upload::Audio::File 0.01, Perl 5.008008, /usr/bin/perl t/00_load.ok t/01_basic1/48 # Failed test 'test.flac, bitrate value matches' # at t/01_basic.t line 78. # got: '94910' # expected: '91081' Ogg::Vorbis::Header::PurePerl: Didn't find an ogg header - invalid file? Use of uninitialized value in int at /usr/share/perl5/Audio/File/AudioProperties.pm line 62. Use of uninitialized value in int at /usr/share/perl5/Audio/File/AudioProperties.pm line 62. Use of uninitialized value in int at /usr/share/perl5/Audio/File/AudioProperties.pm line 62. Use of uninitialized value in int at /usr/share/perl5/Audio/File/AudioProperties.pm line 62. Ogg::Vorbis::Header::PurePerl: Didn't find an ogg header - invalid file? t/01_basic35/48 # Looks like you failed 1 test of 48. t/01_basic Dubious, test returned 1 (wstat 256, 0x100) On Sun, Mar 22, 2009 at 10:48 PM, Owen rc...@pcug.org.au wrote: On Sun, Mar 22, 2009 at 8:56 PM, Owen rc...@pcug.org.au wrote: Hello I repeatedly run into problems when installing modules and I havent yet figured out a way to consistently resolve them. I want to install Audio::File but the tests fail Any help is greatly appreciated. david Running make test PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e test_harness(0, 'blib/lib', 'blib/arch') t/*.t t/Audio-File1/49 Ogg::Vorbis::Header::PurePerl: Didn't find an ogg header - invalid file? Ogg::Vorbis::Header::PurePerl: Didn't find an ogg header - invalid file? # Failed test 'Audio::File::Ogg::AudioProperties::length()' My guess is that you are missing a header file. If you are using a distribution based system, look for something like libogg-dev or/and libvorbis-dev Thank you for your reply, I did that already but without success. aptitude search libogg i A libogg-dev - Ogg Bitstream Library Development p libogg-ocaml - OCaml bindings for the Ogg bitstream library p libogg-ocaml-dev - OCaml bindings for the Ogg bitstream library i libogg-vorbis-decoder-perl - An object-oriented Ogg Vorbis decoder i libogg-vorbis-header-perl - perl interface to Ogg Vorbis information and commen i libogg-vorbis-header-pureperl-perl - A pure Perl interface to Ogg Vorbis information fie i libogg-vorbis-perl - Perl extension for Ogg Vorbis streams i libogg0 - Ogg Bitstream Library v liboggz-dev - i liboggz1 - convenience interface for Ogg stream I/O p liboggz1-dbg - convenience interface for Ogg stream I/O debugging i liboggz1-dev - convenience interface for Ogg stream I/O (developme In case you are not familiar with apt/debian, those packages with i in the first column are installed on my system. I just wonder why cpan cant tell me what libs are missing or give any other clue about whats going wrong. Anyway, Audio::File is still not working Fair enough, just looking at this Ubuntu pakage system, I see there is a liubaudio-file-perl Perl audio file abstraction library Audio::File abstracts a single audio file, independent of its format. Using this module you can access a files meta-info like title, album, etc. as well as the files audio-properties like its length and bitrate. Might be better to just install the prepackaged program? Owen -- David Schmidt | http://www.fm5.at -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
cpan Audio::File fails
Hello I repeatedly run into problems when installing modules and I havent yet figured out a way to consistently resolve them. I want to install Audio::File but the tests fail Any help is greatly appreciated. david Running make test PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e test_harness(0, 'blib/lib', 'blib/arch') t/*.t t/Audio-File1/49 Ogg::Vorbis::Header::PurePerl: Didn't find an ogg header - invalid file? Ogg::Vorbis::Header::PurePerl: Didn't find an ogg header - invalid file? Use of uninitialized value in int at /root/.cpan/build/Audio-File-0.11-VpGjWP/blib/lib/Audio/File/AudioProperties.pm line 62. # Failed test 'Audio::File::Ogg::AudioProperties::length()' # at t/Audio-File.t line 55. # got: '0' # expected: '4' Argument 03/03/03/03 isn't numeric in addition (+) at /root/.cpan/build/Audio-File-0.11-VpGjWP/blib/lib/Audio/File/Tag.pm line 179. # Looks like you failed 1 test of 49. t/Audio-File Dubious, test returned 1 (wstat 256, 0x100) Failed 1/49 subtests -- David Schmidt | http://www.fm5.at -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: counter program by using closure
You might want to look into fork http://perldoc.perl.org/functions/fork.html http://www.tutorialspoint.com/perl/perl_fork.htm On Mon, Dec 15, 2008 at 3:40 PM, Richard rich.j...@gmail.com wrote: John W. Krahn wrote: Richard wrote: John W. Krahn wrote: You want something more like this: sub counter { my $count; my $clear = `clear`; my $counting = 'EOF'; %s | Counting...| | %2d | | | EOF return sub { local $| = 1; printf $counting, $clear, ++$count } } my $yeah = counter(); for ( 1 .. 35 ) { sleep 1; $yeah-(); } this is interesting and this also works well. My question is, how does perl know in this instance that %2d is refering to $count.. is it because $clear contains none numeric value or because $count contains numeric value? $counting contains the format string for printf() and the first argument $clear is substituted for '%s' in $counting and the second argument ++$count is substituted for '%2d' in $counting. They are substituted in the same order as they appear. John Just curious, in programming in general, is it possible to do other things while counting is going on? Is this possible in perl? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- David Schmidt | http://www.fm5.at -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: SSH to diff. machine
I am quite happy with Net::SSH::Perl http://search.cpan.org/~turnstep/Net-SSH-Perl-1.33/lib/Net/SSH/Perl.pm On Wed, Dec 3, 2008 at 8:40 AM, Jeff Pang [EMAIL PROTECTED] wrote: Message du 03/12/08 08:37 De : [EMAIL PROTECTED] A : beginners@perl.org Copie à : Objet : SSH to diff. machine Hi All, I need to write perl script which will SSH to different machine , run some commands and then send out the mail with the output of that command. Can it be possible in perl. Please let me know some sample code. Sure it's possible. See Net::SSH or Net::SSH2 or Net::SSH::Expect on CPAN. -- Jeff Pang http://home.arcor.de/pangj/ Créez votre adresse électronique [EMAIL PROTECTED] 1 Go d'espace de stockage, anti-spam et anti-virus intégrés. -- David Schmidt | http://www.fm5.at
Re: date format search insdie the files
You missed some parentheses #!/usr/bin/perl use strict; use warnings; open(DATA, '', data) || dieUnable to open the file; while(DATA) { #if($_=~/\d{2}-(\d{2}|\w{3})-\d{1,4}/) { if(/(\d{2}-(\d{2})|(\w{3})-\d{1,4})/) { print; } } close(DATA); exit 0; On Sat, Nov 29, 2008 at 10:11 AM, Sureshkumar M (HCL Financial Services) [EMAIL PROTECTED] wrote: Hi All, I try to search the string which has the date format inside the file, But i am not able to get the desired files. Pls help me on this.. C)/tmp/sms/perl$ cat a1 115-06-1979 10-11-81 20-NOV-2008 05-07-1981 welcome 15-10-2008 12-03-20009 (C)/tmp/sms/perl$ cat 1 #/usr/bin/perl open(DATA,a1)||dieUnable to open the file; while(DATA) { if($_=~/\d{2}-(\d{2}|\w{3})-\d{1,4}/) { print $_; } } close(DATA); exit 0; (C)/tmp/sms/perl$ Output should be : 10-11-81 20-NOV-2008 05-07-1981 15-10-2008 -- David Schmidt | http://www.fm5.at -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: getting error when running Net::SSH2
I use Net::SSH::Perl http://search.cpan.org/dist/Net-SSH-Perl/lib/Net/SSH/Perl.pm to do that. On Mon, Nov 24, 2008 at 7:58 PM, monnappa appaiah [EMAIL PROTECTED] wrote: Hi all, I'm running kubuntu linuxI used Net::SSH2 to login to remote machine, execute commands and give me the ouput...when i run the below code i get this error Segmentation fault...does anybody have an idea wat this error is? - #!/usr/bin/perl -w use strict; use Net::SSH2; my $ssh2 = Net::SSH2-new(); $ssh2-connect('10.10.10.5') or die unable to connect to host [EMAIL PROTECTED]; $ssh2-auth_password('xxz', 'xyzpass'); my $chan = $ssh2-channel(); $chan-exec('ls -la'); while ($chan) { print} -- Thanks, Monnappa -- David Schmidt | http://www.fm5.at -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Regarding conditional statement
my $ret_a = a(); my $ret_b = b(); if ($ret_a $ret_b) { (...) } On Mon, Nov 24, 2008 at 11:41 AM, suresh kumar [EMAIL PROTECTED] wrote: Hi, Here is the sample code: sub a { print i am a\n; return 0; } sub b { print i am b\n; return 1; } if (a() b()) { print yes\n; } else { print no\n; } I want both the subroutine to be executed, and then i want print some statements depending upon both the results. here if a() returns 0 then b() was not getting executed. is there any other way to do this check? -- David Schmidt | http://www.fm5.at -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/