need help with regular expressions


hi, i need the correct regular expression to set the unnamed variable $1 to any of "FantasyMFG", "Fantasy.NET", or "FantasyACC" in the following path: FantasyMFG/tags/2.1.16 (where "FantasyMFG" may be replaced with any of the others) this is for a system ...
Posted On: Sunday 25th of November 2012 10:51:06 PM Total Views:  145
View Complete with Replies

RELATED TOPICS OF Perl PROGRAMMING LANGUAGE




need some help on perl

I need small help on perl scripting I have files that is copied on a regular basis and i need to check the contents to calculate the ratio. depending on the result. ( e.g. .50) it will call another script low.pl ( e.g. .99) it will call another script high.pl The file is a csv file and come every 5 minutes and I need to calculate the ratio of "OctetsSent" and "OctetsReceived" HEADER;UtilizationData;10;V16SG; ;0;SCANNER; ;0;MsgSent;MsgReceived;PacketsSent;numPacketsReceived;OctetsSent;OctetsReceived;MsgDiscarded;SentNoCtrl;nReceivedNoCtrl;RetransNoCtrl UtilizationData;V16SG;2012/07/27;10:45:00;STPSTR01.169;900;FALSE;SCANNER;10;127;2;2055;2112;86428;83432;0;5432;1784;0 UtilizationData;V16SG;2012/07/27;10:45:00;STPSTR01.138;900;FALSE;SCANNER;10;9972;6106;16943;13790;1466256;805508;0;960348;396156;0 UtilizationData;V16SG;2012/07/27;10:45:00;STPSTR01.134;900;FALSE;SCANNER;10;3471;6288;11093;10419;588480;631296;0;254004;316732;0 UtilizationData;V16SG;2012/07/27;10:45:00;STPSTR01.58;900;FALSE;SCANNER;10;20652;23514;39497;29404;4690132;3929776;0;3471992;2947904;0 UtilizationData;V16SG;2012/07/27;10:45:00;STPSTR01.60;900;FALSE;SCANNER;10;20593;19351;36274;26039;4350820;3462084;0;3234956;2593056;0 UtilizationData;V16SG;2012/07/27;10:45:00;STPSTR01.62;900;FALSE;SCANNER;10;24237;21229;40003;28678;5122408;3703840;0;3875508;2746088;0
VIEWS ON THIS POST

101

Posted on:

Wednesday 7th November 2012
View Replies!

I need help running DBI

I compied perl and DBI on BOX A; I did ./Configure prefix=/blah/blah. I copied over the perl directories to BOX B (don't worry the prefix install path mimicks perl on BOX B). Now I can run perl, I tested with a hello world program, I added use strict, use warnings. Works w/o issues. Now when I add 'use DBI', I get an error because I have missing lib files in BOX B (its not the libmysqlclient libraries are missing). Below is the error: install_driver(mysql) failed: Can't load '/c$/perlscripts/ localperl5.10/lib/site_perl/5.10.0/i686-linux-64int/auto/DBD/mysql/ mysql.so' for module DBD::mysql: libssl.so.4: cannot open shared object file: No such file or directory at /c$/perlscripts/ localperl5.10/lib/5.10.0/i686-linux-64int/DynaLoader.pm line 203. Its not mysql.so that is causing the problem, its libssl.so.4 that is missing on BOX B. I can easily copy over that file from another box (which I did) run it again, and I'll get another missing lib file; about 5 or 6 of them. So what is the best course of action to get this resolved. Can I recompile DBI on BOX A and tell it to point all the neccessary lib files to a directory in the Perl directory When I did a ldd on mysql.so, I got: ldd /auto/DBD/mysql/mysql.so linux-gate.so.1 => (0xffffe000) libmysqlclient.so.15 => /usr/lib/mysql/libmysqlclient.so.15 (0xf7ddd000) libz.so.1 => /lib32/libz.so.1 (0xf7dc8000) libcrypt.so.1 => /lib32/libcrypt.so.1 (0xf7d9a000) libnsl.so.1 => /lib32/libnsl.so.1 (0xf7d85000) libm.so.6 => /lib32/tls/libm.so.6 (0xf7d62000) libssl.so.4 => /lib/libssl.so.4 (0xf7d2e000) libcrypto.so.4 => /lib/libcrypto.so.4 (0xf7c44000) libc.so.6 => /lib32/tls/libc.so.6 (0xf7b2a000) /lib/ld-linux.so.2 (0x56555000) libgssapi_krb5.so.2 => not found libkrb5.so.3 => not found libcom_err.so.2 => /lib32/libcom_err.so.2 (0xf7b28000) libk5crypto.so.3 => not found libresolv.so.2 => /lib32/libresolv.so.2 (0xf7b13000) libdl.so.2 => /lib32/libdl.so.2 (0xf7b0f000) libgssapi_krb5.so.2 => not found libkrb5.so.3 => not found libk5crypto.so.3 => not found Does this mean I have to copy all these files over from BOX A to BOX B to work. Is there an easier way,
VIEWS ON THIS POST

97

Posted on:

Wednesday 7th November 2012
View Replies!

in the elemetns of programming perl , I need help with 2 lines thatI don't understand

Richard Lee schreef: > $pattern = '.*(:' . join('|', @ARGV) . ')'; Safer: $pattern = '.*(:' . join('|', map quotemeta, @ARGV) . ')'; And I would do a qr() on top of that. -- Affijn, Ruud "Gewoon is een tijger." , Dr.Ruud wrote: > Richard Lee schreef: > >> $pattern = '.*(:' . join('|', @ARGV) . ')'; > > Safer: > > $pattern = '.*(:' . join('|', map quotemeta, @ARGV) . ')'; > > And I would do a qr() on top of that. How And why Rob
VIEWS ON THIS POST

100

Posted on:

Wednesday 7th November 2012
View Replies!

Newbie needs help with IO::Socket (maybe IO::Select)

Hi all I'm playing around with IO::Socket and try to build a small Client/Server App. The Serverpart is working as it's supposed to, but I have some problems with the Clientpart. So I have a couple of Questions: 1. How can a Client react to a Servermessage (Server prints to Socket), when it's not expecting a Servermessage (For example another client connects to the server and kicks the first one or the server is beeing shutdown). If I use the IO::Select approach like in the Serverpart, the Client is blocked and the User can't interact with it anymore. 2. Why does $socket->connected still return the peer-address, eventhough the server is shutdown I'm sure there is a solution for this (probably by using IO::Select), but I can't find any examples of Clientcode using this. Here's what I have (simplified... the "real" Client is using Tk): ------ Star Serverpart ------- #!perl -w use strict; use IO::Socket; use IO::Select; use Data:umper; our $socket; my %users; my $port = 9901; #Socket erstellen my $main_socket = IO::Socket::INET->new(LocalPort => $port, Type => SOCK_STREAM, Reuse => 1, Listen => 1) or die "Kann kein TCP-Server an Port $port sein: @!\n"; my $lesbar = new IO::Select(); $lesbar->add($main_socket); #Pruefen ob ein Client connectet while(1) { my ($neu_lesbare) = IO::Select->select($lesbar, undef, undef, undef); foreach $socket(@{$neu_lesbare}) { if ($socket == $main_socket) { #Neue Verbindung kommt rein... my $neues_socket = $socket->accept(); $lesbar->add($neues_socket); } else { # Hier drin passiert Zeug mit dem Client my $buf = ; if ($buf) { chomp($buf); my @args = split(',', $buf); if ($args[0] eq "AUTH") { auth($args[1], $args[2]); } else { print "Nicht unterstuetzter Command\n"; } } else { # print "Client hat Socket geschlossen\n"; $lesbar->remove($socket); close ($socket); foreach (keys %users) { if ($socket eq $users{$_}{socket}) { print localtime().": User [$_] disconnected\n"; delete $users{$_}; } } } } } } #---- Subroutinen ---# sub write2socket { my $socket = shift; my $text = shift; my $length = sprintf("%04d", length($text)); my $newstring = $length.$text; print $socket "$newstring"; } sub auth { my $usr = shift; my $pass = shift; #Na wer ists denn... my $iaddr = inet_ntoa($socket->peeraddr()); my $rem_host = gethostbyaddr($socket->peeraddr(), AF_INET); my $rem_port = $socket->peerport(); print localtime().": Neue Verbindung von Host: $rem_host [$iaddr:$rem_port]\n"; if (($usr eq "boerni") or ($usr eq "admin")) { if ($users{$usr}) { write2socket ($socket,"User $usr ist bereits verbunden ($users{$usr}{host}:$users{$usr}{port})"); } else { write2socket ($socket,"Verbindung mit User $usr akzeptiert"); $users{$usr}{socket} = $socket; $users{$usr}{host} = $rem_host; $users{$usr}{port} = $rem_port; } } else { write2socket ($socket, "Verbindung abgelehnt"); $lesbar->remove($socket); $socket->shutdown(2); close ($socket); } #print Dumper \%users; #print Dumper \%sockets; foreach (keys %users) { my $handle = $users{$_}{socket}; write2socket($handle, "User $usr hat sich verbunden"); } } ------ End Serverpart ------- ------ Star Clientpart ------- #!perl -w use strict; use IO::Socket; use IO::Select; my $socket; my $usr = "admin"; my $pw = "pass"; my $remote_host = 'localhost'; my $remote_port = 9901; my $svrmsg; my $lesbar = new IO::Select(); $lesbar->add($socket); while () { chomp; if ($_ eq "connect") { connect2server(); } elsif ($_ eq "man_move") { man_move("up"); } elsif ($_ eq "check") { check_status(); } else { print "Nicht unterstuetzt\n"; } } #---- Subroutinen ----# sub connect2server { #---- Socket aufbauen ----# $socket = IO::Socket::INET->new(PeerAddr => $remote_host, PeerPort => $remote_port, Proto => "tcp", Type => SOCK_STREAM) or die "Konnte Verbindung zu $remote_host:$remote_port nicht herstellen: @!\n"; print $socket "AUTH,$usr,$pw\n"; $svrmsg = read_from_sock($socket); print "FROM SERVER: [$svrmsg]\n"; } sub man_move { return if ! $socket; my $direction = shift; print $socket "man_move,$direction\n"; $svrmsg = read_from_sock($socket); print "FROM SERVER: $svrmsg\n"; } sub read_from_sock { my $socket = shift; my $length = 0; my $data; $socket->read($length, 4); $socket->read($data,$length); return $data; } sub check_status { if (! $socket) { print "CHECK: No socket\n"; } elsif ($socket->connected()) { print "CHECK: Connected with ".inet_ntoa($socket->peeraddr())."\n"; } else { print "CHECK: Not connected"; } } ------ End Clientpart -------
VIEWS ON THIS POST

96

Posted on:

Wednesday 7th November 2012
View Replies!

"Enter this obfuscated code before submitting" help needed (CGI)

I need to add one of those "Enter this generated graphic code" keys to an HTML form to stop auto submissions. I'd google it, but I'm not even sure what the industry buzzword to describe these is (heads up appreciated!). Alternatively, if anyone has a pointer to some specific code and/or snippets they like to use, that would be great too.
VIEWS ON THIS POST

65

Posted on:

Wednesday 7th November 2012
View Replies!

Make, Rake like tool in pure perl. I need feedback.

I'm trying to rewrite rake, "build language" so it would fit within perl. If you don't know what is rake here you find all the info: Rake project main page: http://rake.rubyforge.org/ Rake syntax: http://rake.rubyforge.org/files/doc/rakefile_rdoc.html Rake tutorial: http://www.railsenvy.com/2007/6/11/r...-rake-tutorial In general it's ...
VIEWS ON THIS POST

90

Posted on:

Saturday 10th November 2012
View Replies!

need help on cgi to get multi pages and could sort by column fromOracle

hi, please help me on: I want to find like 1000+ records from Oracle database using dbi, but the view could sort by column and could display by multi pages. Anyone has this kind of experience Robert...
VIEWS ON THIS POST

217

Posted on:

Saturday 10th November 2012
View Replies!

need help on my code .....

ServerCode:#! /usr/bin/perl -wuse FileHandle; use Socket;$filename = "/tmp/temporarily";socket(SERVER,PF_UNIX, SOCK_STREAM, 0) or die"Can't create socket SERVER\n";autoflush SERVER 1;bind(SERVER,sockaddr_un("/tmp/0805638") or die"Can't bind server\n";listen(SERVER,0) or die"Can't listen";for(;;){\taccept(DATA,SERVER); \tprint ;\tclose DATA;}error Wrote:Useless use of a constant in void context at Server.pl line 7.syntax error at Server.pl line 7, near ""Can't bind server\n";"Execution of Server.pl aborted due to compilation errors.[quote]ClientCode:#! /usr/bin/perl -wuse FileHandle; use Socket;socket (CLIENT, PF_UNIX, SOCK_STREAM, 0) or die "socket: $!"; autoflush CLIENT 1;connect(CLIENT, sockaddr_un($filename))\tor die "connect: $!";accept(DATA,CLIENT);print CLIENT "I have now sent you some very important information";[quote=error]#! /usr/bin/perl -wuse FileHandle; use Socket;socket (CLIENT, PF_UNIX, SOCK_STREAM, 0) or die "socket: $!"; autoflush CLIENT 1;connect(CLIENT, sockaddr_un($filename))\tor die "connect: $!";accept(DATA,CLIENT);print CLIENT "I have now sent you some very important information";
VIEWS ON THIS POST

95

Posted on:

Saturday 10th November 2012
View Replies!

need good module to access and parse it into date, subject, etc...

I've been looking around for different ways to access my mailbox using perl. i'm going to display the contents on a page, etc, so i need to break it down like a regular email viewer.Here's a few I'm looking at if anyone could offer suggestions, experience.Net::IMAP::Simple;Mail::POP3Client;Mail::IMAPClient;I know they probably all do the same, so I'm looking for ease of use, etc
VIEWS ON THIS POST

110

Posted on:

Saturday 10th November 2012
View Replies!

module needs to know its own path

, within a perl module, I need to access content included with this module, but stored in separate files (WSDL definitions in my case). If my module lies in /usr/lib/perl5/xxx/MyModule.pm, the WDSL files could be stored in /usr/lib/perl5/xxx/MyModule/WSDLs/*.wsdl or similar. ...
VIEWS ON THIS POST

98

Posted on:

Sunday 11th November 2012
View Replies!

need some advice

I'm trying to write a script that will check file permission in a directory and ask if its find some files with permission other than 0644. To do that I made a loop that will ask to change the ...
VIEWS ON THIS POST

80

Posted on:

Thursday 15th November 2012
View Replies!

need to find module tar.gz files

I have searched all over CPAN and all over the internet to try to find the tar.gz files for these 3 modules: Exporter LWP::Agent HTTP::Request I found each module on CPAN, but the link to the tar.gz file contained a ...
VIEWS ON THIS POST

100

Posted on:

Thursday 15th November 2012
View Replies!

win32 advice needed forks threads or separate processes and pipes

Hi all, Just wondered what the common consensus was on the best way to go for parallel processing on windows with perl/tk. It seems that threads and tk are at best unreliable, fork appears to have similar caveates. Basically i ...
VIEWS ON THIS POST

268

Posted on:

Thursday 15th November 2012
View Replies!

Do you have the knowledge i need for my site?

Dear developer, Do you often wonder who built a certain website and how it is done And who manages that website right now Strange, but developers usually stay anonymous while they should present themselfs to get more orders. We have ...
VIEWS ON THIS POST

167

Posted on:

Thursday 15th November 2012
View Replies!

need help with perl api for Fedex shipping charge

Hi Does any know any good perl modules can connect to Fedex system and retrieve the shipping charge. I work on a online shopping cart system and need above function
VIEWS ON THIS POST

160

Posted on:

Thursday 15th November 2012
View Replies!

text input widget needed (with extras) (repost)

[reposted - news server seems to have dropped article somewhere] I'm looking for a quick solution to what I thought would be a 5-minute problem. I need a multiline text input widget: Tk::TextUndo would do nicely, except I also need ...
VIEWS ON THIS POST

161

Posted on:

Thursday 15th November 2012
View Replies!

I need to access foundry switch for execute command.

I need to access foundry switch with script for execute commands. My login is: User Access Verification Please Enter Login Name: ***** Please Enter Password: User login successful. telnet@srjobkp01>en Password: telnet@srjobkp01# telnet@srjobkp01#conf t telnet@srjobkp01(config)# I need to create a script ...
VIEWS ON THIS POST

145

Posted on:

Monday 19th November 2012
View Replies!

for each unique value in a column find the max value..need perl script

Below is my Input file:date mtime no size id day order \t\t20100607 154538.354300 200 1 101510 1409870399320100607 154539.420000 200 1 101511 1409870399320100607 154538.398200 487 1 100888 1409870399420100607 154610.720000 487 1 91588 1409870399420100607 154538.401200 200 1 101502 1409870399520100607 154539.420000 200 1 101500 14098703995I need a perl code to get the foll o/p. For each unique order field, calculate the oldest mtime; and for each unique order field replace the day field by the oldest mtime. For example, the 1st 2 rows have the same order field=14098703993, for which the oldest mtime is 154538.354300 and hence we put this value into the day field. The output as below:Outputdate mtime no size id day order \t\t20100607 154538.354300 200 1 154538.354300 1409870399320100607 154539.420000 200 1 154538.354300 1409870399320100607 154538.398200 487 1 154538.398200 1409870399420100607 154610.720000 487 1 154538.398200 1409870399420100607 154538.401200 200 1 154538.401200 1409870399520100607 154539.420000 200 1 154538.401200 14098703995Please help me with the code.. I have been trying for a long time now..
VIEWS ON THIS POST

167

Posted on:

Saturday 24th November 2012
View Replies!

need most efficient way to write this code that checks zips...

For comparing the data in the $zipField against all the zip codes in zipFile.txt, I would suggest reading through the text file and storing all the zip codes in a hash with some non-false value (so something other than undef or 0.) The check for a valid zip code would then consist of if (defined $hash{$zipField}).For the $addrField check, you're going to have to be careful. It's possible any house number with 5+ digits could, in theory, match a zip code. Once you sort out the house numbers problem, you could check any zip codes in $addrField against the hash you created from the text file.
VIEWS ON THIS POST

174

Posted on:

Saturday 24th November 2012
View Replies!

unix perler needs win32 API perl snippet

dear perl experts---I hope this is a request for a one-liner. I usually run linux or OSX, but I now am in need of automating some OCR on Windows. (The OCR vendors only sell affordable software on Windows in their ...
VIEWS ON THIS POST

159

Posted on:

Sunday 25th November 2012
View Replies!