Re: Creating images
LRMK - Original Message - From: dan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 29, 2004 3:33 AM Subject: Re: Creating images This does exactly what I want, except I used the output code from JupiterHost.Net's suggestion, as i wanted to output straight to the browser, not to a file. The only other issue I'd have, is it possible to change the font of Custom Text to Tahoma? If so, how do it do it, and do I need any additional files? Cheers, Dan Randy W. Sims [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 6/25/2004 6:56 PM, dan wrote: Hi all, again! I'm attempting to make a web page, where all the buttons are dynamic, where dynamic I say there's 1 template button image with nothing written on it, and I want to put requests into a html page to call a script as an image to put text on top of the image, then output as 1 image. Does this make sense what I'm try to do? Is this even possible? If so, what's the best way of going about it, as I have absolutely no idea where to start on this one. I've aquired Apache::ImageMagick, but can't make head nor tail of the readme. Try the GD module. I think it does what you want. (untested) use GD; my $img = GD::Image-newFromJpeg( $file ); my $black = $img-colorAllocate( 0, 0, 0 ); $img-string( gdSmallFont, 10, 10, 'Custom Text', $black ); # open( FH, 'outfile' ) or die; #binmode( FH ); #print FH $img-png(); #close( FH ); #To output to the browser use the following method print Cache-Control: no-cache\n;#probably you will need this line to stop browsing from caching your output print Content-Type: image/png\n\n; #tell the browser and the server what type of data that you are sending binmode(STDOUT); print $img-png(); __END__ Regards, Randy. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Installing a module when you have limited permissions
I used to upload the pm files in to a directory using a FTP program and in to a folder in my web site and add the full path of that directory in to the @INC array in each of the perl scripts that uses that module and then inport the module. So far it worked for me. ex:- if your module is MyModule.pm ant it is uploaded to /home/myuser/my_module_store add this code to your scripts unshift @INC '/home/myuser/my_module_store'; use MyModule; I am not sure whether this works for complex modules that has c compiled files in it. LRMK - Original Message - From: jason corbett [EMAIL PROTECTED] To: perl beginners [EMAIL PROTECTED] Sent: Tuesday, June 29, 2004 9:39 PM Subject: Installing a module when you have limited permissions Hello. I wanted to know if someone has installed a PERL module on a server where they had limitied permissions? I am not extremely UNIX savy but I do know the basic and know the something about the file structures, etc. Can someone tell me how I can install MIME::Lite on a server where I may use it, and give others permission to use my install? Thanks, JC -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: How to email my results to a group of people....
Gunnar Hjalmarsson wrote: Jason Corbett wrote: I hear PEAL has emailing (in attachment format) capabilities? I down-loaded the module MIME::Lite, but I am not sure how to get this going. How about studying the docs for the module? Also, such a script was recently posted to this list: http://www.mail-archive.com/beginners%40perl.org/msg59279.html the only problem with the example in this posted message, if using MIME::Lite, and using smtp, is MIME::Lite doesn't have any means of SMTP authetication, as far as I can find. The Mail::Sender has a provision for SMTP authentication for closed relay system, which most MTA are now ;) If I am right MIME::Lite is not for sending e-mails with atachments it actualy generate the text of the e-mail including the atachments then you can send that text through any e-mailing module or software (Ex:- Mail Sender or SendMail) That module/Software will have to take care of authentication. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Re: Comparing Directories
there are commented print statements in two places which look like this :- #print $key\n; uncomment them and you will get what you want here is the full code for that... changes are marked by comments ### compare(c:\\program files,d:\\program files); #Example call sub compare($$){ my ($p1, $p2) [EMAIL PROTECTED]; print comparing $p1 and $p2\n; opendir(DIR1, $p1); my @dirList1 = readdir(DIR1); closedir(DIR1); opendir(DIR2, $p2); my @dirList2 = readdir(DIR2); closedir(DIR2); my %hash1; my %hash2; foreach my $item (@dirList1){ $hash1{$item} = 1; } foreach my $item (@dirList2){ $hash2{$item} = 1; } my $c=0; print \nList of items that are in $p1 but not in $p2\n; ### This header line is added foreach my $key (sort keys %hash1){ if ($hash2{$key}!=1){ print $key\n; #This line was commented in previous code $c++ } } print Number of items that are in $p1 but not in $p2 - $c\n; $c=0; print \nList of items that are in $p2 but not in $p1\n; ### This header line is added foreach my $key (sort keys %hash2){ if ($hash1{$key}!=1){ print $key\n; #This line was commented in previous code $c++; } } print Number of items that are in $p2 but not in $p1 - $c\n; print ___\n; foreach my $key (sort keys %hash1){ if (($hash2{$key}==1)(isSubDirectory($p1,$key))(isSubDirectory($p2,$key))){ compare($p1 . \\ . $key, $p2 . \\ . $key); } } } sub isSubDirectory($$){ my ($path, $item)[EMAIL PROTECTED]; #print $path, $item\n; my $myItem = $path. \\ . $item; if ($item =~m/^(\.)+$/){ return 0; } if (-d $myItem){ return 1; }else{ return 0; } } ## LRMK - Original Message - From: sudhindra k s To: LRMK Cc: [EMAIL PROTECTED] Sent: Thursday, June 24, 2004 11:39 AM Subject: Re: Re: Comparing Directories Hi Thanks. I tried this script. It compares the filenames within the directory very well. But i want to compare even the contents and report the differences between the files. Regards Sudhindra On Tue, 22 Jun 2004 LRMK wrote : This must do the A TITLE=Click for more information about job STYLE=text-decoration: none; border-bottom: medium solid green; HREF=http://search.targetwords.com/u.search?x=5977|1job|AA1VDwjob/A but there must be a more nice looking way of doing this Code ___ compare(c:\\program files,d:\\program files); #Example call sub compare($$){ my ($p1, $p2) [EMAIL PROTECTED]; print comparing $p1 with $p2\n; v Loading direcrory 1 opendir(DIR1, $p1); my @dirList1 = readdir(DIR1); closedir(DIR1); v Loading direcrory 2 opendir(DIR2, $p2); my @dirList2 = readdir(DIR2); closedir(DIR2); my %hash1; my %hash2; foreach my $item (@dirList1){ $hash1{$item} = 1; } foreach my $item (@dirList2){ $hash2{$item} = 1; } Counting the items that are in Path 1 but not in path 2 my $c=0; foreach my $key (sort keys %hash1){ if ($hash2{$key}!=1){ #print $key\n; $c++ } } print Number of items that are in $p1 but not in $p2 - $c\n; Counting the items that are in Path 2 but not in path 1 $c=0; foreach my $key (sort keys %hash2){ if ($hash1{$key}!=1){ #print $key\n; $c++; } } print Number of items that are in $p2 but not in $p1 - $c\n; print ___\n; ### Comparing Sub directories foreach my $key (sort keys %hash1){ if (($hash2{$key}==1)(isSubDirectory($p1,$key))(isSubDirectory($p2,$key))) { compare($p1 . \\ . $key, $p2 . \\ . $key); } } } Sub to check whether an item is a valid sub directory of the given path sub isSubDirectory($$){ my ($path, $item)[EMAIL PROTECTED]; if ($item =~m/^(\.)+$/){ return 0; } my $myItem = $path. \\ . $item; if (-d $myItem){ return 1; }else{ return 0; } } LRMK - Original Message - From: sudhindra k s [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 22, 2004 1:24 PM Subject: Comparing Directories Hi I have two directories with a path as shown below c:\test\result\... and d:\test2\result2\... The directory stucture and files after these are the same. i.e
Regx for validating E-Mail addresses
I am using following code to validate e-mail addresses if ($mail =~ m/^(\w+(\.|-))*\w+\@(\w+(\.|-)*)+\w+$/){ valid }else{ invalid } it will give valid results for all of the following e-mail address [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] ... but I am not sure about the illegal chars for an e-mail address can someone check above code tell me whether this matches all the valid e-maill address and only the valid e-mail addresses. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Re: Comparing Directories
Sorry I miss understood your requirement in my previous post this will compaire the content of the files too but it will only tell you whethr they are equal or not if you need a more detailed report you will need to change the logic of compreFiles method compare(c:,D:); sub compare($$){ my ($p1, $p2) [EMAIL PROTECTED]; print comparing $p1 and $p2\n; opendir(DIR1, $p1); my @dirList1 = readdir(DIR1); closedir(DIR1); opendir(DIR2, $p2); my @dirList2 = readdir(DIR2); closedir(DIR2); my %hash1; my %hash2; foreach my $item (@dirList1){ $hash1{$item} = 1; } foreach my $item (@dirList2){ $hash2{$item} = 1; } my $c=0; print \nList of items that are in $p1 but not in $p2\n; foreach my $key (sort keys %hash1){ if ($hash2{$key}!=1){ print $key\n; $c++ } } print Number of items that are in $p1 but not in $p2 - $c\n; $c=0; print \nList of items that are in $p2 but not in $p1\n; foreach my $key (sort keys %hash2){ if ($hash1{$key}!=1){ print $key\n; $c++; } } print Number of items that are in $p2 but not in $p1 - $c\n; print ___\n; foreach my $key (sort keys %hash1){ if (($hash2{$key}==1)(isSubDirectory($p1,$key))(isSubDirectory($p2,$key))){ compare($p1 . \\ . $key, $p2 . \\ . $key); }else{ compareFile($p1 . \\ . $key, $p2 . \\ . $key) } } } sub isSubDirectory($$){ my ($path, $item)[EMAIL PROTECTED]; #print $path, $item\n; my $myItem = $path. \\ . $item; if ($item =~m/^(\.)+$/){ return 0; } if (-d $myItem){ return 1; }else{ return 0; } } sub compareFile($$){ my($f1, $f2) [EMAIL PROTECTED]; print Comparing $f1 and $f2\n; my $fd1 = loadFile($f1); my $fd2 = loadFile($f2); if ($fd1 eq $fd2){ print File $f1 and $f2 has the same content\n; }else{ print Content of $f1 and $f2 are different\n } } sub loadFile($){ my ($f) = @_; open(MYFILE, $f); binmode($f); my $data =MYFILE; close(MYFILE); return $data; } LRMK - Original Message - From: sudhindra k s [EMAIL PROTECTED] To: LRMK [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, June 24, 2004 11:39 AM Subject: Re: Re: Comparing Directories Hi Thanks. I tried this script. It compares the filenames within the directory very well. But i want to compare even the contents and report the differences between the files. Regards Sudhindra On Tue, 22 Jun 2004 LRMK wrote : This must do the A TITLE=Click for more information about job STYLE=text-decoration: none; border-bottom: medium solid green; HREF=http://search.targetwords.com/u.search?x=5977|1job|AA1VDwjob/A but there must be a more nice looking way of doing this Code ___ compare(c:\\program files,d:\\program files); #Example call sub compare($$){ my ($p1, $p2) [EMAIL PROTECTED]; print comparing $p1 with $p2\n; v Loading direcrory 1 opendir(DIR1, $p1); my @dirList1 = readdir(DIR1); closedir(DIR1); v Loading direcrory 2 opendir(DIR2, $p2); my @dirList2 = readdir(DIR2); closedir(DIR2); my %hash1; my %hash2; foreach my $item (@dirList1){ $hash1{$item} = 1; } foreach my $item (@dirList2){ $hash2{$item} = 1; } Counting the items that are in Path 1 but not in path 2 my $c=0; foreach my $key (sort keys %hash1){ if ($hash2{$key}!=1){ #print $key\n; $c++ } } print Number of items that are in $p1 but not in $p2 - $c\n; Counting the items that are in Path 2 but not in path 1 $c=0; foreach my $key (sort keys %hash2){ if ($hash1{$key}!=1){ #print $key\n; $c++; } } print Number of items that are in $p2 but not in $p1 - $c\n; print ___\n; ### Comparing Sub directories foreach my $key (sort keys %hash1){ if (($hash2{$key}==1)(isSubDirectory($p1,$key))(isSubDirectory($p2,$key))) { compare($p1 . \\ . $key, $p2 . \\ . $key); } } } Sub to check whether an item is a valid sub directory of the given path sub isSubDirectory($$){ my ($path, $item)[EMAIL PROTECTED]; if ($item =~m/^(\.)+$/){ return 0; } my $myItem = $path. \\ . $item; if (-d $myItem){ return 1; }else{ return 0; } } LRMK - Original Message - From: sudhindra k s [EMAIL PROTECTED] To: [EMAIL
Re: Printing hash of hashes
I used this code In a ASP code to display the entire content of hashes I did some changes to neke it pure perl it should be good for your job ex:- printIt(, %hashToPrint); sub printIt($%){ my ($myfix, %hash)[EMAIL PROTECTED]; foreach my $k(sort keys %hash){ print $myfix $k\t=\t$hash{$k}\n; if ($hash{$k} =~ m/=HASH/){ my %th = %{$hash{$k}}; printIt($myfix . \t, %th); } } } LRMK - Original Message - From: Daniel Falkenberg [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 24, 2004 9:21 PM Subject: Printing hash of hashes Hello All, I need to print my hash of hashes. For example... %HoH = ( flintstones = { lead = fred, pal = barney, }, jetsons = { lead = george, wife = jane, his boy = elroy, }, simpsons= { lead = homer, wife = marge, kid = bart, }, ); How can I print that in a readable format. Then I would like to be able to print for example... Simpsons, Lead, homer. Any ideas? Regards, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Class to select/insert/delete/update
I think it will be nice if you write more hgher level methods for each InsertSelect, Update, Create, And Delete commends. Ex:- An Insert method which take the table name and a Hash as args and cunstruct the query and execute it sub Insert($%){ $self = shift; my ($table,%data) = @_; my @keyArray = keys %data; my @valueArray; foreach my $key (@keyArray){ $valueArray[++$#valueArray] = $self-{dbh}-quote($hash{$key}); } my $query = INSERT INTO $table ( . join(',', @keyArray) . ) VALUES( . join(',' @valueArray) . ); $self-{dbh}-do($query); } like that you can also write a method for select which takes the tablename, a list of fields to query and the where cluse, and orderby clouse as arguments And a update method and list goes on You may also write methods for locking and unlocking, commiting and rollbacking That approach will minimize the SQL that you have to write when you use databases LRMK - Original Message - From: Rod Za [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 25, 2004 3:04 AM Subject: Class to select/insert/delete/update Hello, i'm trying to make a class to do select/insert/delete/update on a MySQL table (via DBI). this is a snip of code: sub query{ my $self = shift; my($sql) = @_; my @result; my $sth = $self-{dbh}-prepare($sql) or return undef; if($sql =~ /delete|insert/gi){ $sth-execute() or return undef; my $rows = $sth-rows; ($rows == 0) ? 0E0 : $rows; } else { $sth-execute() or return undef; my @row; while(@row = $sth-fetchrow_array){ foreach my $i (0..$#row){ push(@result,$row[$i]); } } $sth-finish(); return @result; } } I like to receive an opnion or someone to indicate me something similars. Thnak you __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: open CONSOLE?
For windows try this sub executeTool($){ my ($toolPath) = @_; my $comspec = $ENV{'COMSPEC'}; # Get the path to the command line interpriter if this ENV var is not available in your system you will need to hard code this part open(TOOL, $comspec /c $toolPath|); my $result = TOOL; # you will need to put this in a loop if the too gives multiple lines of output close(TOOL); return $result; } if your too going to give multiple lines of out put you will need to make some small changes LRMK - Original Message - From: Randy W. Sims [EMAIL PROTECTED] To: perl.org [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, June 23, 2004 3:59 PM Subject: Re: open CONSOLE? perl.org wrote: Hi, Is there a way to explicitly open a handle to the console, or wherever STDOUT/STDERR are directed to by default? My process is running in an environment in which STDOUT and STDERR have already been redirected. I want to intercept these streams when running command line tools, then restore them afterwards. I want to be able to call my command line tool like: my ${ret} = `command 21`; and have ${ret} get the both STDOUT and STDERR. This piece gets called a lot so I want to avoid temp files if I can. This has to work on Windows if that makes any difference (I think that means no /dev/console, etc.). I know about: open( RESTORESTDOUT, 'STDOUT' ); and I think I can restore the redirected STDOUT from there, but how to I open STDOUT so that it goes to the console, as if it had never been redirected? Hopefully this makes some sense. open( OUT, 'con' ); # IIRC I /think/ you can also use POSIX::fdopen() or IO::Handle::new_from_fd() to get the standard streams. Randy. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Comparing Directories
This must do the job but there must be a more nice looking way of doing this Code ___ compare(c:\\program files,d:\\program files); #Example call sub compare($$){ my ($p1, $p2) [EMAIL PROTECTED]; print comparing $p1 with $p2\n; v Loading direcrory 1 opendir(DIR1, $p1); my @dirList1 = readdir(DIR1); closedir(DIR1); v Loading direcrory 2 opendir(DIR2, $p2); my @dirList2 = readdir(DIR2); closedir(DIR2); my %hash1; my %hash2; foreach my $item (@dirList1){ $hash1{$item} = 1; } foreach my $item (@dirList2){ $hash2{$item} = 1; } Counting the items that are in Path 1 but not in path 2 my $c=0; foreach my $key (sort keys %hash1){ if ($hash2{$key}!=1){ #print $key\n; $c++ } } print Number of items that are in $p1 but not in $p2 - $c\n; Counting the items that are in Path 2 but not in path 1 $c=0; foreach my $key (sort keys %hash2){ if ($hash1{$key}!=1){ #print $key\n; $c++; } } print Number of items that are in $p2 but not in $p1 - $c\n; print ___\n; ### Comparing Sub directories foreach my $key (sort keys %hash1){ if (($hash2{$key}==1)(isSubDirectory($p1,$key))(isSubDirectory($p2,$key))){ compare($p1 . \\ . $key, $p2 . \\ . $key); } } } Sub to check whether an item is a valid sub directory of the given path sub isSubDirectory($$){ my ($path, $item)[EMAIL PROTECTED]; if ($item =~m/^(\.)+$/){ return 0; } my $myItem = $path. \\ . $item; if (-d $myItem){ return 1; }else{ return 0; } } LRMK - Original Message - From: sudhindra k s [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 22, 2004 1:24 PM Subject: Comparing Directories Hi I have two directories with a path as shown below c:\test\result\... and d:\test2\result2\... The directory stucture and files after these are the same. i.e if there is a directory xyz within c:\test\result\, there will be a corresponding directory xyz within d:\test2\result2\ with the file names also being the same. now i want to compare the contents of the directories and output the difference between the two if any. How can i acheive this? Regards Sudhindra -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules
I think so I am using Perl 5.8 and I never installed those modules manualy, but my scripts which uses those modules work just fine that means they comes with Perl. LRMK - Original Message - From: aditi gupta [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 19, 2004 7:46 AM Subject: modules hi to all, do LWP and HTTP::Request modules come alongwithh perl (activeperl 5.8) or one has to separately install them? Yahoo! India Matrimony: Find your partner online. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Perl hosting
Try making a search in www.Clickherefree.com by the way if you are looking for paid hosting there are plenti of places here are few www.whm-host.com www.4webh.com www.netfirms.com LRMK - Original Message - From: Ziggy [EMAIL PROTECTED] To: L:Perl-Beginners [EMAIL PROTECTED] Sent: Friday, June 18, 2004 6:53 PM Subject: Perl hosting Is there any hosting service that can host my perl scripts? Perhaps even a free one? -- Visit me. http://ziggy.fateback.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: local module
use test; or require test; Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators - Original Message - From: Boon Chong Ang [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, May 31, 2004 3:38 PM Subject: local module Hi, Just say I have a module name as test.pm in a file. How do I ask perl to use that test.pm in my perl script? I know that it has something include Within the perl script itself but I just forget where I seen it before. Thank you best regards, ABC -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: [Socket Programming]: Need info for Client / Server scenario
This is a pritty involved field for me. In perl FORKING will create a copy of memory of the existing thread so Data sharing within the program is not posible All the veriables are local to the thread. To share data the stratagy I used is as follows. The master thread or the data producer updates a database while all the other threads are fetching data from that database. Delays of responding client is one problem that I faced when using Forks in Multy threaded servers in Windows Platform so far I have not been able to fix that problem. But you can use a different approach to give information to clients. Why don't you use a web server as a server and write a CGI program to give information to your child clients, the CGI will query the DB and give the data to clients. or The Master server can update a file (Text) insted of updating the database, which can be directly accessable through the web server. So each time the clients need data it download the file from the web server. Even the master server can be written as a CGI program in a web server so the master client simply post the data to its URL. I think it is always a good Idear to avoid writing your own servers specialy when there is a option. Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, May 31, 2004 10:06 AM Subject: [Socket Programming]: Need info for Client / Server scenario Hi, I need some good links for understanding socket programming (Client / Server programming). I have written some scripts for multiple clients and a server (Forking Server). But I am facing some problems - the server data has to be shared among all the child processes - does this happen when we fork - what should I do for this to happen. Requirement is: Normal clients keep polling the server for some info. Server will get some info from a master client till then the server responds back with null info to the Normal clients. The server data that my master client is updating should get reflected in all the child processes (of forked server) - this is not happening. What should I do to achieve this? Also I want my server to respond back immediately to all the clients getting connected. This is not happening. Kindly help me in solving the problem. Following are the code snippets for clients and server: Server Code Snippet: my $MySocket = new IO::Socket::INET( LocalHost = $hostname, LocalPort = 7890, Proto = 'tcp', Listen= SOMAXCONN, Reuse = 1); $MySocket or die Error: no socket :$!; STDOUT-autoflush(1); print Server Program Started\n; print Waiting ...\n; while ($client_sock = $MySocket-accept()) { # execute a fork, if this is # the parent, its work is done, # go straight to continue next if $kid = fork; die fork: $!\n unless defined $kid; # child now... # close the server - not needed close $MySocket; STDOUT-autoflush(1); print \nACCEPTED: New Client\n; while (defined($buf = $client_sock)) { chomp ($buf); print Recievied: $buf\n; if ($buf =~ / NORMAL_CLIENT/i) { ... # return NULL if $val is NULL # else return proper value $buf = $val; } elsif ($buf =~ /MASTER_CLIENT/) { ... # read the info # update the variable $val if not NULL $val = $client_sock; (SERVER DATA) chomp $val; if ($val ne '') { $buf = SUCCESS; } else { $buf = FAILURE; } } #send msg to client print $client_sock $buf\n; } exit; } continue { close $client_sock; } Normal Client Code Snippet: while ($TRUE) { $MySocket = new IO::Socket::INET( PeerAddr = $ServerName, PeerPort = $port, Proto= 'tcp'); if (!$MySocket) { print Failed to Connect to Server: $ServerName\n; print Trying to connect again after 10 seconds\n; sleep (10); next; } else { last; } } print Connected to \n; print Processing ...\n; while ($TRUE) { print $MySocket NORMAL_CLIENT_.$host\n; $Message = $MySocket; chomp $Message; if ($Message eq ''}) { print NULL Msg from Server. Polling after (time in seconds): ,$TIME_DELAY * $ONE_MINUTE,\n; sleep ($TIME_DELAY * $ONE_MINUTE ); } else { print Msg from Server: $Message\n; } }#end of while close $MySocket; Master Client Code Snippet: while ($TRUE) { $MySocket = new IO::Socket::INET( PeerAddr = $ServerName, PeerPort = $port, Proto= 'tcp'); if (!$MySocket) { print Failed to Connect to Server:
Re: need help(urgent)
try this, this should work __ #Pass the file name as a parameter sub printFile($){ my ($fname) = @_; #Load the spesified file my @lines = readFile($fname); chomp @lines; foreach my $line (@lines){ if ($line =~ m/include\s(\w+\.\w+)/i){ # check for the include line printFile($1); }else{ print $line\n; } } } sub readFile($){ my ($fname) = @_; open(FH, $fname) or die $!; my @fLines= FH; close(FH); return @fLines; } Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators - Original Message - From: Girish N [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 26, 2004 4:49 PM Subject: need help(urgent) Hi All I am stuck with this script which I need to finish today... What I am supposed to do is 1) parse a file and search for included files and insert those included files in the file. Eg. File1 Lkdfs Sdfdsfds Sdfsdf Include one.txt Sdfdsf Sdfsdf Werewr Tytry Where one.txt is A B C D E F The expected result is File2 Lkdfs Sdfdsfds Sdfsdf A B C D E F Sdfdsf Sdfsdf Werewr Tytry Please help me with this Thanks in advance Girish -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: need help(urgent)
can you post the exact format of your include line and what is the logic to map the base to actual values. in base/includefile.ext how do we get to know the value of base here is a general solution assumin that tha format of your include line is include base/filename.extenction all the nasses should be stored in a hash called %baseHash stored in a hash my $outStr = makeOutput(Source_File_Name); open(OUT, Output_File_Name); print OUT $outStr; close(OUT); sub makeOutput($){ my ($source) = @_; my $fText = file2Str($source); $fText =~ s/include\s(w+)\/(w+\.w+)/$baseHash{$1}\/makeOutput($2)/emg; return $fText; } sub file2Str($){ my ($fn) = @_; open(FH, $fn); my @fLines = FH; close(FH); return join('', @fLines); } Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators - Original Message - From: Girish N [EMAIL PROTECTED] To: 'LRMK' [EMAIL PROTECTED] Sent: Wednesday, May 26, 2004 6:10 PM Subject: RE: need help(urgent) Hey Thanks a lot for the help But I have one more problemsorry to bother u but this is kind of urgent... Include statement in my code looks like this include $(BASE_DIR)/make_include I need to get the value of the $(BASE_DIR) and then open the file base/make_include Can u plz tell me how to do that..i am bad at pattern matchingand I need to finish this today Plz reply back Thanks Regards Girish -Original Message- From: LRMK [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 26, 2004 5:11 PM To: Girish N Cc: [EMAIL PROTECTED] Subject: Re: need help(urgent) try this, this should work __ #Pass the file name as a parameter sub printFile($){ my ($fname) = @_; #Load the spesified file my @lines = readFile($fname); chomp @lines; foreach my $line (@lines){ if ($line =~ m/include\s(\w+\.\w+)/i){ # check for the include line printFile($1); }else{ print $line\n; } } } sub readFile($){ my ($fname) = @_; open(FH, $fname) or die $!; my @fLines= FH; close(FH); return @fLines; } Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators - Original Message - From: Girish N [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 26, 2004 4:49 PM Subject: need help(urgent) Hi All I am stuck with this script which I need to finish today... What I am supposed to do is 1) parse a file and search for included files and insert those included files in the file. Eg. File1 Lkdfs Sdfdsfds Sdfsdf Include one.txt Sdfdsf Sdfsdf Werewr Tytry Where one.txt is A B C D E F The expected result is File2 Lkdfs Sdfdsfds Sdfsdf A B C D E F Sdfdsf Sdfsdf Werewr Tytry Please help me with this Thanks in advance Girish -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Fw: need help(urgent)
can you post the exact format of your include line and what is the logic to map the base to actual values. in base/includefile.ext how do we get to know the value of base here is a general solution assumin that tha format of your include line is include base/filename.extenction all the nasses should be stored in a hash called %baseHash stored in a hash my $outStr = makeOutput(Source_File_Name); open(OUT, Output_File_Name); print OUT $outStr; close(OUT); sub makeOutput($){ my ($source) = @_; my $fText = file2Str($source); $fText =~ s/include\s(w+)\/(w+\.w+)/$baseHash{$1}\/makeOutput($2)/emg; return $fText; } sub file2Str($){ my ($fn) = @_; open(FH, $fn); my @fLines = FH; close(FH); return join('', @fLines); } Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators - Original Message - From: Girish N [EMAIL PROTECTED] To: 'LRMK' [EMAIL PROTECTED] Sent: Wednesday, May 26, 2004 6:10 PM Subject: RE: need help(urgent) Hey Thanks a lot for the help But I have one more problemsorry to bother u but this is kind of urgent... Include statement in my code looks like this include $(BASE_DIR)/make_include I need to get the value of the $(BASE_DIR) and then open the file base/make_include Can u plz tell me how to do that..i am bad at pattern matchingand I need to finish this today Plz reply back Thanks Regards Girish -Original Message- From: LRMK [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 26, 2004 5:11 PM To: Girish N Cc: [EMAIL PROTECTED] Subject: Re: need help(urgent) try this, this should work __ #Pass the file name as a parameter sub printFile($){ my ($fname) = @_; #Load the spesified file my @lines = readFile($fname); chomp @lines; foreach my $line (@lines){ if ($line =~ m/include\s(\w+\.\w+)/i){ # check for the include line printFile($1); }else{ print $line\n; } } } sub readFile($){ my ($fname) = @_; open(FH, $fname) or die $!; my @fLines= FH; close(FH); return @fLines; } Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators - Original Message - From: Girish N [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 26, 2004 4:49 PM Subject: need help(urgent) Hi All I am stuck with this script which I need to finish today... What I am supposed to do is 1) parse a file and search for included files and insert those included files in the file. Eg. File1 Lkdfs Sdfdsfds Sdfsdf Include one.txt Sdfdsf Sdfsdf Werewr Tytry Where one.txt is A B C D E F The expected result is File2 Lkdfs Sdfdsfds Sdfsdf A B C D E F Sdfdsf Sdfsdf Werewr Tytry Please help me with this Thanks in advance Girish -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
How to send Net Send messages from a Linux Server
I want to write a Perl script to send net send messages to the windows based computers but my scripts are running on Linux computer. So I can't use $results = `NET SEND $IP_ADDR blah blah blah blah `; how to do this on a linux computer I think that I will have to connect to the receivers port 135 and send the message manualy using perl sockets but I dont know the low level format of the message Can someone help me on this If there is a module to do this that will be great. Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
How to execute a Perl script in Linux??? (I havent seen linux)
I have never used a computer with linux so I need a very clear answer I have a script uploaded to /home/myusername/public_html/cgi-bin/rating/rank.pl in my web host I want it to execute once a week So I am gonna use Cron Jobs I can set the timing its very simple But I dont know what is the command to execute the above script. Somebody tell me what should I give to the cron jobs as the command ? Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Detecting the Country and other information of a IP address
I want one of my scripts to process IP addreses and detect the country and other information like city, ISP, and the IP range which has the same attributes I tryied writing a script to post the IP address to regional network information center's web site's who is form and then process the resulting web page but this only work for the IPs within that region. An also I think this is illegal What is the better and professional way of doing this? Is there a module for this. Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: A MySQL Question
Thanx this will work . My web host has PostgreSQL installed I can get a DB from there. By the way is PostgreSQL free and if yes where can I get a copy to practise myself. Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators - Original Message - From: Randal L. Schwartz [EMAIL PROTECTED] To: LRMK [EMAIL PROTECTED] Sent: Friday, May 21, 2004 9:24 PM Subject: Re: A MySQL Question If you have an actual database (not MySQL, but something modern like PostgreSQL or Oracle), you can solve this with a simple subselect and self join. Not the most efficient, but probably more efficient than a lot of roundtrips to the Perl side. For mytable which has rank and score where you want rank to reflect ranking where score is highest, use: UPDATE mytable SET rank = ( SELECT 1+count(*) FROM mytable AS b WHERE b.score mytable.score ); This has the cool feature that ties are automatically assigned the same value. For example: rank | score --+--- 6 |10 5 |20 3 |30 3 |30 2 |40 1 |50 -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: A MySQL Question
I dont like to remove the RANK field onless there is no other solution becouse this Rating system going to be used by a community of people to messure the performance of their web sites compaired to others the RANK must be there. I am thinking about calculating RANK once a more longer interval like once a 7 days. This method of updating will be bit faster if there is a way i can write this as a function in the DBMS Like a PL/SQL Function in Oracle is this possible in MySQL Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators - Original Message - From: Dani Pardo [EMAIL PROTECTED] To: LRMK [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, May 21, 2004 1:06 PM Subject: Re: A MySQL Question On Fri, 21 May 2004, LRMK wrote: Probably this is not relavent to this mailing list... But any way I ll ask.. I am developing a web site traffic rating system. using a combination og perl and java (PERL in serverside, Java Applets in cliend side - My attempt to create dynamic images was not that successfull so I use a java applet to view the rating info on the site) Here is my question The rating system is now working but every day I have to run a hevy SQL statement to recalculate the traffic ranks of web sites Something similer to this $DBC is the connection to the mysql database my $q = $DBC-prepare(SELECT domainname, (viewcount/(($now - startedTime)/86400)) AS views_per_day . FROM site WHERE startedTime($now - 48hours) . # I do not give ranks for the sites registered withing last 48 hours ORDER BY views_per_day DESC) my $rank = 0; $q-execute(); while (my $ref = $q-fetchrow_hashref()){ $rank++; my %hash = %{$ref}; $DBC-do(UPDATE site SET rank = $rank WHERE domainname= . $DBC-quote($hash{'domainname'})); } $q-finish(); $DBC-do(COMMIT); the problem is if there are 1500 qualified records in the table there going to 1501 queries (there going to be lots mor records than 1500 in the real system) Question 1 ) Is there a more efficiant way of doing this, atleast to reduce the number of queries? I guess you are updating filed RANK, so that the domain that has more visits per day gets value 1, the second gets value 2, etc.. Can you just omit this fileld? So you don't need to the script that recalculates :) I mean, can you forget about the rank filed and only work with (viewcount/(($now - startedTime)/86400)) (wiews per day)? --- Dani Pardo, [EMAIL PROTECTED] Enplater S.A -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
A MySQL Question
Probably this is not relavent to this mailing list... But any way I ll ask.. I am developing a web site traffic rating system. using a combination og perl and java (PERL in serverside, Java Applets in cliend side - My attempt to create dynamic images was not that successfull so I use a java applet to view the rating info on the site) Here is my question The rating system is now working but every day I have to run a hevy SQL statement to recalculate the traffic ranks of web sites Something similer to this $DBC is the connection to the mysql database my $q = $DBC-prepare(SELECT domainname, (viewcount/(($now - startedTime)/86400)) AS views_per_day . FROM site WHERE startedTime($now - 48hours) . # I do not give ranks for the sites registered withing last 48 hours ORDER BY views_per_day DESC) my $rank = 0; $q-execute(); while (my $ref = $q-fetchrow_hashref()){ $rank++; my %hash = %{$ref}; $DBC-do(UPDATE site SET rank = $rank WHERE domainname= . $DBC-quote($hash{'domainname'})); } $q-finish(); $DBC-do(COMMIT); the problem is if there are 1500 qualified records in the table there going to 1501 queries (there going to be lots mor records than 1500 in the real system) Question 1 ) Is there a more efficiant way of doing this, atleast to reduce the number of queries? I know if I use Oracle db i can make a PL/SQL procedure but my web host only give MySql Question 2 ) Can I make functions with mySQL if yes where can I find a tutorial? Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: @UNIQUE=unique(@REDUNDANT);
here is a function to remove the duplicated elements it treates the elements as strings you can use this for numaric values after changing 'eq' to '==' only problem of this code it significantly alter the order of the array sub unique(@){ my(@source) = @_; my @destination; @source = sort(@source); foreach (@source){ if (!($destination[$#destination] eq $_)){ $destination[++$#destination] = $_; } } return @destination; } Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators - Original Message - From: Jason Dusek [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 19, 2004 8:14 AM Subject: @UNIQUE=unique(@REDUNDANT); Hi, Is there an easy way to get all the unique elements of an array? i.e. is there some module or function that does that sort of thing? -- -- Jason Dusek (`-''-/).___..--''`-._ -- | `6_ 6 ) `-. ( ).`-.__.`) -- | (_Y_.)' ._ ) `._ `. ``-..-' -- | _..`--'_..-_/ /--'_.' ,' -- | (il),-'' (li),' ((!.-' -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Newbie: Perl reg. expression
this should work open FILE, test.txt or die Can't open file!: $!; while( FILE ) { my @parts = split(/\s+/); foreach (@parts){ print if /(\d+\.\d+\.\d+\.\d)/; } } close FILE; Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators - Original Message - From: Durai [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, May 18, 2004 11:54 AM Subject: Newbie: Perl reg. expression Hello All, open FILE, test.txt or die Can't open file!: $!; while( FILE ) { print if /(\d+\.\d+\.\d+\.\d)/; } close FILE; It gives the following output: # prevent Apache from glomming onto all bound IP addresses (0.0.0.0) #Listen 12.34.56.78:80 # e.g., www.apache.org (on) or 204.62.129.132 (off). I want only a word which contains IP address only not with port and others.. For example, Need like: 204.62.129.132 not (0.0.0.0),12.34.56.78:80,.. . Regs, durai. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.684 / Virus Database: 446 - Release Date: 5/14/2004 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Newbie: Perl reg. expression - Correction
My previous mail has a small problem this one should fix it open FILE, test.txt or die Can't open file!: $!; while( FILE ) { my @parts = parts(/\s+/); foreach (@parts){ if (/^(\d+\.\d+\.\d+\.\d+)$/){ print $1\n; } } } close FILE; Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators - Original Message - From: Durai [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, May 18, 2004 11:54 AM Subject: Newbie: Perl reg. expression Hello All, open FILE, test.txt or die Can't open file!: $!; while( FILE ) { print if /(\d+\.\d+\.\d+\.\d)/; } close FILE; It gives the following output: # prevent Apache from glomming onto all bound IP addresses (0.0.0.0) #Listen 12.34.56.78:80 # e.g., www.apache.org (on) or 204.62.129.132 (off). I want only a word which contains IP address only not with port and others.. For example, Need like: 204.62.129.132 not (0.0.0.0),12.34.56.78:80,.. . Regs, durai. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.684 / Virus Database: 446 - Release Date: 5/14/2004 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Fw: Newbie: Perl reg. expression - Correction
sorry about that typing mistake Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators - Original Message - From: Durai [EMAIL PROTECTED] To: LRMK [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, May 18, 2004 12:49 PM Subject: Re: Newbie: Perl reg. expression - Correction Hi, It works fine after I change the following line: my @parts = parts(/\s+/); to my @parts = split(/\s+/); Thanks for your help. Thanks, Durai. - Original Message - From: LRMK [EMAIL PROTECTED] To: Durai [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, May 18, 2004 12:00 PM Subject: Re: Newbie: Perl reg. expression - Correction My previous mail has a small problem this one should fix it open FILE, test.txt or die Can't open file!: $!; while( FILE ) { my @parts = parts(/\s+/); foreach (@parts){ if (/^(\d+\.\d+\.\d+\.\d+)$/){ print $1\n; } } } close FILE; Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators - Original Message - From: Durai [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, May 18, 2004 11:54 AM Subject: Newbie: Perl reg. expression Hello All, open FILE, test.txt or die Can't open file!: $!; while( FILE ) { print if /(\d+\.\d+\.\d+\.\d)/; } close FILE; It gives the following output: # prevent Apache from glomming onto all bound IP addresses (0.0.0.0) #Listen 12.34.56.78:80 # e.g., www.apache.org (on) or 204.62.129.132 (off). I want only a word which contains IP address only not with port and others.. For example, Need like: 204.62.129.132 not (0.0.0.0),12.34.56.78:80,.. . Regs, durai. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.684 / Virus Database: 446 - Release Date: 5/14/2004 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.684 / Virus Database: 446 - Release Date: 5/14/2004 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Image editing/Creating modules
Nope - It gave a error when I try to make it some sort of a fatel error. Thankx .. Any way I installed PERLMagick with ImageMagick so I am going to use it. Ithink there is a bug in ImageMagick when I try to load a image from a perl file handle Windows says that perl.exe performed an ilegal operation. But when I directly give the file name it worked. Rakhitha Karunarathne Web Master www.Ad-Man.tk - Free Unlimited Banner Rotators - Original Message - From: Ramprasad A Padmanabhan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, May 18, 2004 11:47 AM Subject: Re: Image editing/Creating modules use GD; Hope you are able to install on your machine Ram On Tue, 2004-05-18 at 10:37, [EMAIL PROTECTED] wrote: can someone give a name of any image (JPG or GIF) editing / creating module, which allow to create images to display on web pages on the fly by CGI scripts. Rakhitha M. Karunarathne Trainee Software Developer, IFS - R D International, 501,Galle Road ,Cololmbo-6, SRI LANKA. Tel +94 (011)-2-364-440 Ext 841 E-mail [EMAIL PROTECTED] www.ifsworld.com CONFIDENTIALITY AND DISCLAIMER NOTICE Please note that this message may contain confidential information. If you have received this message by mistake, please inform the sender of the mistake by e-mailing [EMAIL PROTECTED], then delete the message from your system without making, distributing or retaining any copies of it. Any views or opinions presented are solely those of the sender and do not necessarily represent those of IFS unless otherwise specifically stated. Although we believe that the message and any attachments are free from viruses and other errors that might affect the computer or IT system where it is received and read, the recipient opens the message at his or her own risk. We assume no responsibility for any loss or damage arising from the receip. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Can somebody send me RFC numbers of POP3 SMTP
can somebody send me RFC numbers of POP3 SMTP -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Can somebody send me RFC numbers of POP3 SMTP
can somebody send me RFC numbers of POP3 SMTP -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Retriving a file using cgi posted from a html form
how do I retrieve save files that has been posted from a Html form to my cgi script. please send a piece of example code
Re: Question about creating a hash of key-value pairs based on sub parameters.
sub BlaBla(){ my @inp=@_ while ($#inp 0){ my $key = shift; my $value = shift; $myHash{$key} = $value; } } Sign L Rakhitha Malinda Karunarathne Web :- rakhitha.cjb.net Email :[EMAIL PROTECTED] Rakhitha Malinda Karunarathne. - Original Message - From: Ben Siders [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 14, 2003 10:57 PM Subject: Question about creating a hash of key-value pairs based on sub parameters. I have a subroutine that will receive parameters as follows: key1, value1, key2, value2, key3, value3, ... keyN, valueN I want to create a hash of key1 = value1, key2 = value2, ... , keyN = valueN in the subroutine. I'm curious if there's a Perl trick to doing this beyond the obvious looping solution. For example: while ( some condition ) { my $key = shift; my $value = shift; $myHash{$key} = $value; } What's my exit condition? -- 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: funny characters in form field
use the following sub to read post input I got this from a book if you only want the regxp its in this code ex:- %postdata= readPostInout(Max Total Size of Data in Bytes); # this will return form data as Field=Value pares to the %postdata hash # if the Total size of data is grater than Given Max Total Size of Data in Bytes the function will abrt the retreve # if you dont want to limit size use %postdata= readPostInout(0); #There are built in functions in CGI module too you cam try to use them insted of this #___ ___ # Add this sub to your code sub readPostInput($){ #* Reading Post Input my ($maxlength)=@_; my(%searchField, $buffer, $pair, @pairs); if (($ENV{'REQUEST_METHOD'} eq 'POST')(($maxlength=$ENV{'CONTENT_LENGTH'}||($maxlength==0{ read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(//, $buffer); $pairc = -1; while($pairc $#pairs){ $pairc++; $pair = $pairs[$pairc]; ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(C, hex($1))/eg; $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(C, hex($1))/eg; $searchField{$name} = $value; } } return (%searchField); } #___ ___ Sign L Rakhitha Malinda Karunarathne Web :- rakhitha.cjb.net Email :[EMAIL PROTECTED] Rakhitha Malinda Karunarathne. - Original Message - From: Colin Johnstone [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, January 12, 2003 7:58 AM Subject: funny characters in form field Gidday all, In my mailing list form I have a hidden field that stores the date the subscriber subscribed. When processing the form the date in this format 3/1/2003 is converted to 3%2F1%2F2003. Can someone give me a regex to convert it back again please. Im only new to perl and am struggling with regex's thanking you in anticipation Colin -- 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: Selecting a Static HTML page
Use this code this is better than previouse one it does not change action this one directly change Window location Here is code -- html head titleNew Page 1/title /head script language=JavaScript !-- function doit(){ urls=new Array(); urls[0]=http://www.yahoo.com;; urls[1]=http://www.hotmail.com;; urls[2]=http://www.perl.org;; var nChosen = document.FormName1.SelectName.selectedIndex; window.location.href=urls[nChosen]; return(false); } //-- /SCRIPT body Try this codepnbsp;/p form name=FormName1 onsubmit=return doit() pselect size=1 name=SelectName option selectedwww.yahoo.com/option optionwww.hotmail.com/option optionwww.perl.org/option /selectinput type=submit value=Submit name=B1input type=reset value=Reset name=B2/p /form /body /html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Selecting a Static HTML page
Sign L Rakhitha Malinda Karunarathne Web :- rakhitha.cjb.net Email :[EMAIL PROTECTED] Rakhitha Malinda Karunarathne. - Original Message - From: LRMK [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 12:48 AM Subject: Re: Selecting a Static HTML page Variabalizing the action will get the job done but best will be using a cgi to do it because you can process some other input data with cgi if u r not using cgi then u can only forward to another static page Sign L Rakhitha Malinda Karunarathne Web :- rakhitha.cjb.net Email :[EMAIL PROTECTED] Rakhitha Malinda Karunarathne. - Original Message - From: drieux [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: cgi cgi-list [EMAIL PROTECTED] Sent: Monday, January 06, 2003 10:41 PM Subject: Re: Selecting a Static HTML page On Monday, Jan 6, 2003, at 08:41 US/Pacific, Hagen Finley wrote: [..] After hours of groping around I did find a syntax that kind of works - FORM ACTION=array1.html METHOD=GET I figure if I variablize the file name then the select tag could input the file name I need into this FORM ACTION statement. Is that the way to do this or is there a preferrable method? [..] actually that 'action' element will need to be the name of the cgi code that will know what to do with the selection form action=SelectHost.cgi method=POST target=_top select name=sysname size=1 option value=linux1linux1/option option value=sun1sun1/option /select /form that will return sysname=linux1 if the user does not scroll through the menu... Remember that 'raw html files' - foo.html - do not parse the query strings handed to them in the 'GET|POST' methods... ciao drieux --- -- 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: how to print mysql table to text file backup with perl
where do you want to save your file on your PC or on the server Sign L Rakhitha Malinda Karunarathne Web :- rakhitha.cjb.net Email :[EMAIL PROTECTED] Rakhitha Malinda Karunarathne. - Original Message - From: Hughes, Andrew [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 12:58 AM Subject: how to print mysql table to text file backup with perl I have a mysql table with about 3000 rows of data on which that I need to perform a daily backup. Because I am on a shared hosting account I do not have administrative rights to the database. To back it up currently I have a script that prints each line of data to the browser delimited with pipes using this code: $stmt = qq { select * from 2002brochurecontest }; $sth = $dbh-prepare ($stmt); $sth-execute (); $count = 0; while (my $row = $sth-fetchrow_hashref()) { print $row-{id}|$row-{t}|$row-{f_name}|$row-{l_name}|$row-{w_phone}|$row-{w _phone_ext}|$row-{division}|$row-{email}|$row -{eclub}|$row-{country}|$row-{brochure}|$row-{purchase}, br(); } $sth-finish(); I take the output and print it to my browser. Then I cut and paste it into a text file. To avoid this extra step and to learn something new, I would like to print the data to a text file. Each day I would just overwrite the same text file with the data, so I would not have to create a new file every time the script runs. Can anyone point me in the right direction? Thanks, Andrew -- 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: HTML in perl autoresponders
yes adding 'Content-Type: text/html' header must get the job done - Original Message - From: Damian Wader [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 1:26 AM Subject: HTML in perl autoresponders I created an autoresponder with perl. Click Here to view the code. However I would like body of the message to reflect HTML code which I cannot get it to do. My server does not work with the mime::lite module so I already know about that but is there any other way? A. Damian Wader www.endlessfollowup.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Autoresoponders with Perl
Adding that Content-Type: text/html line after the print MAIL Subject: Your catalog request.\n\n; line must work - Original Message - From: Damian Wader [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 1:35 AM Subject: Autoresoponders with Perl somehow the link did not work so here is the URL for the code of my previous message: I created an autoresponder with perl. Here is the code: http://www.farinfrared.com/efuwelcome.cgi.txt However I would like body of the message to reflect HTML code which I cannot get it to do. My server does not work with the mime::lite module so I already know about that but is there any other way? A. Damian Wader www.endlessfollowup.com -- 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: Selecting a Static HTML page
Sign L Rakhitha Malinda Karunarathne Web :- rakhitha.cjb.net Email :[EMAIL PROTECTED] Rakhitha Malinda Karunarathne. - Original Message - From: drieux [EMAIL PROTECTED] To: LRMK [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 2:05 AM Subject: Re: Selecting a Static HTML page On Monday, Jan 6, 2003, at 10:50 US/Pacific, LRMK wrote: [..] Variabalizing the action will get the job done but best will be using a cgi to do it because you can process some other input data with cgi if u r not using cgi then u can only forward to another static page [..] could you provide an illustration of this? I presume you mean to use some javascripting??? ciao drieux --- My code is ass follows html head titleNew Page 1/title /head script language=JavaScript !-- function doit(){ urls=new Array(); urls[0]=http://www.yahoo.com;; urls[1]=http://www.hotmail.com;; urls[2]=http://www.perl.org;; var nChosen = document.FormName.SelectName.selectedIndex; document.FormName.action=urls[nChosen]; return(true); } //-- /SCRIPT body Try this codepnbsp;/p form name=FormName onsubmit=doit() pselect size=1 name=SelectName option selectedwww.yahoo.com/option optionwww.hotmail.com/option optionwww.perl.org/option /selectinput type=submit value=Submit name=B1input type=reset value=Reset name=B2/p /form /body /html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HTML in perl autoresponders
It works U just have to use html formating tags when u send text massage to the MAIL program after adding thet content type like this print MAIL PrintTag; p align=leftbDear $in{'custname'}:/bp palign=left Welcome to a href=http://www.EndLessFollowUp.comEndLessFollowUp.com!/a In the next comingbr days you will be exposed to such new and innovative ways to br build your online or traditional business, you will be bonkingbr yourself in the head. However what is really going to astonishbr you is how fundamental, easy to impliment and innexpensive br they are to utilize. /p palign=left If you are a self starter you will need nothing more then thisbr bFREE REPORT/b to get you sarted but if you want more youbr can always schedule your 1hour bFREE CONSULTATION!/b/p palign=leftGood Luck and don't hesitate to email me with any questions!/p palign=lefta href=http://www.endlessfollowup.comwww.endlessfollowup.com/a Damian Wader/p PrintTag - try replacing your massage with above - Original Message - From: Damian Wader [EMAIL PROTECTED] To: LRMK [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 2:41 AM Subject: Re: HTML in perl autoresponders Unfortunately that is not getting the job done and I don't know why. A. Damian Wader www.endlessfollowup.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Fw: Selecting a Static HTML page
Use this codethis is better than previouse one it does not change actionthis one directly change Window locationHere is code--htmlheadtitleNew Page 1/title/headscript language="_javascript_"!--function doit(){urls=new Array();urls[0]="http://www.yahoo.com";urls[1]="http://www.hotmail.com";urls[2]="http://www.perl.org";var nChosen = document.FormName1.SelectName.selectedIndex;window.location.href="">return(false);}//--/SCRIPTbodyTry this codepnbsp;/pform name="FormName1" onsubmit="return doit()" pselect size="1" name="SelectName" option selectedwww.yahoo.com/option optionwww.hotmail.com/option optionwww.perl.org/option /selectinput type="submit" value="Submit" name="B1"input type="reset"value="Reset" name="B2"/p/form/body/html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Selecting a Static HTML page
Variabalizing the action will get the job done but best will be using a cgi to do it because you can process some other input data with cgi if u r not using cgi then u can only forward to another static page Sign L Rakhitha Malinda Karunarathne Web :- rakhitha.cjb.net Email :[EMAIL PROTECTED] Rakhitha Malinda Karunarathne. - Original Message - From: drieux [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: cgi cgi-list [EMAIL PROTECTED] Sent: Monday, January 06, 2003 10:41 PM Subject: Re: Selecting a Static HTML page On Monday, Jan 6, 2003, at 08:41 US/Pacific, Hagen Finley wrote: [..] After hours of groping around I did find a syntax that kind of works - FORM ACTION=array1.html METHOD=GET I figure if I variablize the file name then the select tag could input the file name I need into this FORM ACTION statement. Is that the way to do this or is there a preferrable method? [..] actually that 'action' element will need to be the name of the cgi code that will know what to do with the selection form action=SelectHost.cgi method=POST target=_top select name=sysname size=1 option value=linux1linux1/option option value=sun1sun1/option /select /form that will return sysname=linux1 if the user does not scroll through the menu... Remember that 'raw html files' - foo.html - do not parse the query strings handed to them in the 'GET|POST' methods... ciao drieux --- -- 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: Sent time in a Net::SMTP mail
why don't u try MIME::Lite to create mail massage and send it using Net::SMTP or anything it has ready mate attachment adding facility and it adds date and time automatically. Sign L Rakhitha Malinda Karunarathne Web :- rakhitha.cjb.net Email :[EMAIL PROTECTED] Rakhitha Malinda Karunarathne. - Original Message - From: John W. Krahn [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 06, 2003 9:19 AM Subject: Re: Sent time in a Net::SMTP mail Jenda Krynicky wrote: From: John W. Krahn [EMAIL PROTECTED] Or, you could do it the correct way. :-) use POSIX 'strftime'; my $date = strftime '%a, %d %b %Y %H:%M:%S %z', localtime; $smtp-datasend( Date: $date\n ); I'm not sure this is the correct way. This prints Sun, 05 Jan 2003 18:42:54 Central Europe Standard Time on my computer (Win2k, ActivePerl 5.5.1 build 631 as well as ActivePerl 5.8.0 build 804). Which is NOT understood properly by my mailer (Pegasus Mail 4.02a). On my system the manpage for strftime says: man 3 strftime [snip] %z The time-zone as hour offset from GMT. Required to emit RFC822-conformant dates (using %a, %d %b %Y %H:%M:%S %z). (GNU) As I don't have a Windows system to test this on I'm not sure why this is happening. However the POSIX manpage states: man 3pm POSIX [snip] If you want your code to be portable, your format (`fmt') argument should use only the conversion specifiers defined by the ANSI C standard. These are `aAbBcdHIjmMpSUwWxXyYZ%'. So it looks like the %z format is not portable. If it doesn't work on your machine you can calculate it like this: $ perl -MPOSIX -MTime::Local -e' $local = time; $gm = timelocal( gmtime $local ); $sign = qw( + + - )[ $local = $gm ]; $calc = sprintf %s%02d%02d, $sign, (gmtime abs( $local - $gm ))[2,1]; print Calculated: $calc\n, strftime( strftime: %z\n, localtime ); ' Calculated: -0800 strftime: -0800 John -- use Perl; program fulfillment -- 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]
How to extract a atachment from a email
How to extract a atcahment from a email to save in harddrive Im using Net::POP3
How to add atachments in NET::SMTP
How to add atachments in NET::SMTP
Extracting an Atachment From a Email
Sign L Rakhitha Malinda Karunarathne Web :- rakhitha.cjb.net Email :[EMAIL PROTECTED] Rakhitha Malinda Karunarathne. I'm Using NET:POP3 to download mail from pop server which is in the same computer with my cgi 1. All the Attachments are comes as a Bulk of text How do I convert it into real binary file? Is Is there a Special Module for that purpose 2. How do I attach a file to email by converting it into a bulk of text? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Posting A file from a form
If a visitor posting a file using a file upload box how do I retrieve that from the cgi please give a simple example code
Extracting an Atachment From a Email
I'm Using NET:POP3 to download mail from pop server which is in the same computer with my cgi 1. All the Attachments are comes as a Bulk of text How do I convert it into real binary file? Is Is there a Special Module for that purpose or should I use MIME:BASE64 manually 2. How do I attach a file to email by converting it into a bulk of text?
Name a Free PERL Campiler for Win2k
Is there any Free Perl Compilers for Win2k
Re: Name a Free PERL Campiler for Win2k
Yes I Mean to Creat Binary .EXEs not the PERL interpreter - Original Message - From: K Clark [EMAIL PROTECTED] To: LRMK [EMAIL PROTECTED] Sent: Thursday, January 02, 2003 12:03 AM Subject: Re: Name a Free PERL Campiler for Win2k On Thu, Jan 02, 2003 at 12:02:25AM +0600, LRMK wrote: Is there any Free Perl Compilers for Win2k yeah, its called PERL. what do you mean by compiler? are you trying to create a windows binary file (.exe?)? check out the activestate project at activestate.com -- [llamakc.org schlitz.org klark.org] k e n a t l l a m a k c d o t o r g (o_ (o_ (o_ //\ (/)_ (/)_ V_/_ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Name a Free PERL Campiler for Win2k
Yes I Mean to Creat Binary .EXEs not the PERL interpreter - Original Message - From: K Clark [EMAIL PROTECTED] To: LRMK [EMAIL PROTECTED] Sent: Thursday, January 02, 2003 12:03 AM Subject: Re: Name a Free PERL Campiler for Win2k On Thu, Jan 02, 2003 at 12:02:25AM +0600, LRMK wrote: Is there any Free Perl Compilers for Win2k yeah, its called PERL. what do you mean by compiler? are you trying to create a windows binary file (.exe?)? check out the activestate project at activestate.com -- [llamakc.org schlitz.org klark.org] k e n a t l l a m a k c d o t o r g (o_ (o_ (o_ //\ (/)_ (/)_ V_/_ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file into memory
load the file in to the array @lines then run following chomp(@lines); # removes all the new lines foreach $line (@lines){ #process $line } - Original Message - From: Schwedler Kofoed [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, December 24, 2002 5:04 AM Subject: file into memory Hi all, I would like to open a file with the content: peter 141444 oscar e324345 simon j85547 in a perl script - but instead of reading the file one line at a time I would like to suck the whole file into memory and processing each line from there. I have tried to: open FILE, tmp.txt; @xx = FILE; while $file(@xx){ } but I cant get it to work - where did I go wrong ? Thanks! /Jakob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need to change file columns
# this must get the job done open (FH,'filename'); @recs=FH; close(FH); chomp @recs; $c=-1; while ($c$#recs){ $c++; @parts = split(/\s+/,$recs[$c]); $recs[$c] = $parts[1] $parts[0]; } open (FH,'filename'); select(FH); foreach $line (@recs){ print $line\n; } close(FH); - Original Message - From: Ashutosh Jog [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, December 21, 2002 1:32 PM Subject: Need to change file columns Folks, I am wokring on a script which at one point works on a txt file. The file's format is as under: 40abc 35def 28ghi 17jkl 08mno What I want to do is take the column on the right and shift it entirely to the left and take the column on the left and move it to the right. So the file should ultimatly look like: abc40 def 35 ghi 28 jkl 17 mno 08 Any ideas how I can do so in perl? Any help is welcome. Thanks in Advance. -Cheers. -- 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]
HTTP Requests
Is there a module to send HTTP requests to any web server and retrieve the web pages like a browser
Fw: HTTP Requests
What I want is when a visitor came and post something to my cgi script that script must post some of that information to another cgi script on another web server get the results and send back to the visitor how do I do that? - Original Message - From: Wiggins d'Anconia [EMAIL PROTECTED] To: LRMK [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, December 21, 2002 7:06 PM Subject: Re: HTTP Requests Yes. In particular you want to look at LWP. http://search.cpan.org/author/GAAS/libwww-perl-5.66/lib/LWP.pm In general have a look at this category: http://search.cpan.org/modlist/World_Wide_Web http://danconia.org LRMK wrote: Is there a module to send HTTP requests to any web server and retrieve the web pages like a browser -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
HTTP Requests
What I want is when a visitor came and post something to my cgi script that script must post some of that information to another cgi script on another web server get the results and send back to the visitor how do I do that? - Original Message - From: Wiggins d'Anconia [EMAIL PROTECTED] To: LRMK [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, December 21, 2002 7:06 PM Subject: Re: HTTP Requests Yes. In particular you want to look at LWP. http://search.cpan.org/author/GAAS/libwww-perl-5.66/lib/LWP.pm In general have a look at this category: http://search.cpan.org/modlist/World_Wide_Web http://danconia.org LRMK wrote: Is there a module to send HTTP requests to any web server and retrieve the web pages like a browser -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Editors
Im using Open Perl IDE its easy to run and debug perl scripts using it i got it from www.sourceforge.net - Original Message - From: Paul Kraus [EMAIL PROTECTED] To: 'Perl' [EMAIL PROTECTED] Sent: Wednesday, December 18, 2002 2:05 AM Subject: Editors What editors do you guys use when coding Perl? I have been using emacs on both windows and Linux but that is because I hate vi and notepad. Paul Kraus Network Administrator PEL Supply Company 216.267.5775 Voice 216-267-6176 Fax www.pelsupply.com -- 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: cgi session
dont usehtml file for http://www.mydomain.com/welcome.html use a cgi like http://www.mydomain.com/welcome.pl when u passing user to the page don't just redirect load that page using automated form submit so you can pass the password and username to that page too and validate there if it is wrong redirect back to the login page i hope somebody has a better idear becouse this needs lots of programming I used this method once u have to do this in all the pages so its too complex - Original Message - From: Admin-Stress [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 06, 2002 12:39 AM Subject: cgi session Hi, How can I check cgi session? mmm .. maybe better I explain like this: I just want to make a 'secure site' that need username and password. So, the first page of my site would be fill in you username and password, for example, it will be placed here : http://www.mydomain.com/login.html After that, I will call /cgi-bin/checkpasswd.pl, if OK then user will be transfered to another page, e.g.: http://www.mydomain.com/welcome.html My question, how can I make sure that ONLY ppl passed checkpasswd.pl can see that welcome.html (and the rest of page). It should be about checking 'session' or some other trick ... Anyone can give me pointer/clues how to do this? .. in a simplest way .. Thanks, kapot __ 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] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cgi session
dont usehtml file for http://www.mydomain.com/welcome.html use a cgi like http://www.mydomain.com/welcome.pl when u passing user to the page don't just redirect load that page using automated form submit so you can pass the password and username to that page too and validate there if it is wrong redirect back to the login page i hope somebody has a better idear becouse this needs lots of programming I used this method once u have to do this in all the pages so its too complex - Original Message - From: Admin-Stress [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 06, 2002 12:39 AM Subject: cgi session Hi, How can I check cgi session? mmm .. maybe better I explain like this: I just want to make a 'secure site' that need username and password. So, the first page of my site would be fill in you username and password, for example, it will be placed here : http://www.mydomain.com/login.html After that, I will call /cgi-bin/checkpasswd.pl, if OK then user will be transfered to another page, e.g.: http://www.mydomain.com/welcome.html My question, how can I make sure that ONLY ppl passed checkpasswd.pl can see that welcome.html (and the rest of page). It should be about checking 'session' or some other trick ... Anyone can give me pointer/clues how to do this? .. in a simplest way .. Thanks, kapot __ 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] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Difference between $count++ and ++$count
++$count will increment $count before it is used $count++ will increment $count after it is used - Original Message - From: Yacketta, Ronald [EMAIL PROTECTED] To: 'Mystik Gotan' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, December 06, 2002 11:02 PM Subject: RE: Difference between $count++ and ++$count Yes If I recall correctly: ++$count will increment $count after it is used $count++ will increment $count before it is used -Ron -Original Message- From: Mystik Gotan [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:54 To: [EMAIL PROTECTED] Subject: Difference between $count++ and ++$count Hiya, is there any difference between $count++ and ++$count? Just wondering. Thanks. _ Ontvang je Hotmail Messenger berichten op je mobiele telefoon met Hotmail SMS http://www.msn.nl/jumppage/ -- 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] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Auto refresh
I'm not using CGI module for writing cgis so i have to print html headers manualy what should i print to make the html page refresh evary 10
Re: Auto refresh
thanks actually when i was learning from a book(Mastering perl 5 by Eric Herman) that book doesn't say anything about cgi module. so i got to reinvent the weal again - Original Message - From: Gary Stainburn [EMAIL PROTECTED] To: LRMK [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, December 05, 2002 10:32 PM Subject: Re: Auto refresh On Thursday 05 Dec 2002 4:29 pm, LRMK wrote: I'm not using CGI module for writing cgis so i have to print html headers manualy what should i print to make the html page refresh evary 10 Hi LRMK, (Love the name) Firstly, why not use CGI? Re-inventing the wheel may be great fun but I wouldn't want to do it. Anyway, I put the following: META http-equiv=refresh content=5,http://ollie.ringways.co.uk/~cms/cmsstatus.html; inside the head/head block of the HTML I generate. -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 -- 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: Auto refresh
thanks actually when i was learning from a book(Mastering perl 5 by Eric Herman) that book doesn't say anything about cgi module. so i got to reinvent the weal again - Original Message - From: Gary Stainburn [EMAIL PROTECTED] To: LRMK [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, December 05, 2002 10:32 PM Subject: Re: Auto refresh On Thursday 05 Dec 2002 4:29 pm, LRMK wrote: I'm not using CGI module for writing cgis so i have to print html headers manualy what should i print to make the html page refresh evary 10 Hi LRMK, (Love the name) Firstly, why not use CGI? Re-inventing the wheel may be great fun but I wouldn't want to do it. Anyway, I put the following: META http-equiv=refresh content=5,http://ollie.ringways.co.uk/~cms/cmsstatus.html; inside the head/head block of the HTML I generate. -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using a Printer with perl
Is there a way to print something using a printer in windows 2000 with perl
Re: Writing a HTTP server with PERL
Thanks it solved my problem I read a HTTP request from my browser (IE 6) using a small program which listens to port 80 i got this GET /perl/lib/Pod/perlfunc.html HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* Accept-Language: en-us Accept-Encoding: gzip, deflate If-Modified-Since: Mon, 02 Dec 2002 15:45:13 GMT; length=326978 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) Host: www.lrmk.dynu.com Connection: Keep-Alive I like to know what exactly each of these lines means - Original Message - From: Rob Dixon [EMAIL PROTECTED] To: Weijie Ding [EMAIL PROTECTED]; LRMK [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, December 03, 2002 4:06 PM Subject: Re: Writing a HTTP server with PERL Hi Weijie. See in-line. - Original Message - From: Weijie Ding [EMAIL PROTECTED] To: LRMK [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, December 03, 2002 2:54 AM Subject: Re: Writing a HTTP server with PERL Hi, LRMK, 2002-12-03 10:52:27 I think it is not your fault. Maybe you used a browser which can't support virtual domains, like lynx. The browser should send GET http://domain.com/filename HTTP/1.x All requests must include a Host header, even if the information is already provided in the request line. The full absolute URI is normally provided only if the request is to a proxy server. (Although all servers are supposed to support it so that future HTTP standards can require it.) GET http://domain.com/filename HTTP/1.x Host: domain.com or GET /filename HTTP/1.1 domain: www.domain.com I think. Yes, but it's Host: domain.com Cheers, Rob
Writeing a HTTP server with perl
I wrote a http server in perl to handle GET request from browser but browsers only send GET folder\filename HTTP X.Y request to the server how do i find which domain name that the user typed in the Address field. to implement hosts. actually i just want to know how to do it my server will not be a fully qualified one it just reads GET request and send some thing to the client depending on the request but from GET i only see folder path of the requested url how do i find the domain name or absolute url that user want
Writing a HTTP server with PERL
I wrote a http server in perl to handle GET request from browser but browsers only send GET folder\filename HTTP X.Y request to the server how do i find which domain name that the user typed in the Address field. to implement hosts. actually i just want to know how to do it my server will not be a fully qualified one it just reads GET request and send some thing to the client depending on the request but from GET i only see folder path of the requested url how do i find the domain name or absolute url that user want Im Using IO::Socket::INET
Re: how do i make a script run for a certain period of time?
$check=1; while($check){ check the time; set $check to 0 when the time is right to exit } but this will make your program little slow because it check time in each round send if others have better ideas - Original Message - From: david [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, December 01, 2002 9:59 AM Subject: RE: how do i make a script run for a certain period of time? Nyimi Jose wrote: I'm writing a script that has to be automatically executed every day at 6:00 AM via 'dollar universe' scheduler software. I want my script to stop itself at 23:00 PM (I think to timeout via alarm function). The script is mainly a while(1) loop and I want my loop to sleep few seconds before going to the next iteration. How can handle this without mixing alarm and sleep ? you have a few options: 1. just mix alarm and sleep. Not all sleep functions are implemented using alarm. If yours doesn't, you won't have to worry about it. 2. use the 4 argument version of the select() function with the first three arguments being undef so you can delay any time you want. you can even get finer granularity than a second if your system supports it. 3. Implement your own sleep function. Not really recommanded but I have seen people doing things like: #!/usr/bin/perl -w use strict; while(1){ delay(3); #-- task } sub delay{ my $time = $_[0] * 99; for(my $i = 0; $i $time; $i++){} } __END__ which is NOTHING close to the sleep function and it's wasting your system's CPU resource. it merely slows down the program in a bad way! 4. check perldoc if you haven't do so. I am sure there are other methods that works better since this is a fairly command task. There might even be a module in CPAN that deals with that. 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]
How to get Page Has Expired message
I want to make visitors see page has expired when they click the back button of browser how do I do it?
Re: how did they do it?
May be this example will help you try running the indx file in a web server within a cgi activate directory this vwry simpal but d - Original Message - From: Mariusz [EMAIL PROTECTED] To: perl [EMAIL PROTECTED] Sent: Tuesday, November 12, 2002 10:47 AM Subject: how did they do it? Could someone go to this page ( http://web.dailycamera.com/class/GENERAL/employment.html , then click on Search Classifieds and tell me how do they accomplish the following: They give an option to save ads for later display on one page. I looked up the source code and noticed that all their checkboxes have the same name (printad) and the values grow from zero up. That's easy, but how do you later capture which ad to display? When I tried to param the values from several checkboxes named the same but with different values (0,1,2,...) I just got zero from print $checkbox; can someone help? Thanks, Mariusz a.pl Description: Perl program -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how did they do it?
May be this example will helprun index.htm in a cgi anabled directory in a web server- Original Message -From: "Mariusz" [EMAIL PROTECTED]To: "perl" [EMAIL PROTECTED]Sent: Tuesday, November 12, 2002 10:47 AMSubject: how did they do it?Could someone go to this page (http://web.dailycamera.com/class/GENERAL/employment.html, then click on "Search Classifieds" and tell me how do they accomplish thefollowing:They give an option to save ads for later display on one page. I looked upthe source code and noticed that all their checkboxes have the same name(printad) and the values grow from zero up. That's easy, but how do youlater capture which ad to display? When I tried to "param" the values fromseveral checkboxes named the same but with different values (0,1,2,...) Ijust got zero from "print $checkbox;"can someone help?Thanks,Mariusz a.pl Description: Perl program -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Query String processing
Use a html form to post name and value to the manage file instead of query string - Original Message - From: Johnstone, Colin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 06, 2002 3:54 AM Subject: Query String processing Hi all, I am writing an administration interface to my mailing list. Upon opening the program it displays the email addresses of all the subscribers along with a delete link next to each name. The subscribers are written to a hash. When you click delete link the name/value pair is passed back to the program. e.g cgi-bin/managelist.pl?[EMAIL PROTECTED] I strip out the name value pair and search the hash for the email address, if it exists I delete it. This all works fine. It is at this point that I'd like to refresh the page and remove any query string from URL how do I do this. Is this possible ? Colin Johnstone Website Project Officer -- 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: Hash Sorting?
hashes are do not need to be sorted becouse they are key/value paires if u need to get the values of the ascending order of keys first load the keys to a array using following @keylist = keys %hash; #then sort the key list @keylist = sort @keylist; #now you have keys in ascending order so u can access values in that order eg:- #first 1 is $hash{$keylist[0]} #2 nd $hash{$keylist[1]} #n th one $hash{$keylist} - Original Message - From: Kurtis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 07, 2002 5:00 AM Subject: Hash Sorting? Hello all.. Does anyone know how to sort a hash in ascending order on the value? If possible, a little example! Thanks, Kurtis -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: env
%ENV hash contains all the environment vars run this pice of code foreach $key (sort keys %ENV){ print $key = $ENV{$key}\n; } - Original Message - From: Chris Knipe [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 06, 2002 1:12 AM Subject: env Lo everyone, How do I read environment variables with perl? -- me -- 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: Understanding list creation...
@_ holds the values of parameters passed to the sub when it is called from the code when it is used like that in subs It has different meanings in different places it is called default input variable - Original Message - From: David Buddrige [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 2:53 PM Subject: Understanding list creation... Hi all, I am reading through a collegue's perl script. In it he has the following lines: sub SomeSubName { my ($vara, $varb, $varc, @items) = @_; my ($itemtype, %symbol); ... } The first line I understand; here you are getting the parameters to the subroutine (which are stored in @_), and putting them into particular variable names - $vara, $varb, and so on. The second line however, I am not clear what it is doing. It seems to be creating an in-line list, but firstly, that list is not assigned to anything, and secondly he is storing a hash into the list (presumably it must be a reference to a hash, since you cannot actually store a hash into a data structure such as a list or an array without using refernces... Could anyone see what possible value could be had in creating the list: my ($itemtype, %symbol); Is this assigned to some default name? thanks heaps David Buddrige. -- 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: Mail::Sendmail Module
there is a one problem $mail{message}=FIN; only reads the first line of the file in the following block; $oldsep=$/; $/=undef; disable line seperation open(FIN,myfile)||die cannot open file: $!\n; $mail{message}=FIN; close(FIN); $/=$oldsep; try this instedof that line @file = FIN; chomp @file; $mail{message}=join(\n,@file); - Original Message - From: Gary Stainburn [EMAIL PROTECTED] To: Scott, Joshua [EMAIL PROTECTED]; Beginners Perl [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 11:15 PM Subject: Re: Mail::Sendmail Module On Tuesday 05 Nov 2002 5:01 pm, Scott, Joshua wrote: Hello everyone, I'm trying to use the Mail::Sendmail module in a script where I need a independent mailer. The problem I'm having is including more than one line of text in the message body. I'm not really sure how to do this. The package uses a $mail{message} = blah var for the message body. Is it possible to get more than one line into that hash value? Basically I've got a script that generates a bunch of information and outputs it to a file. What I would like to do is make the contents of this file, the body of my message. I don't want it as an attachment. Any help is greatly appreciated. Hi Joshua, If you simply wanted to create a multi-line message body as a string then you could do something like: $mail{message}=line1\nline2\nline3\n; or $mail{message}=qq{line1 line2 line3 }; If you want to use the contents of a file as the body, use something like. $oldsep=$/; $/=undef; disable line seperation open(FIN,myfile)||die cannot open file: $!\n; $mail{message}=FIN; close(FIN); $/=$oldsep; It disables the record seperator (newline) then reads the whole file into the hash entry. Thank you, Joshua Scott Security Systems Analyst, CISSP 626-568-7024 === === NOTICE - This communication may contain confidential and privileged information that is for the sole use of the intended recipient. Any viewing, copying or distribution of, or reliance on this message by unintended recipients is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. === === -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 -- 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]
Help on -w
#!/usr/bin/perl -w my $a; if ($a eq 'fff'){ } above line gives the error Use of uninitialized value in string eq at t.pl line 6. but when -w not used in top line it works perfect what the -w really does
Re: Files at different location
use this open (FILE _HANDDLE,'c:\abc\abc.abc'); - Original Message - From: Ankit Gupta [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 06, 2002 5:07 AM Subject: Files at different location Hi, I have written script that makes lot of files but the problem is that my script stores all the files at the location from where the script is run. I have tried usingt chdir(c:\abc) in order to store all the files in abc directory but its of no use and still it stores files in the directory from where the script is run. Could someone throw some light as how I can use some statement before making files so that all of them are stored in one directory of my choice. Regards, Ankit -- 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: A very, very simple question
u are trying to creat amulti dimentional array i guss but perl does not have multi dymenctional arrays u will have to use referances (read perldoc perlref) here is an simpal exampal my @table; for ($c=1;$c11;$c++){ my @ta; $table[++$#table] = \@ta; #*** type perldoc prelref in your commant line for more help on this } for ($c1=1;$c111;$c1++){ for ($c2=1;$c211;$c2++){ $table[$c1]-[$c2]=$c1*$c2; } } for ($c1=1;$c111;$c1++){ print Multiplication Table of $c1\n\n\n; for ($c2=1;$c211;$c2++){ print $c1 x $c2 = $table[$c1]-[$c2]\n; } print \n\n\n\n; } - Original Message - From: Gajo Csaba [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 31, 2002 9:29 PM Subject: A very, very simple question Hi, I've started learning Perl a few days ago, but I'm a computer science student, so I'm not a complete idiot :) This is the problem: I'm trying to make a simple 2D matrix that represents the product of the numbers 1-10 (don't know how to tell it in English, it's that table that kids learn when their 2nd grade) I've wrote the following: sub init { for ($a=0;$a10;$a++) { $table[$a,0] = $a; $table[0,$a] = $a; } } sub count { for ($a=0;$a10;$a++) { for ($b=0;$b10;$b++) { $table[$a,$b] = $table[$a,0] * $table[0,$b]; } } } sub print { etc... } init; count; print; --- The count function might not have been written this way, but the init function sure looks like that, and that is the function I'm having a problem with. It doesn't work, but can't figure out why? It should give a result like this: 0123456789 10 20 30 40 50 60 70 80 90 But instead I get 99 90 90 90 ... etc So I wrote a procedure like this: sub test { for ($a=0;$a10;$a++) { print $a; $table[$a,0] = $a; } } and when I print the table, I get the following: 123456789 (from the print $a line) 9 etc... It's like it counts to 9, and then fills the table with nines. But why? Anyway, can someone help? Thanks, Csaba -- 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: SQL table updates
use this querry 'update tablename set fieldname1=newvalue1,fieldname2=newvalue2 where somefield=something' - Original Message - From: Scott Taylor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 31, 2002 9:34 PM Subject: SQL table updates Hello all, Can anyone tell me how to make this code work, so that, if the record already exists, just update the values instead of creating a new record? open(InFile, fuelcrd) || die Can not open file: $!\n; while(InFile){ chomp; my ($FuelCrd, $TrkID, $FuelCmp) = split(/,/,$_); $FuelCrd =~ s/\//g; $TrkID =~ s/\//g; $FuelCmp =~ s/\//g; chomp($FuelCrd, $TrkID, $FuelCmp); print $FuelCrd, $TrkID, $FuelCmp\n; $SQL = qq[insert into cardlock (cardno, trkid, fuelcmp) values ('$FuelCrd', '$TrkID', '$FuelCmp')]; $sth = $dbh-prepare($SQL) || die $SQL\n$!\n; $sth-execute || die $SQL\n$!\n; } close InFile; $sth-finish; $dbh-disconnect; My pseudo code looks like this: find first record in table where id = 'blah' if not available record then create record. assign values to record. Cheers. Scott. -- 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]
OOP Mailing lists
Can any body tell me a address of a OOP mailing list for perl