Search Results

Search found 11458 results on 459 pages for 'perl thread'.

Page 3/459 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • installing lots of perl modules

    - by Colin Pickard
    Hi, I've been landed with the job of documenting how to install a very complicated application onto a clean server. Part of the application requires a lot of perl scripts, each of which seem to require lots of different perl modules. I don't know much about perl, and I only know one way to install the required modules. This means my documentation now looks this: Type each of these commands and accept all the defaults: sudo perl -MCPAN -e 'install JSON' sudo perl -MCPAN -e 'install Date::Simple' sudo perl -MCPAN -e 'install Log::Log4perl' sudo perl -MCPAN -e 'install Email::Simple' (.... continues for 2 more pages... ) Is there any way I can do all this one line like I can with aptitude i.e. Type the following command and go get a coffee: sudo aptitude install openssh-server libapache2-mod-perl2 build-essential ... Thank you (on behalf of the long suffering people who will be reading my document) EDIT: The best way to do this is to use the packaged versions. For the modules which were not packaged for Ubuntu 10.10 I ended up with a little perl script which I found here ) #!/usr/bin/perl -w use CPANPLUS; use strict; CPANPLUS::Backend->new( conf => { prereqs => 1 } )->install( modules => [ qw( Date::Simple File::Slurp LWP::Simple MIME::Base64 MIME::Parser MIME::QuotedPrint ) ] ); This means I can put a nice one liner in my document: sudo perl installmodules.pl

    Read the article

  • How do I best handle a needed patch for Perl/Tk?

    - by Streamline
    I am making a change to Perl/Tk for an application that has its own resident Perl and modules installation (so we can drop the app in and go). I've found a problem I am experiencing that I just stumbled on what seems to be the patch I need here: http://osdir.com/ml/lang.perl.tk/2004-10/msg00030.html Bug confirmed. Here's the patch against Tk804.027: --- Tk-804.027/pTk/mTk/generic/tkEntry.c Sat Mar 20 19:54:48 2004 +++ Tk-804.027-perl5.8.3d/pTk/mTk/generic/tkEntry.c Tue Oct 19 22:50:31 2004 @@ -3478,6 +3478,18 @@ Tcl_DStringFree(&script); #else + switch (type) { + case VALIDATE_INSERT: + type = 1; + break; + case VALIDATE_DELETE: + type = 0; + break; + default: + type = -1; + break; + } + code = LangDoCallback(entryPtr-interp, entryPtr-validateCmd, 1, 5, "%s %s %s %d %d", new, change, entryPtr-string, index, type); if (code != TCL_OK && code != TCL_RETURN) { Regards, Slaven I'd like to apply this patch or if there is a newer version of the Perl/Tk module I can upgrade to that includes this patch already that doesn't require I change the version of Perl, do that. Here is what I can find from the installation for this app: perl -v = 5.8.4 $Tk::version = '8.4' $Tk::patchlevel = '8.4' $Tk::VERSION = '804.027' So.. 1a) if there is a newer Tk VERSION that includes the patch in the link above, how do I upgrade just that module in the specific Perl installation location for this app? 1b) how do I know if that upgrade is compatible with 5.8.4 of Perl (I don't want to upgrade perl at this point) 2) if not, how do I apply that patch defined in that link?

    Read the article

  • perl want to replace text with perl

    - by yael
    I have aproblem to replace @d& with frfrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr with the perl command what the problem here? why its not replaced to frfrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr THX yael more test param5= @d& perl -pe "s/\b@d&\b/frfrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr/g if m/param5/ and not /^ *#/" test param5= @d&

    Read the article

  • perl want to replace text with perl [closed]

    - by yael
    I have aproblem to replace @d& with frfrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr with the perl command what the problem here? THX yael more test param5= @d& perl -pe "s/\bd\b/frfrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr/g if m/param5/ and not /^ *#/" test param5= @frfrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr&

    Read the article

  • WCF Service worker thread communicate with ServiceHost thread

    - by Brent
    I have a windows NT Service that opens a ServiceHost object. The service host context is per-session so for each client a new worker thread is created. What I am trying to do is have each worker thread make calls to the thread that started the service host. The NT Service needs to open a VPN connection and poll information from a device on the remote network. The information is stored in a SQL database for the worker threads to read. I only want to poll the device if there is a client connected, which will reduce network trafic. I would like the worker threads to tell the service host thread that they are requesting information and start the polling and updating the database. Everything is working if the device is alway being polled and the database being updated.

    Read the article

  • running a command in remote machine by using perl

    - by Bharath Kumar
    Hi All, I'm using following code to connect to a remote machine and try to execute one simple command on remote machine. cat tt.pl !/usr/bin/perl use strict; use warnings; use Net::Telnet; $telnet = new Net::Telnet ( Timeout=2, Errmode='die'); $telnet-open('172.168.12.58'); $telnet-waitfor('/login:\s*/'); $telnet-print('admin'); $telnet-waitfor('/password:\s*/'); $telnet-print('Blue'); $telnet-cmd('ver C:\log.txt'); $telnet-cmd('mkdir gy'); You have new mail in /var/spool/mail/root [root@localhost]# But when i'm executing this script it is throwing error messages [root@localhost]# perl tt.pl command timed-out at tt.pl line 12 [root@localhost]# Please help me in this

    Read the article

  • Perl Threads with binmode

    - by jAndy
    Hi Folks, this call my $th = threads->create(\&print, "Hello thread World!\n"); $th->join(); works fine. But as soon as I add binmode(STDOUT, ":encoding(ISO-8859-1)"); to my script file, I get an error like "segmentation fault", "access denied". What is wrong to define an encoding type when trying to call a perl thread? Kind Regards --Andy

    Read the article

  • ASP-style tags for Perl web development?

    - by Alex R
    I feel like I'm traveling 10 years back in time by asking this, but... Are there any modules, patches, or any "new" version of Perl (released in the last 10 years) to enable writing web-oriented Perl scripts using ASP-style tags? e.g. from ASP/JSP some html <% some code %> more HTML e.g. from PHP some html <? some code ?> more HTML Please don't worry about "why" I'm asking this... It's related to programming language research.

    Read the article

  • A Basic Thread

    - by Joe Mayo
    Most of the programs written are single-threaded, meaning that they run on the main execution thread. For various reasons such as performance, scalability, and/or responsiveness additional threads can be useful. .NET has extensive threading support, from the basic threads introduced in v1.0 to the Task Parallel Library (TPL) introduced in v4.0. To get started with threads, it's helpful to begin with the basics; starting a Thread. Why Do I Care? The scenario I'll use for needing to use a thread is writing to a file.  Sometimes, writing to a file takes a while and you don't want your user interface to lock up until the file write is done. In other words, you want the application to be responsive to the user. How Would I Go About It? The solution is to launch a new thread that performs the file write, allowing the main thread to return to the user right away.  Whenever the file writing thread completes, it will let the user know.  In the meantime, the user is free to interact with the program for other tasks. The following examples demonstrate how to do this. Show Me the Code? The code we'll use to work with threads is in the System.Threading namespace, so you'll need the following using directive at the top of the file: using System.Threading; When you run code on a thread, the code is specified via a method.  Here's the code that will execute on the thread: private static void WriteFile() { Thread.Sleep(1000); Console.WriteLine("File Written."); } The call to Thread.Sleep(1000) delays thread execution. The parameter is specified in milliseconds, and 1000 means that this will cause the program to sleep for approximately 1 second.  This method happens to be static, but that's just part of this example, which you'll see is launched from the static Main method.  A thread could be instance or static.  Notice that the method does not have parameters and does not have a return type. As you know, the way to refer to a method is via a delegate.  There is a delegate named ThreadStart in System.Threading that refers to a method without parameters or return type, shown below: ThreadStart fileWriterHandlerDelegate = new ThreadStart(WriteFile); I'll show you the whole program below, but the ThreadStart instance above goes in the Main method. The thread uses the ThreadStart instance, fileWriterHandlerDelegate, to specify the method to execute on the thread: Thread fileWriter = new Thread(fileWriterHandlerDelegate); As shown above, the argument type for the Thread constructor is the ThreadStart delegate type. The fileWriterHandlerDelegate argument is an instance of the ThreadStart delegate type. This creates an instance of a thread and what code will execute, but the new thread instance, fileWriter, isn't running yet. You have to explicitly start it, like this: fileWriter.Start(); Now, the code in the WriteFile method is executing on a separate thread. Meanwhile, the main thread that started the fileWriter thread continues on it's own.  You have two threads running at the same time. Okay, I'm Starting to Get Glassy Eyed. How Does it All Fit Together? The example below is the whole program, pulling all the previous bits together. It's followed by its output and an explanation. using System; using System.Threading; namespace BasicThread { class Program { static void Main() { ThreadStart fileWriterHandlerDelegate = new ThreadStart(WriteFile); Thread fileWriter = new Thread(fileWriterHandlerDelegate); Console.WriteLine("Starting FileWriter"); fileWriter.Start(); Console.WriteLine("Called FileWriter"); Console.ReadKey(); } private static void WriteFile() { Thread.Sleep(1000); Console.WriteLine("File Written"); } } } And here's the output: Starting FileWriter Called FileWriter File Written So, Why are the Printouts Backwards? The output above corresponds to Console.Writeline statements in the program, with the second and third seemingly reversed. In a single-threaded program, "File Written" would print before "Called FileWriter". However, this is a multi-threaded (2 or more threads) program.  In multi-threading, you can't make any assumptions about when a given thread will run.  In this case, I added the Sleep statement to the WriteFile method to greatly increase the chances that the message from the main thread will print first. Without the Thread.Sleep, you could run this on a system with multiple cores and/or multiple processors and potentially get different results each time. Interesting Tangent but What Should I Get Out of All This? Going back to the main point, launching the WriteFile method on a separate thread made the program more responsive.  The file writing logic ran for a while, but the main thread returned to the user, as demonstrated by the print out of "Called FileWriter".  When the file write finished, it let the user know via another print statement. This was a very efficient use of CPU resources that made for a more pleasant user experience. Joe

    Read the article

  • How To Avoid a Perl script calling an Another Perl Script

    - by rockyurock
    Hello, i am calling a perl script client.pl from a main script to capture the output of client.pl in @output. is there anyway to avoid the use of these two files so i can use the output of client.pl in main.pl itself here is my code.... main.pl ======= my @output = readpipe("client.pl"); client.pl ========= #! /usr/bin/perl -w #use strict; use Socket; #initialize host and port my $host = shift || $FTP_SERVER; my $port = shift || $CLIENT_PORT; my $proto = getprotobyname('tcp'); #get the port address my $iaddr = inet_aton($host); my $paddr = sockaddr_in($port, $iaddr); #create the socket, connect to the port socket(SOCKET, PF_INET, SOCK_STREAM, $proto)or die "socket: $!\n"; connect(SOCKET, $paddr) or die "connect: $!\n"; my $line; while ($line = ) { print "$line\n"; } close SOCKET or die "close: $!"; /rocky..

    Read the article

  • perl scripts stdin/pipe reading problem [closed]

    - by user4541
    I have 2 scripts for a task. The 1st outputs lines of data (terminated with RT/LF) to STDOUT now and then. The 2nd keeps reading data from STDIN for further processing in the following way: use strict; my $dataline; while(1) { $dtaline = ""; $dataline = ; until( $dataline ne "") { sleep(1); $dataline = ; } #further processing with a non-empty data line follows # } print "quitting...\n"; I redirect the output from the 1st to the 2nd using pipe as following: perl scrt1 |perl scpt2. But the problem I'm having with these 2 scpts is that it looks like that the 2nd scpt keeps getting the initial load of lines of data from the 1st scpt if there's no data anymore. Wonder if anybody having similar issues can kindly help a bit? Thanks.

    Read the article

  • Invoke a cleanup method for java user thread, when JVM stops the thread

    - by user309281
    Hi All I have J2SE application running in linux. I have stop application script in which i am doing kill of the J2SE pid. This J2SE application has 6 infinitely running user threads,which will be polling for some specific records in backend DB. When this java pid is killed, I need to perform some cleanup operations for each of the long running thread, like connecting to DB and set status of some transactions which are in-progress to empty. Is there a way to write a method in each of the thread, which will be called when the thread is going to be stopped, by JVM.

    Read the article

  • How can I make Strawberry Perl's cpan(1) find perl?

    - by WalterVonBruegemon
    I'm having trouble installing Template module with Strawberry Perl. cpan Template yields the following: Writing Makefile for AppConfig C:strawberryperlbinperl.exe: not found dmake.EXE: Error code 255, while making 'blib\lib\.exists'` I haven't been able to understand either how to affect the path so dmake will work correctly why the path (which is correct) does not have any \ in it.

    Read the article

  • How do I use a dependency on a Perl module installed in a non-standard location?

    - by Kinopiko
    I need to install two Perl modules on a web host. Let's call them A::B and X::Y. X::Y depends on A::B (needs A::B to run). Both of them use Module::Install. I have successfully installed A::B into a non-system location using perl Makefile.PL PREFIX=/non/system/location make; make test; make install Now I want to install X::Y, so I try the same thing perl Makefile.PL PREFIX=/non/system/location The output is $ perl Makefile.PL PREFIX=/non/system/location/ Cannot determine perl version info from lib/X/Y.pm *** Module::AutoInstall version 1.03 *** Checking for Perl dependencies... [Core Features] - Test::More ...loaded. (0.94) - ExtUtils::MakeMaker ...loaded. (6.54 >= 6.11) - File::ShareDir ...loaded. (1.00) - A::B ...missing. ==> Auto-install the 1 mandatory module(s) from CPAN? [y] It can't seem to find A::B in the system, although it is installed, and when it tries to auto-install the module from CPAN, it tries to write it into the system directory (ignoring PREFIX). I have tried using variables like PERL_LIB and LIB on the command line, after PREFIX=..., but nothing I have done seems to work. I can do make and make install successfully, but I can't do make test because of this problem. Any suggestions? I found some advice at http://servers.digitaldaze.com/extensions/perl/modules.html to use an environment variable PERL5LIB, but this also doesn't seem to work: export PERL5LIB=/non/system/location/lib/perl5/ didn't solve the problem.

    Read the article

  • A Perl script and a Perl module are using `use lib` and referencing the same module

    - by miss_a
    I have a Perl script that is using two modules. The first module also uses the second module. If the the first module does use lib 'dir1', and the script does use lib 'dir2': module1.pm use lib "dir1"; use module2; script.pl use lib "dir2"; use module1; use module2; which directory is being used by the first module? Does the script's use lib, 'dir2' override the use lib, 'dir1' in the first module, or do they have different scope?

    Read the article

  • (PHP vs Python vs Perl) vs Ruby [closed]

    - by Dr.Kameleon
    OK, here's what : I've programmed in over 20 different languages and now, because of a large project I'm currently working on for Mac OS X (in Objective-C/Cocoa), I need to make a final decision on which language to use for my background scripting + plugin functionality. Definitely, one factor that'll ultimately influence my decision is which one I'm most familiar with, which is PHP (one of the ugliest languages around, which I however adore... lol), then Python / Perl (the "proven values"... )... and then Ruby (which, to me, is almost confusing and I've only played with it for some time.) Now, here's my considerations : (As previously mentioned) Being familiar with it (anyway, if X is better in my case, I really don't mind studying it from scratch...) Speed Good interaction with the Shell + ease of integration with my Cocoa application Btw, some of the reasons that made me wonder if Ruby would be a good choice is : The hype around it (although, I still don't get why; but that's probably just me...) My major competitor (we're actually talking about the same type of software here) is using Ruby for its backend scripting almost exclusively (ok, along with some BASH). Isn't Ruby considered slower e.g. than Perl? Why did he choose that? Simply, a matter of personal taste? So... your thoughts?

    Read the article

  • Mod_Perl configuration for multiple domains

    - by daliaessam
    Reading the Mod_Perl module documentation, can we configure it on per domain basis, what I mean can we configure it to run on every domain or specific domain only. What I see in the docs is: Registry Scripts To enable registry scripts add to httpd.conf: Alias /perl/ /home/httpd/2.0/perl/ <Location /perl/> SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI </Location> and now assuming that we have the following script: #!/usr/bin/perl print "Content-type: text/plain\n\n"; print "mod_perl 2.0 rocks!\n"; saved in /home/httpd/httpd-2.0/perl/rock.pl. Make the script executable and readable by everybody: % chmod a+rx /home/httpd/httpd-2.0/perl/rock.pl Of course the path to the script should be readable by the server too. In the real world you probably want to have a tighter permissions, but for the purpose of testing, that things are working, this is just fine. From what I understand above, we can run Perl scripts only from one specific folder that we put the directive above. So the question again, can we make this directive per domain for all domains or for specific number of domains?

    Read the article

  • Error with perl script using module Mail::Sendmail

    - by Octopus
    I am using below code to connect to SMTP server where authentication is required for connection. While executing script I am getting an error message saying "Error sending mail: Connection error from mail.utiba.com on port 465 ()". However the connection to the mail server is working fine, I can connect to the mail server using other mail clients. Please suggest what I am doing wrong here. Is there any sendmail settings required? #!/usr/bin/perl use strict; use warnings; use Mail::Sendmail; print "Testing Mail::Sendmail version $Mail::Sendmail::VERSION\n"; print "Default server: $Mail::Sendmail::mailcfg{smtp}->[0]\n"; print "Default sender: $Mail::Sendmail::mailcfg{from}\n"; my %mail = ( From=> 'username', Bcc => '[email protected]', Cc=> '[email protected]', Subject => 'Test message', 'X-Mailer' => "Mail::Sendmail version $Mail::Sendmail::VERSION", ); $mail{Smtp} = 'mail.server.com:port'; $mail{auth} = {user=>'username', password=>"password", required=>1 }; $mail{'X-custom'} = 'My custom additionnal header'; $mail{'mESSaGE : '} = "The message key looks terrible, but works."; $mail{Date} = Mail::Sendmail::time_to_date( time() - 86400 ); if (sendmail %mail) { print "Mail sent OK.\n" } else { print "Error sending mail: $Mail::Sendmail::error \n" } print "\n\$Mail::Sendmail::log says:\n", $Mail::Sendmail::log;

    Read the article

  • Parsing tab delimited file with double quotes in Perl

    - by sfactor
    I have a data set that is tab delimited with the user-agent strings in double quotes. I need to parse each of these columns and based on the answer of my other post I used the Text::CSV module. 94410634 0 GET "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.6; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; AskTB5.5)" 1 The code is a simple one. #!/usr/bin/perl use strict; use warnings; use Text::CSV; my $csv = Text::CSV->new(sep_char => "\t"); while (<>) { if ($csv->parse($_)) { my @columns = $csv->fields(); print "@columns\n"; } else { my $err = $csv->error_input; print "Failed to parse line: $err"; } } But i get the Failed to parse line: error when I try it on this dataset. what am I doing wrong? I need to extract the 4th column containing the user-agent strings for further processing.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >