RE: Concurrency problem
Your input is appreciated ! José. > -Original Message- > From: david [mailto:[EMAIL PROTECTED]] > Sent: Monday, January 27, 2003 8:16 PM > To: [EMAIL PROTECTED] > Subject: RE: Concurrency problem > > > Nyimi Jose wrote: > > > > > #!/usr/bin/perl -w > > use strict; > > use Proc::ProcessTable; > > use File::Basename; > > > > my $is_running=&a_check_subroutine(); > > sleep (60) if $is_running;#sleep 60 seconds > > > > sub a_check_subroutine{ > > my $script=quotemeta File::Basename::basename($0); > > my $t = new Proc::ProcessTable; > > foreach my $p (@{$t->table}){ > > return 1 if $p->cmndline =~ /$script/ ; > > } > > return 0; > > } > > __END__ > > > > checking the process table over and over again is very > costly. you should > try to grab the process id that you are tracking and just see if the > process is alive once a while. for example, the following > checks for the process started in working.pl and waits until > it finish: > > #!/usr/bin/perl -w > use strict; > > use Proc::ProcessTable; > > my ($id,$prg) = (0,''); > > for(@{Proc::ProcessTable->new->table}){ > if($_->cmndline =~ /working\.pl/){ > $id = $_->pid; > $prg = $_->cmndline; > last; > } > } > > die "working.pl is not running\n" unless($id); > > while(kill(0,$id)){ > sleep(1); > print "$prg still running as $id\n"; > } > > print "$prg finished\n"; > > __END__ > > this way, you don't have to check the process table over and > over again > which can be slow. > > david > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > DISCLAIMER "This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer". Thank you for your cooperation. For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Win32::AdminMisc, schedule task / cron job,
hi I haven't installed anything yet now i have some better idea i am trying to install - without success i downloded from the ftp site- extracted & then giving command C:\Perl\bin>perl ppm install C:\pradeep\net\perl\Bin\AdminMisc_5006/win32-daemon .ppd result Can't find unicode character property definition via main->r or r.pl at unicode/ Is/r.pl line 0 i am quite confused with .pm file etc - how to use or install ? regards pradeep > What is the error message you are getting? > Are you having Activestate perl or something else? > No, none of these modules are shipped with perl. You will have to install > them from the specified locations. > I think you have not installed the modules properly. Just check if you have > /site/lib/auto/win32/AdminMisc.pm? If it is present and still > you are getting the problems then may be something is wrong with the > installation. Just re-install or remove and install the modules. > > > > > Win32::AdminMisc (http://www.roth.net/perl/) > > Win32::Daemon (http://www.roth.net/perl/) > > Win32::Lanman ( http://jenda.krynicky.cz/ ) > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: "Can't locate MLDBM.pm ..."
On Sun, 26 Jan 2003 16:56:50 -0500, [EMAIL PROTECTED] (Ed Sickafus) wrote: >Since loading MLDBM-2.01, non-root, on an Apache > Cobalt Linux release 5.0 (Pacifica) > Kernel 2.2.16C27_III on an i586 running Perl 5.005_03 >a few weeks ago, I've experienced inconsistent difficulties with use MLDBM >and use Storable. >Storable was in place before MLDBM-2.01 was loaded. >does not compile: "Can't locate MLDBM.pm in @INC" >even though 3 copies of MLDBM.pm exist. >So, I removed/reinstalled Storable-2.05 non-root. Installation failed. The >log follows below. > Makefile.PL produced: > Warning: prerequisite Test::More 0.41 not found at (eval 1) line 220. > '' is not a known MakeMaker parameter name. > > make had no warnings. > > make test produced: t/downgrade.Can't locate Test/More.pm in @INC >(and more, see below) >CHUG, chug, phfft! :-( >Ed So you can't install Test::More? Then Storable again? Then MLDBM again? If this is on a remote server, on which you don't have root access, you are probably "knocking your head against a wall". Some of these modules need to use the c compiler to make themselves. If you do have the right to use the compiler, install all the modules to your home directory, and change your @INC so that your module is found first. You have to make sure that when @INC is searched, it finds your homemade version. Maybe you could ask the sysadmin to install the packages properly?? That would save you some trouble. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [ANN] splits2d.pl
John W. Krahn wrote: > The code looks pretty good over all, just a couple of minor nits. :-) Thank you!! Nits are good. I agree that variables declared "just in time" tend to be more self-documenting. I had some code manageability issues early on, so I was moving quite a few variable definitions around. I am going to correct these and see what else I can find that is like this; e.g., your comment about foreach my $var, i.e.,: > 129 my $doc; > 130 foreach $doc (@ARGV) > Would be better as: foreach my $doc (@ARGV) applies to a couple other foreach loops too and I am going to comb it some more and correct the known bugs (and even nits :) By the way, I am starting to test with a greater variety of HTML and noticed a fourth bug, but that is another post. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
HTML::TokeParser and
I recreated a problem in my program in a small code sample. The code below is giving me the following output at the console and I have no idea why: Output: line 1áline 3 I am seeing a lower case 'a' with an acute accent between 'line 1' and 'line 3'. Any idea what is going on? use strict; use warnings; use HTML::TokeParser; my $p = HTML::TokeParser->new(*DATA) or die "Can't open: $!"; while (my $tag = $p->get_tag()) { print $p->get_trimmed_text() if ($tag->[0] eq "dd") } __END__ __DATA__ line 1 line 3 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how do i get rid of "<> and , chars ??????
Hi everyone, I am have a probelm and I was hoping you could help. I am reading a line from a file and splitting it into a 2 dimensional array, this is no probs.. BUT i want to get rid of " < > and , out of each line - how do i do this ??? Thanks for your help in advanced Anadi __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
help me to replace ascii charecter with some other ascii charector or text
dear friends i'm in work place and i'm facing a problem of replacing an ascii character with some other ascii character i cut the ascii character from my word document and pasted it in my pear programme but the result is not as i expected. plese give me answer with simple codeing and also say me how to use word file as input file. my coding is as below @a=<>; $ln=join('',@a); $t= $ARGV; print "$t\n"; $ln=~s/ file://gis; $ln=~s/'/,/gis; $ln=~s/[]//gis; $ln=~s/[cr]//gis; $ln=~s/[abc]//gis; $ln=~s/_/_/gis; $ln=~s/ý/+/gis; $ln=~s//^/gis; $ln=~s/%/%/gis; $ln=~s//>/gis; print $ln; open (H, ">$ARGV"); print H $ln; Catch all the cricket action. Download Yahoo! Score tracker
RE: Help: trapped in a circle and can't get out.
R. Joseph Newton wrote: > Bob Showalter wrote: > This looks suspicious. I'd say your CPAN config is fubar. > > Hi Bob, > > Maybe I'm spoiled here, as I've always worked in integrated > development environments, and only ventured into Perl; when I > saw a good, transparent, installer available from > ActiveState. So in a case like this, what would be the > advantages and disadvantages of nuking-and-paving the Perl > installation to bring in an uncorrupted current version? None, but that's not what I said. I suspect that the configuration settings for CPAN.pm are messed up, because "yes" was answered to a configuration question that asked for a directory name. The "corruption" was introduced by human error. Reconfiguring CPAN should fix that problem. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Mysql Connection
Hi, I am trying to connect to MYSQL through my perl script.I am using windows 2000 and activeperl. I am using Net::MySQL to connect with database.But it is giving error : Couldn't connect to /tmp/mysql.sock: at E:\PERLTR~1\perl\VALIDA~1.PL line 12 My script is as follows: #!/usr/local/bin/perl print "Content-type:text/html\n\n"; use Net::MySQL; $DBHOST = "localhost"; $DBNAME = "sitebuilder"; $DBUSER = "sa"; $DBPASS = ""; my $mysql= Net::MySQL->new($DBHOST, $DBNAME , $DBUSER, $DBPASS); $mysql->query(q{SELECT sLoginId,sFirstName,sLastName FROM userdetail}); my $record_set = $mysql->create_record_iterator; while (my $record = $record_set->each) { printf "First column: %s Next column: %s\n", $record->[0], $record->[1],$record->[2]; } Please Can u help me? Thanks in advance! Pankaj
RE: Help: trapped in a circle and can't get out.
On Tue, 28 Jan 2003 08:38:25 -0500, Bob Showalter <[EMAIL PROTECTED]> wrote: > R. Joseph Newton wrote: > > Bob Showalter wrote: > > This looks suspicious. I'd say your CPAN config is fubar. > > > > Hi Bob, > > > > Maybe I'm spoiled here, as I've always worked in integrated > > development environments, and only ventured into Perl; when I > > saw a good, transparent, installer available from > > ActiveState. So in a case like this, what would be the > > advantages and disadvantages of nuking-and-paving the Perl > > installation to bring in an uncorrupted current version? > > None, but that's not what I said. I suspect that the configuration settings > for CPAN.pm are messed up, because "yes" was answered to a configuration > question that asked for a directory name. The "corruption" was introduced by > human error. Reconfiguring CPAN should fix that problem. > Agreed. But I am not sure CPAN.pm is where the user should look. For my setup I have ~/.cpan/CPAN/MyConfig.pm, which appears to be where the options are set, and if not there then it reads the defaults from CPAN.pm, so theoretically even if one blows away the global CPAN.pm then the option could still be set wrong. Does anyone know if there was a major change to how all of this was setup? To see the location CPAN is reading config info from you can do the previously mentioned at the shell (top line): cpan> o conf http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: :SMTP::Multipart Module
> > Dan Muey wrote: > > > > > Line 30 in that file is : > > our $VERSION = sprintf("%d.%d", q$Revision: 1.5 $ =~ > > /(\d+)\.(\d+)/);^M > > > > Notice that ^M? that's all over the file. I did > > perl -e '@f = `cat Multipart.pm`;foreach $l(@f) { $l =~ s/\^M//g; > > print $l; }' > Multipart2.pm > > > > And modified my test script to use the #2 version and that > gave me the > > same thing. > > not sure what you are trying to do. if you are trying to > remove the ^M Thanks, I wasn't sure if that was causing the original problem or not. My original problem was that I couldn't install the Net::SMTP::Multipart module. http://search.cpan.org/author/DROBERTS/Net-SMTP-Multipart-1.5/ I installed several modules that day, no problem. I was doing it as root. I have Net::SMTP installed as well as all of the other required modules. I tried doing it command line, via cpan module, and even did a use lib {/path.../); use Multipart; Just for kicks to see how it'd go but every time there was an error about $VERSION ( see snip below ) Any ideas? [snip] > > # perl Makefile.PL > > Checking if your kit is complete... > > Looks good > > 'HTMLLIBPODS' is not a known MakeMaker parameter name. > > Could not eval ' > > package ExtUtils::MakeMaker::_version; > > no strict; > > > > local $VERSION; > > $VERSION=undef; do { > > our $VERSION = sprintf("%d.%d", q$Revision: > > 1.4 $ =~ /(\d+)\.(\d+)/); > > }; $VERSION > > ' in Multipart.pm: Can't modify subroutine entry in > > scalar assignment at (eval 15) line 7, at EOF # ls > > Changes MANIFESTMakefile.PL Multipart.pm > > # make > > make: no target to make. [snip] > character, your s/\^M//g is not going to work. your text > editor is probably just being nice to you and show you the > '^' character so you know it's not a regular printable > character. it's probably a Ctrl-M character. try: > > [panda@dzhuo]$ perl -pi -e 's/\cM//g' your_file.pm [panda@dzhuo]$ > > david > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: question on copy file from map drive
Angela_work wrote: > Hi all, > > I have cgi.pl file in internet server. I would like to copy a log file(read > only file) in J:\ (which I map it to the other server) to my d:\temp folder. > With the following code, I got "can't open input : Permission denied" > message when I open th cgi.pl file thru IE browser. How could I get > Permission? Thanks. > > Angela It might have nothing to do with the code, but with the request. The default method for browser requests is GET, running cgi usually requires POST. Although there are probably easier ways, one Q&D approach would be to make an almost empty web page: function CallScript() { document.MyForm.submit(); } Call this to launch your script with the appropriate request type. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Email function question
Have you tried put a semi-colon and space on the end of each users name? @names=([EMAIL PROTECTED]; ,[EMAIL PROTECTED]; ,[EMAIL PROTECTED]; ); Terry -Original Message- From: Scott, Deborah [mailto:[EMAIL PROTECTED]] Sent: 27 January 2003 22:54 To: [EMAIL PROTECTED] Subject: RE: Email function question > >if your file is a text file > >#! /usr/bin/perl -w > >$file = "/suidbin/sendmail -t"; >$var = "the_file.txt"; > >open(FILE, "$var") || die "cant open text file"; >@file = ; >close(FILE); > >##open pipe to sendmail >open(MAIL, "|$file") || die "cant open sendmail"; >print MAIL "To: blah\@devnull.bz\n" ; >print MAIL "From: blah\@cyberspace.org\n" ; >print MAIL "Subject: Fresh\n\n" ; >foreach(@file){ > print MAIL; >} >close ( MAIL ) ; > > >-- >jd >[EMAIL PROTECTED] > >Bad spellers of the world untie! The above file works great on my NT server but how do I send it to multiple people? I've tried turning the addressee string into an array, in multiple ways. An example is the following: @addressee=("joe_employee\@my.com","jane_employee\@your.com"); foreach $i (@addressee) { open(MAIL, "|$file $addressee") || die "can't open sendmail"; print MAIL "To: $addressee\n" ; print MAIL "From: tom_employee\n" ; print MAIL "Subject: Email Message\n\n" ; AND THEN I've put the closing brackets in multiple places... but I get the error that NO RECIPIENT is specified. Sent to dead letter file. It works if I only specify one addressee. Help, again??? --Deborah -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mysql Connection
on Tue, 28 Jan 2003 01:27:15 GMT, [EMAIL PROTECTED] (Pankaj Kapare) wrote: > Hi, > I am trying to connect to MYSQL through my perl script.I am using > windows 2000 and activeperl. I am using Net::MySQL to connect with > database.But it is giving error : Couldn't connect to > /tmp/mysql.sock: at E:\PERLTR~1\perl\VALIDA~1.PL line 12 > [...] > my $mysql= Net::MySQL->new($DBHOST, $DBNAME , $DBUSER, $DBPASS); Try this instead: my $mysql = Net::MySQL->new( hostname => $DBHOST, database => $DBNAME, user => $DBUSER, password => $DBPASS, ); But why are you using Net::MySQL instead of DBI? -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how do i get rid of "<> and , chars ??????
Swami wrote: > I am reading a line from a file and splitting it into > a 2 dimensional array, this is no probs.. > BUT i want to get rid of " < > and , out of each line > - how do i do this ??? You can use the transliteration operator for this. You will have to use the d modifier to tell it to delete the characters you specify. Just put this into your code: while ($line=) # This is where you're reading in the file { chop $line; # this is the transliteration. Look for any " < > or , characters # and delete them. $line=~tr/"<>,//d; # now, you can do your splitting, etc... } If you prefer, you could of course use the tr on the array elements, after it was split. Regards, Jared -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how do i get rid of "<> and , chars ??????
> > Swami wrote: > > I am reading a line from a file and splitting it into > > a 2 dimensional array, this is no probs.. > > BUT i want to get rid of " < > and , out of each line > > - how do i do this ??? > > You can use the transliteration operator for this. You will > have to use the d modifier to tell it to delete the > characters you specify. Just put this into your code: > > while ($line=) # This is where you're reading in the file { > chop $line; > > # this is the transliteration. Look for any " < > or , > characters > # and delete them. > $line=~tr/"<>,//d; $line =~ s/\<|\>|\,|\"//g; or $line =~ s/[<>",]//g; # but you may have to backslash the chars here, not sure exactly, try it and see. Or you could use HTML::Parser, we had quite a discussion about it a few days ago. It is really handy and it look like that is what you are doing , at leats in part. > > # now, you can do your splitting, etc... > } > > If you prefer, you could of course use the tr on the array > elements, after it was split. > > Regards, > > Jared > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
GDBM_File help!
Hi, this is the output of profiler showing the bottle neck of a program. count wall tm cpu time line 14788 0.00 0.0082:sub check_positive{ 14788 0.072474 0.2683:local $a = 0; 14788 0.072475 0.2784:my ($addr) = @_; 14788 0.630970 0.7185:tie %hash, "GDBM_File",$whois_record, &GDBM_WRCREAT, 0644; 11666247 547.4904 679.270086:foreach my $cidr (keys %hash){ 11666247 595.2517 736.350087: my $block = new Net::Netmask($cidr); 11666247 581.9811 698.190088: if (($block -> match($addr)) != 0){ 14788 28.59408 28.2500089: return $cidr, $hash{$cidr}; } so the idea is the following: I previously form %hash written in GDBM_File. This hash has network address (for example 170.60.0.0/16) as a key and as value -the network name. In this subroutine I compare ip address against this network address to see if ip address match network (with the help of Net::Netmask module). If it matches I give back the key and value to main program. There is 14788 ip addresses for which I am checking. And in the hash there is around 1519 keys . Total time in this subroutine at the end is around 1900 sec...around half an hour, what is a lot! How can I more efficiently iterate over GDBM file or any idea how to make it working faster. Will 'while' loop make it faster? Thank you for any suggestions. Regards, Marija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: :SMTP::Multipart Module
Hello, I'm really hitting abrick wall here. Any help or insight would be greatly appreciated. I'm trying to get this Module installed: http://search.cpan.org/author/DROBERTS/Net-SMTP-Multipart-1.5/ [ console output below with step by step actions ] The line in the Multipart.pm file : our $VERSION = sprintf("%d.%d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/);^M Seems to casue an error about not being able to modify the Variable. With that I couldn't even get past Makefile.PM But if I remove the our I can do the make dance. But then I get an error about not finding a file in @INC. The directory exists /usr/local/lib/perl5/site_perl/5.005/i386-freebsd/auto/Net/SMTP/Multipart/ :: (root@q42(/home/dmuey/perlmod/Net-SMTP-Multipart-1.5 ):242)# ls \ ? /usr/local/lib/perl5/site_perl/5.005/i386-freebsd/auto/Net/SMTP/Multipart/ .packlist (root@q42(/home/dmuey/perlmod/Net-SMTP-Multipart-1.5 ):243)# but the file our.al doesn't exist there or anywhere on the server. Obviouosly it didn't get installed properly. I also did all of this with version 1.4 with the same results I even gid used gmake instead of make for kicks to same thing Has anybody ever run into this before? I'll hand out the prestigious genius of the day award for anyone who can get this :) Thanks Dan FROM SCRATCH and THE SCREEN:: (root@q42(/home/dmuey/perlmod ):226)# gzip -dc Net-SMTP-Multipart-1.5.tar.gz.tar |tar -xof - (root@q42(/home/dmuey/perlmod ):227)# cd Net-SMTP-Multipart-1.5 (root@q42(/home/dmuey/perlmod/Net-SMTP-Multipart-1.5 ):228)# perl Makefile.PL Checking if your kit is complete... Looks good 'HTMLLIBPODS' is not a known MakeMaker parameter name. Could not eval ' package ExtUtils::MakeMaker::_version; no strict; local $VERSION; $VERSION=undef; do { our $VERSION = sprintf("%d.%d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/); }; $VERSION ' in Multipart.pm: Can't modify subroutine entry in scalar assignment at (eval 15) line 7, at EOF (root@q42(/home/dmuey/perlmod/Net-SMTP-Multipart-1.5 ):229)# SO them I remove the 'our' mentioned above... (root@q42(/home/dmuey/perlmod/Net-SMTP-Multipart-1.5 ):230)# perl Makefile.PL Checking if your kit is complete... Looks good 'HTMLLIBPODS' is not a known MakeMaker parameter name. Writing Makefile for Net::SMTP::Multipart (root@q42(/home/dmuey/perlmod/Net-SMTP-Multipart-1.5 ):231)# make mkdir blib mkdir blib/lib mkdir blib/lib/Net mkdir blib/lib/Net/SMTP pod2text Multipart.pm >README pod2html Multipart.pm >Multipart.html cp Multipart.pm blib/lib/Net/SMTP/Multipart.pm mkdir blib/arch mkdir blib/arch/auto mkdir blib/arch/auto/Net mkdir blib/arch/auto/Net/SMTP mkdir blib/arch/auto/Net/SMTP/Multipart mkdir blib/lib/auto/Net mkdir blib/lib/auto/Net/SMTP mkdir blib/lib/auto/Net/SMTP/Multipart mkdir blib/man3 Manifying blib/man3/Net::SMTP::Multipart.3 /usr/bin/pod2man: Invalid man page - no documentation in Multipart.pm Couldn't install blib/man3/Net::SMTP::Multipart.3 (root@q42(/home/dmuey/perlmod/Net-SMTP-Multipart-1.5 ):232)# make install Installing /usr/local/lib/perl5/site_perl/5.005/Net/SMTP/Multipart.pm Installing /usr/local/lib/perl5/5.00503/man/man3/Net::SMTP::Multipart.3 Writing /usr/local/lib/perl5/site_perl/5.005/i386-freebsd/auto/Net/SMTP/Multipart/.packlist Appending installation info to /usr/libdata/perl/5.00503/mach/perllocal.pod (root@q42(/home/dmuey/perlmod/Net-SMTP-Multipart-1.5 ):233)# perl -e 'use Net::SMTP::Multipart;' Can't locate auto/Net/SMTP/Multipart/our.al in @INC (@INC contains: /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503 /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 .) at /usr/local/lib/perl5/site_perl/5.005/Net/SMTP/Multipart.pm line 28 BEGIN failed--compilation aborted at -e line 1. (root@q42(/home/dmuey/perlmod/Net-SMTP-Multipart-1.5 ):234)# So then I add the 'our' back to the module at /usr/local/lib/perl5/site_perl/5.005/Net/SMTP/Multipart.pm ... (root@q42(/home/dmuey/perlmod/Net-SMTP-Multipart-1.5 ):245)# perl -e 'use Net::SMTP::Multipart;'Can't modify subroutine entry in scalar assignment at /usr/local/lib/perl5/site_perl/5.005/Net/SMTP/Multipart.pm line 30, near ");" BEGIN failed--compilation aborted at -e line 1. (root@q42(/home/dmuey/perlmod/Net-SMTP-Multipart-1.5 ):246)# So then I get the original error about the variable. Which would seem to man that I need to fix the original problem and the it will get installed properly. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Trouble with hash lookup
Should be a simple question. I am trying to only print the element of the hash, that matches the $user string but it prints all of the elements. What am I missing. Thanks $user = "jsmith"; my %lookup = ( 'jsmith' => "jsmith1", 'djones' => "djones2", 'tday' => "tday3", ); for my $key (keys %lookup) { print "$lookup{$key}\n" if $key == $user; } -- prints: djones2 tday3 jsmith1 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Trouble with hash lookup
Try replacing "==" with "eq" print "$lookup{$key}\n" if $key eq $user; > -Original Message- > From: Kipp, James [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 28, 2003 3:12 PM > To: [EMAIL PROTECTED] > Subject: Trouble with hash lookup > > > Should be a simple question. I am trying to only print the > element of the > hash, that matches the $user string but it prints all of the > elements. What > am I missing. > Thanks > > $user = "jsmith"; > my %lookup = ( > 'jsmith' => "jsmith1", > 'djones' => "djones2", > 'tday' => "tday3", > ); > > for my $key (keys %lookup) { > print "$lookup{$key}\n" if $key == $user; > } > > -- > prints: > djones2 > tday3 > jsmith1 > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Trouble with hash lookup
thanks, Ed. I am pretty embarresed now :-) > -Original Message- > From: Ed Christian [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 28, 2003 3:19 PM > To: Kipp, James; [EMAIL PROTECTED] > Subject: RE: Trouble with hash lookup > > > Try replacing "==" with "eq" > > print "$lookup{$key}\n" if $key eq $user; > > > -Original Message- > > From: Kipp, James [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, January 28, 2003 3:12 PM > > To: [EMAIL PROTECTED] > > Subject: Trouble with hash lookup > > > > > > Should be a simple question. I am trying to only print the > > element of the > > hash, that matches the $user string but it prints all of the > > elements. What > > am I missing. > > Thanks > > > > $user = "jsmith"; > > my %lookup = ( > > 'jsmith' => "jsmith1", > > 'djones' => "djones2", > > 'tday' => "tday3", > > ); > > > > for my $key (keys %lookup) { > > print "$lookup{$key}\n" if $key == $user; > > } > > > > -- > > prints: > > djones2 > > tday3 > > jsmith1 > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Trouble with hash lookup
>Should be a simple question. I am trying to only print the element of the > hash, that matches the $user string but it prints all of the elements. What > am I missing. print "$lookup{$user}\n"; > Thanks > > $user = "jsmith"; > my %lookup = ( > 'jsmith' => "jsmith1", > 'djones' => "djones2", > 'tday' => "tday3", > ); > > for my $key (keys %lookup) { > print "$lookup{$key}\n" if $key == $user; > } > > -- > prints: > djones2 > tday3 > jsmith1 The reason it does this is you are using numeric comparison (==) instead of string comparison (eq), and all of the keys are numerically equal to $user. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Trouble with hash lookup
Hi James James Kipp wrote: > Should be a simple question. I am trying to only print the element of > the hash, that matches the $user string but it prints all of the > elements. What am I missing. > Thanks > > $user = "jsmith"; > my %lookup = ( > 'jsmith' => "jsmith1", > 'djones' => "djones2", > 'tday' => "tday3", > ); > > for my $key (keys %lookup) { > print "$lookup{$key}\n" if $key == $user; > } Ed is right, this should be 'if $key eq $user', but you're not using the hash as it should be used. This is similar to accessing array element 83 as follows: my $index =83; for my $i (0 .. $#array) { print $array[$i] if $i == $index; } You can just do: print "$lookup{$user}\n"; HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Trouble with hash lookup
> > > You can just do: > > print "$lookup{$user}\n"; > > HTH, Now am even more embarrassed :) Thanks Rob. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Trouble with hash lookup
On Tue, 28 Jan 2003, Rob Dixon wrote: > > > > $user = "jsmith"; > > my %lookup = ( > > 'jsmith' => "jsmith1", > > 'djones' => "djones2", > > 'tday' => "tday3", > > ); > > > > for my $key (keys %lookup) { > > print "$lookup{$key}\n" if $key == $user; > > } > > Ed is right, this should be 'if $key eq $user', but you're not using > the hash as it should be used. This is similar to accessing array > element 83 as follows: > > my $index =83; > for my $i (0 .. $#array) > { > print $array[$i] if $i == $index; > } > > You can just do: > > print "$lookup{$user}\n"; > And you might was well design something that scales while you're at it: =-=-=-=-=-=-=- %user = ("jsmith" => 1, "djones" => 1); my %lookup = ( 'jsmith' => "jsmith1", 'djones' => "djones2", 'tday' => "tday3", ); for my $key (keys %lookup) { print "$lookup{$key}\n", if defined $user{$key}; } =-=-=-=-=-=-=- jab -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Script...
Resending this message.. I don't know if it went out last time... Thanks for any help you can offer. ___ Hey guys: I'm still very new to perl and I need to know if this is at all possible... If possible... any ideas on how to go about it... Here is the deal... I would like to build a database with addresses for specific last names extracted from one of the online directories such as switchboard.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Script...
Carlos Diaz wrote: > > I'm still very new to perl and I need to know if this is at all > possible... If possible... any ideas on how to go about it... > > Here is the deal... I would like to build a database with addresses for > specific last names extracted from one of the online directories such as > switchboard.com i would love to help you if you can be more specific. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Script...
> > Hey guys: > > I'm still very new to perl and I need to know if this is at all possible... > If possible... any ideas on how to go about it... > Anything's possible with Perl. /me putting away pom-poms...right. > Here is the deal... I would like to build a database with addresses for > specific last names extracted > Absolutely possible. >from one of the online directories such as > switchboard.com > do you want to replicate their data? if so you have to find a way to hook their db, which I've never done, but I would think they want to you see their pretty ads so they're discouraging non-http access through port 80. but if you can find a way to exploit port 80 and derive info from there, you'd be left with parsing/displaying the data in your own way instead of maintaining your own dbase. btw, I'm not advocating hacking. what you want can definately be achieved with perl. if you particularly want to use a dbase to acquire the skills, DBI is a realy good choice. It's free and if you run BSD, is provided in the port tree. You can direct any further questions to me privately if you like. Though others might have better ideas... jab > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > Be straight and to the point. Don't waste others' time. Do your homework before you ask for help. --Unknown -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help me to replace ascii charecter with some other ascii charector or text
For starters, it looks like most of your replacements should use the tr/// function (also known as y///). http://www.perldoc.com/perl5.8.0/pod/perlop.html For seconds, $ln=~s/'/'/gis; looks like a no-op to me. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Email function question
>To make this work, you have to specify the list variable ($i): >$file = "/suidbin/sendmail -t"; >$var = "the_file.txt"; > >open(FILE, "$var") || die "cant open text file"; >@file = ; >close(FILE); >foreach $i (@addressee) { > open(MAIL, "|$file $addressee") || die "can't open sendmail"; > print MAIL "To: $i\n" ; > print MAIL "From: tom_employee\n" ; > print MAIL "Subject: Email Message\n" ; > >foreach(@file){ > print MAIL; >} >} >close ( MAIL ) ; > This worked perfectly on UNIX, but I also had to substitute $i for $addressee before it would work on the NT server. NOW MY NEXT PROBLEM... The NT machine will only read the first line of "the_file.txt." The 'cat' command doesn't seem to work on NT. (The UNIX machine has no problem reading and printing the entire txt. file.) THANK YOU! Someday I'll know enough Perl to help somebody else on this group. --Deborah -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: :SMTP::Multipart Module
Hello, It seems from what I find on google is that The error : Can't modify subroutine entry in scalar assignment ... Has to do with the version of perl. One person upgraded and that problem went away but a different on ecame up. One message was a module author saying 'Are you using 5.005? Rats I guess I need to build backward compatability into the module.' So now my question is this : Before I go and install perl 5.6, is there a way fo rme to modify whtever is causing that so that I can add backward copatability myself? Thanks Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HTML::TokeParser and
David Eason wrote: > > I recreated a problem in my program in a small code sample. The code below > is giving me the following output at the console and I have no idea why: > > Output: > line 1áline 3 > > I am seeing a lower case 'a' with an acute accent between 'line 1' and 'line > 3'. Any idea what is going on? According to HTML::Entities # Some extra Latin 1 chars that are listed in the HTML3.2 draft (21-May-96) copy => '©', # copyright sign reg=> '®', # registered sign nbsp => "\240", # non breaking space > use strict; > use warnings; > use HTML::TokeParser; > > my $p = HTML::TokeParser->new(*DATA) or die "Can't open: $!"; > while (my $tag = $p->get_tag()) > { > print $p->get_trimmed_text() if ($tag->[0] eq "dd") if ( $tag->[0] eq 'dd' ) { ( my $text = $p->get_trimmed_text() ) =~ tr/\240/ /; print $text; } > } > > __END__ > __DATA__ > line 1 > > line 3 Using both __END__ and __DATA__ is redundant as the DATA filehandle will read from either (unless you have require'd this from another program.) perldoc perldata John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how do i get rid of "<> and , chars ??????
Dan Muey wrote: > > $line =~ s/\<|\>|\,|\"//g; > or > $line =~ s/[<>",]//g; # but you may have to backslash the chars here, not sure > exactly, try it and see. You don't have to backslash these characters as they are not special in regular expressions $line =~ s/<|>|,|"//g; However using tr/<>,"//d is faster and doesn't use a regular expression so you don't have to worry about which characters are special. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help me to replace ascii charecter with some other ascii charector or text
Kasi ramanathen wrote: > > dear friends i'm in work place and i'm facing a problem of replacing an > ascii character with some other ascii character i cut the ascii character > from my word document and pasted it in my pear programme but the result > is not as i expected. plese give me answer with simple codeing and also > say me how to use word file as input file. my coding is as below You _should_ be use'ing warnings and strict when developing your code. > @a=<>; > $ln=join('',@a); It is more efficient to undef the input record separator and slurp the file into a scalar. > $t= $ARGV; > print "$t\n"; > $ln=~s/ > file://gis; > > $ln=~s/'/,/gis; > $ln=~s/[?]//gis;s; > $ln=~s/[cr]//gis; > $ln=~s/[abc]//gis; > $ln=~s/_/_/gis; > $ln=~s/ý/+/gis; > $ln=~s/^/^/gis; > $ln=~s/%/%/gis; > $ln=~s/ $ln=~s/'/'/gis; > $ln=~s/'/'/gis; > $ln=~s/"/"/gis; > $ln=~s/"/"/gis; > $ln=~s/o/ú/gis; > $ln=~s/-/--/gis; > $ln=~s/-//gis; > $ln=~s/~/~/gis; > $ln=~s/>/>/gis; All of your substitutions use the /s option which determines wheather the dot (.) matches a newline or not. Since none of the regular expressions uses a dot, the /s option is not needed. All of your substitutions use the /i option which affects how alphabetic characters are matched but most of your regular expressions do not contain alphabetic characters. > print $ln; > open (H, ">$ARGV"); You should _always_ verify that the file was opened correctly. > print H $ln; It looks like you want to modify the file "in-place" and perl provides a method to do this. #!/usr/bin/perl -w use strict; $/ = undef; $^I = '.bak'; while ( <> ) { print "$ARGV\n"; s/\nfile://gi; tr/'?\177/,\177/; tr/crabc//d; tr/_ý^%<'"o/_+^%<'"ú/; s/-/--/g; s/-//g; tr/~>/~>/; } __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: GDBM_File help!
Marija Silajev wrote: > > Hi, Hello, > this is the output of profiler showing the bottle neck of a program. > > count wall tm cpu time line > 14788 0.00 0.0082:sub check_positive{ > 14788 0.072474 0.2683:local $a = 0; Why use $a instead of a lexical variable? > 14788 0.072475 0.2784:my ($addr) = @_; > 14788 0.630970 0.7185:tie %hash, > "GDBM_File",$whois_record, &GDBM_WRCREAT, 0644; > > 11666247 547.4904 679.270086:foreach my $cidr (keys %hash){ > 11666247 595.2517 736.350087: my $block = new Net::Netmask($cidr); > 11666247 581.9811 698.190088: if (($block -> match($addr)) != 0){ > 14788 28.59408 28.2500089: return $cidr, $hash{$cidr}; > } > > so the idea is the following: > I previously form %hash written in GDBM_File. This hash has network > address (for example 170.60.0.0/16) as a key and as value -the network > name. In this subroutine I compare ip address against this network > address to see if ip address match network (with the help of > Net::Netmask module). If it matches I give back the key and value to > main program. > > There is 14788 ip addresses for which I am checking. And in the hash > there is around 1519 keys . > > Total time in this subroutine at the end is around 1900 sec...around > half an hour, what is a lot! > > How can I more efficiently iterate over GDBM file or any idea how to > make it working faster. Will 'while' loop make it faster? Instead of opening the file every time the subroutine is called, you should open it once in the main program. You could store the hash in memory and then write it back out to the file if any changes were made. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Trouble with hash lookup
James Kipp wrote: > > Should be a simple question. I am trying to only print the element of the > hash, that matches the $user string but it prints all of the elements. What > am I missing. > Thanks > > $user = "jsmith"; > my %lookup = ( > 'jsmith' => "jsmith1", > 'djones' => "djones2", > 'tday' => "tday3", > ); > > for my $key (keys %lookup) { > print "$lookup{$key}\n" if $key == $user; > } > > -- > prints: > djones2 > tday3 > jsmith1 Replace the for loop with: print "$lookup{$key}\n" if exists $lookup{$key}; perldoc -f exists John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Email function question
Deborah Scott wrote: > > >To make this work, you have to specify the list variable ($i): > > >$file = "/suidbin/sendmail -t"; > >$var = "the_file.txt"; > > > >open(FILE, "$var") || die "cant open text file"; > >@file = ; > >close(FILE); > >foreach $i (@addressee) { > > open(MAIL, "|$file $addressee") || die "can't open sendmail"; > > print MAIL "To: $i\n" ; > > print MAIL "From: tom_employee\n" ; > > print MAIL "Subject: Email Message\n" ; > > > >foreach(@file){ > > print MAIL; > >} > >} > >close ( MAIL ) ; > > > > This worked perfectly on UNIX, but I also had to substitute $i for > $addressee before it would work on the NT server. > > NOW MY NEXT PROBLEM... > > The NT machine will only read the first line of "the_file.txt." The 'cat' > command doesn't seem to work on NT. (The UNIX machine has no problem reading > and printing the entire txt. file.) You probably need binmode perldoc -f binmode my $file = '/suidbin/sendmail -t'; my $var = 'the_file.txt'; open FILE, $var or die "cant open $var: $!"; binmode FILE; my @file = ; close FILE; foreach my $i ( @addressee ) { open MAIL, "|$file $addressee" or die "can't open sendmail: $!"; print MAIL "To: $i\n" ; print MAIL "From: tom_employee\n" ; print MAIL "Subject: Email Message\n" ; print MAIL @file; close MAIL or die "Cannot close pipe to sendmail: $!"; } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help me to replace ascii charecter with some other ascii charector or text
Kais, Those are not ASCII characters. Nor arem ost of them control characters. They are extended charcters, based on an unsigned, rather than signed, char type. ASCII proper only extends to character 127, the upward-pointing triangle [or the character so rendered by my command environment]. The other characters also print at my DOS prompt, and all seem to be accented or otherwise top-decorated latin characters. Unfortunately, these do not translate into ASCII very well in many formats [including e=mail]. See the readout below for an illustration. kasi ramanathen wrote: > $ln=~s/'/,/gis; > $ln=~s/[]//gis; and... John wrote: > $ln=~s/'/,/gis; > $ln=~s/[?]//gis;s; I took the part from the opening bracket to end-of-line from each of those second lines, and used ord() to get the ASCII/Unicode value: #!/usr/bin/perl -w use strict; open IN, "; close IN; foreach my $Line (@Lines) { my @Chars = split //, $Line; print "\n$Line\n"; foreach (@Chars) { my $num = ord($_); print "$num\n"; } } Kasi's original 91 143 144 157 129 141 127 93 47 127 47 103 105 115 59 10 John's "copy:" 91 63 63 63 63 63 127 93 47 127 47 103 105 115 59 115//extra semicolon 59 //extra 's' 10 If you want to actually use the non-ASCII characters contained in MS Word, you will have to learn the wider character set used. You may also need to come up with a list of MS Word control characters. I'm not sure what the solution is. I assume that part of the work of a locale object is to abstract the difference by mapping an appropriate slice of unicode to the first 127 characters, according to usage within the language group. Unfortunately, you were extremely vague about which characters you wish to change to which. What are the results you expected to see? This may be part of the problem. It is NEVER a good idea to try to code a problem until you can explain in plain language EXACTLY what you want to see happen. An ameoba is a genius compare to even the most sophisticated processor. No compiler or machine can fill in the blanks for you. They are machines, not mind-readers. Please write, include a little less code, but explain exactly what you expect each line you do send to do. People will be able to help you much more. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]