Re: Formmail help
We use the NMS formmail script. William McKee [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Sander, I'm not familiar with Exchange but if it speaks SMTP, you should be able to use a module such as Mail::Sendmail or the newer Email::Send module to talk to it. What formmail script are you using to process your forms? I'd recommend the nms scripts[1]. HTH, William [1] http://nms-cgi.sourceforge.net/ -- Knowmad Services Inc. http://www.knowmad.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: getting one hash out of multiple files
Folker Naumann wrote: Hi there! Hello, I'm fairly new to Perl and need some help to acomplish a (simple?) task. I extract strings from some logfiles, namely an ip-adress and bytes, by using regexes. I use a hash to store ip-adress and associated bytes. First i packed all logs in a temporary file but it was getting too big. Now i'm having problems to merge the hashes from the single logfiles to one hash for all. Either i have a hash for each of the files or just one for the last processed file. i should have include my code in the beginning, because i've done this already. I know that in this case a hash is generated for every file. But when i do the printing outside the foreach-loop just the hash of the last file is printed. I'm aware about that problem but could not figure out how to create only one hash for all files. You may be able to do this by using a tied hash which will actually store the hash's contents in a file. perldoc DB_File perldoc AnyDBM_File perldoc perldbmfilter -- (...) foreach $file (@sortlist){ open(LOG,$file) or die Can't open $file: $!\n; @lines = LOG; foreach my $logline (reverse(@lines)) { You could use File::ReadBackwards (which is a lot more efficient) if you really need to this however there is no point as you are storing the data in a hash which will not preserve the input order. #Search for Host-IP-Adress and bytes if( $logline =~ / (\d+\.\d+\.\d+\.\d+) \w*\/\w* (\d+) [A-Z]+/ ){ if($ipload{$1}) {$ipload{$1}+=$2} else {$ipload{$1}=$2} You don't need the if test as perl will do the right thing when $ipload{$1} doesn't exist (autovivification.) You can compress the IP address quite a bit by using Socket::inet_aton() which will also confirm that it is a valid IP address. } } #Close log file close(LOG) or die Can't close $file: $!\n; #Print hash sorted by Host-IP-Adress foreach $ip ( map { $_-[0] } sort { $a-[1] = $b-[1] } map { [ $_, (/(\d+)$/)[0] ] } keys %ipload) { You don't need the list slice because without the /g (global) option the expression can only match once. Your comment says you are sorting by IP address but your code says you are only sorting by the last octet in the address. Did you intend to sort by the complete IP address? print $ip = $ipload{$ip}\n; } -- This may work as it doesn't slurp the whole file(s) into memory: use warnings; use strict; use Socket; my %ipload; { local @ARGV = @sortlist; while ( ) { next unless / (\d+\.\d+\.\d+\.\d+) \w*\/\w* (\d+) [A-Z]+/ my $ip = inet_aton( $1 ) or do { warn $1 is an invalid IP address.\n; next; }; $ipload{ $1 } += $2 } } #Print hash sorted by Host-IP-Adress for ( sort keys %ipload ) { my $ip = inet_ntoa( $_ ); print $ip = $ipload{$_}\n; } __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
reflection in perl
hi, i'm new to perl and i want to know if perl has reflection like java? how can i acces reflection and how powerfull is the reflection in perl? thx mseele -- G H Softwareentwicklung GmbH Tel.: +49(0)7451/53706-20 Robert-Bosch-Str. 23 Fax: +49(0)7451/53706-90 D-72160 Horb a.N. http://www.guh-software.de -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Need Help
Hi Please anyone help me in Reg Exp. I wanted to replace [%one_two%] and [%pne%] with the value New say... I wrote the following code...I am unable to get the output as This is a test for New number and New numbers. I am getting it as This a test for New numbers. WHICH IS WRONG... Please let me know what to do If I need to replace in both... Thanks Anish #!/usr/bin/perl $openTag='\[%'; $closeTag='%\]'; my $count=0; $_= This is a test for [%one_two%] number and [%pne%] numbers.; s/$openTag.*$closeTag/New/g; print The new line is:: $_ \n;
Open file with default application software on Windows ?
Hello, I am curious to know that if that is an existed module to open files with it's default application just like I double click on the file with mouse. and I do something just like this with my code : use defaultOpen; defOpen 'C:\temp.gif' or die $! ; # Then the image will open with photoshop. defOpen 'C:\temp.doc' or die $! ; # then the document will open with Word. I've made this done by writting a batch like code.. but I sure that's unsafe and unportable. Thanks for any hint, Bee
Re: getting one hash out of multiple files
John W. Krahn wrote: You may be able to do this by using a tied hash which will actually store the hash's contents in a file. perldoc DB_File perldoc AnyDBM_File perldoc perldbmfilter Tied hashes look fairly complicated to me, but i'll give them a try ;) #Print hash sorted by Host-IP-Adress foreach $ip ( map { $_-[0] } sort { $a-[1] = $b-[1] } map { [ $_, (/(\d+)$/)[0] ] } keys %ipload) { You don't need the list slice because without the /g (global) option the expression can only match once. Your comment says you are sorting by IP address but your code says you are only sorting by the last octet in the address. Did you intend to sort by the complete IP address? I have to admit that i'm not completly firm with the Schwartzian Transformation, but it does what i want. Because all adresses belong to only one subnet i just need to sort by the last octet and i get: 192.168.0.1 192.168.0.2 ... 192.168.0.255 -- This may work as it doesn't slurp the whole file(s) into memory: use warnings; use strict; use Socket; my %ipload; { local @ARGV = @sortlist; while ( ) { next unless / (\d+\.\d+\.\d+\.\d+) \w*\/\w* (\d+) [A-Z]+/ my $ip = inet_aton( $1 ) or do { warn $1 is an invalid IP address.\n; next; }; $ipload{ $1 } += $2 } } #Print hash sorted by Host-IP-Adress for ( sort keys %ipload ) { my $ip = inet_ntoa( $_ ); print $ip = $ipload{$_}\n; } __END__ This gives me Bad arg length for Socket::inet_ntoa, length is 13, should be 4 at line... Thanks Folker Naumann -- 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
Within single quotes [ is not considered as a special character. So,it's a mess trying to escape this character with backslash \. So,your code expects \[%one_two%\] instead of [%one_two%]. On Thu, 7 Oct 2004, Anish Kumar K. wrote: Hi Please anyone help me in Reg Exp. I wanted to replace [%one_two%] and [%pne%] with the value New say... #!/usr/bin/perl $openTag='\[%'; $closeTag='%\]'; my $count=0; $_= This is a test for [%one_two%] number and [%pne%] numbers.; s/$openTag.*$closeTag/New/g; print The new line is:: $_ \n; -- Regards, K.Prabakar -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: reflection in perl
On Thu, Oct 07, 2004 at 11:28:44AM +0200, Michael Seele wrote: i'm new to perl and i want to know if perl has reflection like java? how can i acces reflection and how powerfull is the reflection in perl? You might want to narrow this down a bit to get real information, but: http://java.sun.com/docs/books/tutorial/reflect/ says ] The reflection API represents, or reflects, the classes, interfaces, ] and objects in the current Java Virtual Machine. You'll want to use ] the reflection API if you are writing development tools such as ] debuggers, class browsers, and GUI builders. With the reflection API ] you can: ] * Determine the class of an object. ref() ] * Get information about a class's modifiers, fields, methods, ] constructors, and superclasses. ] * Find out what constants and method declarations belong to an ] interface. You would probably use can(), @ISA and, depending of the base type of the class, exists(). ] * Create an instance of a class whose name is not known until ] runtime. bless $obj, $class ] * Get and set the value of an object's field, even if the field name ] is unknown to your program until runtime. $obj-{$field} = $value ] * Invoke a method on an object, even if the method is not known ] until runtime. $obj-$method ] * Create a new array, whose size and component type are not known ] until runtime, and then modify the array's components. my @arr; $arr[$index] = $value You can also access the symbol table at runtime, and use the B modules to access a lot of internal information. But I don't think you'll need to at first. You'll need to learn to think the Perl way to get the best from the language. You could program Perl as if it were Java, and do everything you want to, but if you're using Perl, you might as well work to its strengths. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- 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
Anish Kumar K. wrote: Hi Please anyone help me in Reg Exp. I wanted to replace [%one_two%] and [%pne%] with the value New say... I wrote the following code...I am unable to get the output as This is a test for New number and New numbers. I am getting it as This a test for New numbers. WHICH IS WRONG... Please let me know what to do If I need to replace in both... Thanks Anish #!/usr/bin/perl $openTag='\[%'; $closeTag='%\]'; my $count=0; $_= This is a test for [%one_two%] number and [%pne%] numbers.; s/$openTag.*$closeTag/New/g; print The new line is:: $_ \n; .* is greedy and will match from the first $openTag til the last $closeTag, from here -[%one_two%] number and [%pne%]- to here. Use .*? instead, it is non-greedy and will match from here -[%one_two%]- to here and from here -[%pne%]- to here. I can recommed Mastering Regular Expressions form O'Reilly if you want to learn more. -- Flemming Greve SkovengaardThe prophecy of the holy Norns a.k.a Greven, TuxPowerThe world is doomed to die [EMAIL PROTECTED] Fire in the sky 4112.38 BogoMIPS The end is coming soon -- 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
This is an example of perl regular expression greediness. check 'perldoc perlre' and search for greediness. You might want to use something like s/$openTag.*?$closeTag/New/g the extra '?' does not mean what you think it means when it follows a + or a * :-) Sorry for the top post. On Thu, 7 Oct 2004 15:45:09 +0530, Anish Kumar K. [EMAIL PROTECTED] wrote: Hi Please anyone help me in Reg Exp. I wanted to replace [%one_two%] and [%pne%] with the value New say... I wrote the following code...I am unable to get the output as This is a test for New number and New numbers. I am getting it as This a test for New numbers. WHICH IS WRONG... Please let me know what to do If I need to replace in both... Thanks Anish #!/usr/bin/perl $openTag='\[%'; $closeTag='%\]'; my $count=0; $_= This is a test for [%one_two%] number and [%pne%] numbers.; s/$openTag.*$closeTag/New/g; print The new line is:: $_ \n; -- 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 file with default application software on Windows ?
Search for a program called 'shellexec'. (use google). Shellexec does exactly what you want, but its a windows executable, so instead of calling defopen something; try system(shellexec something); you should be able to download shellexec or an equivalent from many places. As for portable? Its portable among the various platforms that run word-4-windows (duh) On Thu, 7 Oct 2004 18:21:21 +0800, Bee [EMAIL PROTECTED] wrote: Hello, I am curious to know that if that is an existed module to open files with it's default application just like I double click on the file with mouse. and I do something just like this with my code : use defaultOpen; defOpen 'C:\temp.gif' or die $! ; # Then the image will open with photoshop. defOpen 'C:\temp.doc' or die $! ; # then the document will open with Word. I've made this done by writting a batch like code.. but I sure that's unsafe and unportable. Thanks for any hint, Bee -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
X11::GUITest sendkeys with keycode ?
Hi All, I came across this excellent module X11::GUITest , by which I can send inputs to X applications. My problem is I am not able to send special keys like HOME END etc Is there a way by which I can sendkeys using the keycode Thanks Ram -- 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
Thanks a lot for the mail... I have one more to clarify...The line you specified s/$openTag.*?$closeTag/New/g; searches and replaces the tags with the word New fine.. My questions is if there is a line like $_= This is a test for [%one_two%] number and [%pne%] numbers.; Is there in perl any operator which will help me to take the variable names separately like... one_two pne Thanks Anish - Original Message - From: David le Blanc [EMAIL PROTECTED] To: Anish Kumar K. [EMAIL PROTECTED] Cc: beginners perl [EMAIL PROTECTED] Sent: Thursday, October 07, 2004 4:38 PM Subject: Re: Need Help This is an example of perl regular expression greediness. check 'perldoc perlre' and search for greediness. You might want to use something like s/$openTag.*?$closeTag/New/g the extra '?' does not mean what you think it means when it follows a + or a * :-) Sorry for the top post. On Thu, 7 Oct 2004 15:45:09 +0530, Anish Kumar K. [EMAIL PROTECTED] wrote: Hi Please anyone help me in Reg Exp. I wanted to replace [%one_two%] and [%pne%] with the value New say... I wrote the following code...I am unable to get the output as This is a test for New number and New numbers. I am getting it as This a test for New numbers. WHICH IS WRONG... Please let me know what to do If I need to replace in both... Thanks Anish #!/usr/bin/perl $openTag='\[%'; $closeTag='%\]'; my $count=0; $_= This is a test for [%one_two%] number and [%pne%] numbers.; s/$openTag.*$closeTag/New/g; print The new line is:: $_ \n; -- 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 file with default application software on Windows ?
Wow !! As you mentioned, thaz EXACTLY what I want :-)) Thousands Thanks !!! Bee - Original Message - From: David le Blanc [EMAIL PROTECTED] To: Bee [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, October 07, 2004 7:11 PM Subject: Re: Open file with default application software on Windows ? Search for a program called 'shellexec'. (use google). Shellexec does exactly what you want, but its a windows executable, so instead of calling defopen something; try system(shellexec something); you should be able to download shellexec or an equivalent from many places. As for portable? Its portable among the various platforms that run word-4-windows (duh) On Thu, 7 Oct 2004 18:21:21 +0800, Bee [EMAIL PROTECTED] wrote: Hello, I am curious to know that if that is an existed module to open files with it's default application just like I double click on the file with mouse. and I do something just like this with my code : use defaultOpen; defOpen 'C:\temp.gif' or die $! ; # Then the image will open with photoshop. defOpen 'C:\temp.doc' or die $! ; # then the document will open with Word. I've made this done by writting a batch like code.. but I sure that's unsafe and unportable. Thanks for any hint, Bee -- 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
Contact Form/Email Capability
All, I have a Perl script I am running from an HTML page that will save the output in a file called comments.txt. Is there anyway I can email this file everytime to an email address that I provide. This will be running on a Windows platform. Also, if you have better suggestions for what I am trying to accomplish that would be appreciated. I am trying to create a contact form, which will show the input, and email the contents to an email address, and show a successful transmission, and a thank you message, then return to the Home page. Any help would be appreciated, here is what I have. contact2.pl Contact2.html thankyou.html Thanks, Dan contact2.pl Description: contact2.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Finding a file
Hi First : I want to find the file Normal.dot on any computer (the users names differ) How can I find the file in any tree or directory. Second : I want to delete the normal.dot and replace it with the normal.dot that I made. Help will be appreciated Thanx
Finding a file
Hi First : I want to find the file Normal.dot on any computer (the users names differ) How can I find the file in any tree or directory. Second : I want to delete the normal.dot and replace it with the normal.dot that I made. Help will be appreciated Thanx
Compiling and distributing Perl
Ok, I have a sane compiler toolset installed on my development server, but NOT on several servers on which I want Perl. (Where the development and production servers are the same architecture.) Can I build install Perl on my development server, and then just distribute it as a tarball to the production servers? What about installation of custom Perl modules? How can these be integrated into my custom distribution on the production servers without a compiler toolset on the production servers? Can they? I hope this wasn't too vague/broad a question. Please interrogate if more info is needed. Thanks..! Karl K. -- 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 file with default application software on Windows ?
Bee wrote: Hello, I am curious to know that if that is an existed module to open files with it's default application just like I double click on the file with mouse. and I do something just like this with my code : use defaultOpen; defOpen 'C:\temp.gif' or die $! ; # Then the image will open with photoshop. defOpen 'C:\temp.doc' or die $! ; # then the document will open with Word. I've made this done by writting a batch like code.. but I sure that's unsafe and unportable. won't system start temp.doc do the trick? -- 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 file with default application software on Windows ?
Thanks thanks, a very nice lesson again !! Feel quite sorry that I even never heard about this command for using windows after so many years... Thousands thanks, Bee - Original Message - From: Bob Showalter [EMAIL PROTECTED] To: 'Bee' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, October 07, 2004 8:24 PM Subject: RE: Open file with default application software on Windows ? Bee wrote: Hello, I am curious to know that if that is an existed module to open files with it's default application just like I double click on the file with mouse. and I do something just like this with my code : use defaultOpen; defOpen 'C:\temp.gif' or die $! ; # Then the image will open with photoshop. defOpen 'C:\temp.doc' or die $! ; # then the document will open with Word. I've made this done by writting a batch like code.. but I sure that's unsafe and unportable. won't system start temp.doc do the trick? -- 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: Need Help
Hi Anish, .* always tries to match as much as possible. So the code you have sent takes the first [% and the last %] and replaces everything in between. If the contents in between the openTag and the closeTag is ONLY word characters (i.e., _, 0-9, a-z, A-Z) then you may change the regEx to s/$openTag\w+$closeTag/New/g; With Best regards, R. Kamal Raj Guptha. -Original Message- From: Anish Kumar K. [mailto:[EMAIL PROTECTED] Sent: Thursday, October 07, 2004 3:45 PM To: beginners perl Subject: Need Help Hi Please anyone help me in Reg Exp. I wanted to replace [%one_two%] and [%pne%] with the value New say... I wrote the following code...I am unable to get the output as This is a test for New number and New numbers. I am getting it as This a test for New numbers. WHICH IS WRONG... Please let me know what to do If I need to replace in both... Thanks Anish #!/usr/bin/perl $openTag='\[%'; $closeTag='%\]'; my $count=0; $_= This is a test for [%one_two%] number and [%pne%] numbers.; s/$openTag.*$closeTag/New/g; print The new line is:: $_ \n; Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Finding a file
differ) How can I find the file in any tree or directory. perldoc -m File::Find perldoc -f glob perldoc -f opendir perldoc -f readdir Second : I want to delete the normal.dot and replace it with the normal.dot that perldoc -f unlink perldoc -m File::Copy HTH, Bee -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
CPAN help
Hi Perl Mongers, I need to configure the CPAN module to use gcc (which I've installed). Whenever I run: # perl -MCPAN -e 'install Bundle::CPAN;' the CPAN module automatically uses the cc that is in my /usr/ucb/ directory. (I'm running Solaris 9 on Sun hardware). I tried adding the following line to the CPAN Config.pm file: 'cc' = q[/usr/local/bin/gcc], But that didn't work, it still tries to use /usr/ucb/cc. What can I do? Is there a command line switch I can use? --Errin -- 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 file with default application software on Windows ?
From: Bee [EMAIL PROTECTED] I am curious to know that if that is an existed module to open files with it's default application just like I double click on the file with mouse. and I do something just like this with my code : use defaultOpen; defOpen 'C:\temp.gif' or die $! ; # Then the image will open with photoshop. defOpen 'C:\temp.doc' or die $! ; # then the document will open with Word. I've made this done by writting a batch like code.. but I sure that's unsafe and unportable. Thanks for any hint, Bee The system('start file.doc') only allows you to trigger the default action defined for the file type. If you want to use the other actions you might like use Win32::FileOp qw(ShellExecute); ShellExecute 'Print' = 'c:\temp.doc'; Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Compiling and distributing Perl
From: Karl Kaufman [EMAIL PROTECTED] Ok, I have a sane compiler toolset installed on my development server, but NOT on several servers on which I want Perl. (Where the development and production servers are the same architecture.) Can I build install Perl on my development server, and then just distribute it as a tarball to the production servers? Yes. If all servers are using the same OSarchitecture you should be able to do that. It would be better if you told us what architecture it is though. I can confirm that this does indeed work just fine for al kinds of MS Windows in Intel machines. To keep things simple you should keep the path to the instalation the same on all servers. Otherwise you may have to change some paths in Config.pm and maybe a few other places. What about installation of custom Perl modules? How can these be integrated into my custom distribution on the production servers without a compiler toolset on the production servers? Can they? Again ... if the OS architecture is the same you should be able to compile the modules on the dev server and then copy the results to the production ones. Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Registry Search Pattern Replace String
From: Steve [EMAIL PROTECTED] I am not sure what the best way to tackle this problem so here it goes... I want to use the user's input to replace a string value in the registry. The problem is locating the subkey. There is one location that I need to change the string value: \\HKLM\SOFTWARE\Funk Software, Inc.\odyssey\client\configuration \userDefaults\profiles\profile#1A1A1A11AA1A1A1A1A1A1AAA111 1 \authentication ttlsIdentity: UserName Under the profiles key, there are two profile#... subkeys. There are exactly 40 alphanumerics following the #. Under both authentication keys, they both contain the ttlsIdentity string value. If I have to make both the same values, that's fine as long as I change the second ttlsIdentity value to the username the user input in the script. What differetiates the two profile keys are that they contain different string values for secondaryAuth in subkey authentication. If you install the Win32::Registry2 patch from http://Jenda.Krynicky.cz/#Win32::Registry2 you may do something like this: use Win32::Registry; ... my $key = $HKLM-Open('SOFTWARE\Funk Software, Inc.\odyssey\client\configuration\userDefaults\profiles'); foreach my $subkey ($key-GetKeys()) { next unless my $subkey = $key-Open($subkey\\authentication); next unless $subkey-GetValue('secondaryAuth') eq 'PAP-Token' $subkey-SetValue('ttlsIdentity', REG_SZ, $username) } Jenda P.S.: The code is untested, but should be about right. = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re Finding file
Hi This is what I'm using to find the file. .I still can't delete the file or replace it with the file I created. Help pls Thanx se strict; use File::Find; use CGI qw(:standard); my $query = param(Toetsss); undef $/; find( sub { return if($_ =~ /^\./); return unless($_ =~ /Toetsss.txt/i); stat $File::Find::name; return if -d; return unless -r; open(FILE, $File::Find::name) or return; my $string = FILE; close (FILE); print $File::Find::name\n; }, 'c:\Documents and Settings');
Re: Open file with default application software on Windows ?
On Thu, 07 Oct 2004 16:10:29 +0200, Jenda Krynicky [EMAIL PROTECTED] wrote: From: Bee [EMAIL PROTECTED] I am curious to know that if that is an existed module to open files with it's default application just like I double click on the file with mouse. and I do something just like this with my code : use defaultOpen; defOpen 'C:\temp.gif' or die $! ; # Then the image will open with photoshop. defOpen 'C:\temp.doc' or die $! ; # then the document will open with Word. I've made this done by writting a batch like code.. but I sure that's unsafe and unportable. Thanks for any hint, Bee The system('start file.doc') only allows you to trigger the default action defined for the file type. If you want to use the other actions you might like use Win32::FileOp qw(ShellExecute); ShellExecute 'Print' = 'c:\temp.doc'; Wow. Best answer. I assign you 50 guru points :-) Where do I send them? Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- 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: Need Help
Anish Kumar K. wrote: My questions is if there is a line like $_= This is a test for [%one_two%] number and [%pne%] numbers.; Is there in perl any operator which will help me to take the variable names separately like... one_two pne I already helped you with this problem yesterday. Didn't you see my suggestion? http://www.mail-archive.com/beginners%40perl.org/msg62590.html -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- 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
K.Prabakar wrote: Anish Kumar K. wrote: $openTag='\[%'; $closeTag='%\]'; my $count=0; $_= This is a test for [%one_two%] number and [%pne%] numbers.; s/$openTag.*$closeTag/New/g; Within single quotes [ is not considered as a special character. So,it's a mess trying to escape this character with backslash \. No it's not. So,your code expects \[%one_two%\] instead of [%one_two%]. No it doesn't. '[' and ']' are used in a regular expression where those characters are special. How about testing before posting such a comment? -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: getting one hash out of multiple files
Folker Naumann wrote: John W. Krahn wrote: This may work as it doesn't slurp the whole file(s) into memory: use warnings; use strict; use Socket; my %ipload; { local @ARGV = @sortlist; while ( ) { next unless / (\d+\.\d+\.\d+\.\d+) \w*\/\w* (\d+) [A-Z]+/ my $ip = inet_aton( $1 ) or do { warn $1 is an invalid IP address.\n; next; }; $ipload{ $1 } += $2 } } #Print hash sorted by Host-IP-Adress for ( sort keys %ipload ) { my $ip = inet_ntoa( $_ ); print $ip = $ipload{$_}\n; } __END__ This gives me Bad arg length for Socket::inet_ntoa, length is 13, should be 4 at line... Sorry, the line: $ipload{ $1 } += $2 should be: $ipload{ $ip } += $2 John -- use Perl; program fulfillment -- 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 file with default application software on Windows ?
-Original Message- From: Jenda Krynicky [mailto:[EMAIL PROTECTED] Sent: Thursday, October 07, 2004 4:10 PM To: [EMAIL PROTECTED] Subject: Re: Open file with default application software on Windows ? From: Bee [EMAIL PROTECTED] I am curious to know that if that is an existed module to open files with it's default application just like I double click on the file with mouse. and I do something just like this with my code : use defaultOpen; defOpen 'C:\temp.gif' or die $! ; # Then the image will open with photoshop. defOpen 'C:\temp.doc' or die $! ; # then the document will open with Word. I've made this done by writting a batch like code.. but I sure that's unsafe and unportable. Thanks for any hint, Bee The system('start file.doc') only allows you to trigger the default action defined for the file type. If you want to use the other actions you might like use Win32::FileOp qw(ShellExecute); ShellExecute 'Print' = 'c:\temp.doc'; ShellExecute $operation = $file; How to find the list of available $operations ? The doc says: $operation : specifies the action to perform. The set of available operations depends on the file type. Generally, the actions available from an object's shortcut menu are available verbs. object's shortcut menu ? Could you elaborate please :-) ? Thanks, José. DISCLAIMER This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer. Thank you for your cooperation. For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Contact Form/Email Capability
I have a Perl script I am running from an HTML page that will save the output in a file called comments.txt. Is there anyway I can email this file everytime to an email address that I provide. This will be running on a Windows platform. Also, if you have better suggestions for what I am trying to accomplish that would be appreciated. I am trying to create a contact form, which will show the input, and email the contents to an email address, and show a successful transmission, and a thank you message, then return to the Home page. Any help would be appreciated, here is what I have. Are you simply trying to email this file everytime this script is executed? If so, there are a number of modules you can use in this script to do that: MIME::Lite (great for sending attachments_ Mail::Sender Mail::Sendmail Net::SMTP Simpley google for these and you should find plenty of examples. I have some example scripts as well I can send you if you like HTH, Jim --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.772 / Virus Database: 519 - Release Date: 10/1/2004 -- 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 Finding file
Charlene Gentle wrote: Hi Hello, This is what I'm using to find the file. .I still can't delete the file perldoc -f unlink or replace it with the file I created. perldoc File::Copy se strict; use File::Find; use CGI qw(:standard); my $query = param(Toetsss); undef $/; find( sub { return if($_ =~ /^\./); return unless($_ =~ /Toetsss.txt/i); stat $File::Find::name; return if -d; You are stat()ing the same file a second time. return unless -r; You are stat()ing the same file a third time. Use the _ special filehandle to avoid stating the same file more than once. stat; return if -d _; return unless -r _; open(FILE, $File::Find::name) or return; my $string = FILE; close (FILE); print $File::Find::name\n; }, 'c:\Documents and Settings'); John -- use Perl; program fulfillment -- 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 Finding file
This is what I'm using to find the file. .I still can't delete the file or replace it with the file I created. Help pls Thanx se strict; use File::Find; use CGI qw(:standard); my $query = param(Toetsss); undef $/; find( sub { return if($_ =~ /^\./); return unless($_ =~ /Toetsss.txt/i); stat $File::Find::name; return if -d; return unless -r; open(FILE, $File::Find::name) or return; my $string = FILE; close (FILE); print $File::Find::name\n; }, 'c:\Documents and Settings'); I don't seen anywhere in this script where you actually attempt to delete or rename anything Did I miss something? and why are you trying to open the file, if you are just trying to delete or rename it? perldoc -f unlink perldoc -f rename Thanks, Jim --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.772 / Virus Database: 519 - Release Date: 10/1/2004 -- 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 file with default application software on Windows ?
From: NYIMI Jose \(BMB\) [EMAIL PROTECTED] -Original Message- From: Jenda Krynicky [mailto:[EMAIL PROTECTED] The system('start file.doc') only allows you to trigger the default action defined for the file type. If you want to use the other actions you might like use Win32::FileOp qw(ShellExecute); ShellExecute 'Print' = 'c:\temp.doc'; ShellExecute $operation = $file; How to find the list of available $operations ? The doc says: $operation : specifies the action to perform. The set of available operations depends on the file type. Generally, the actions available from an object's shortcut menu are available verbs. object's shortcut menu ? Could you elaborate please :-) ? You can either find the list of actions if you manualy rightclick a file of that type in Windows Explorer (the topmost section of the menu except Open With) or go to the registry (regedit.exe) go to HKEY_CLASSES_ROOT\.doc, look at the default value (the type of the file), then go to HKEY_CLASSES_ROOT\the_type\Shell and the subkeys are the different available actions. ShellExecute lets you use either the name of the subkeys or the title specified in the default value in that subkey. If you need to find the list of actions programaticaly you just use Win32::Registry ro Tie::Registry to do the same. Find the type from HKEY_CLASSES_ROOT\.ext, go to HKEY_CLASSES_ROOT\the_type\Shell and list the subkeys. HTH, Jenda P.S.: Please do not CC me on emails sent to the list. Both emails end up in the same folder anyway. = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Contact Form/Email Capability
COUNTERMAN, DANIEL (CONTRACTOR) wrote: All, I have a Perl script I am running from an HTML page that will save the output in a file called comments.txt. Is there anyway I can email this file everytime to an email address that I provide. Be forewarned: this kind of thing tends to turn into a huge gaping security risk, opening your server to being used as an open relay for spammers. Google on formmail exploit, for example. The safest approach would be to avoid sending mail from your CGI program altogether. If the data goes into comments.txt, have a separate process (not runnable from the web server) that forwards that file to you. -- 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 file with default application software on Windows ?
From: Jenda Krynicky [mailto:[EMAIL PROTECTED] The system('start file.doc') only allows you to trigger the default action defined for the file type. If you want to use the other actions you might like use Win32::FileOp qw(ShellExecute); ShellExecute 'Print' = 'c:\temp.doc'; ShellExecute $operation = $file; How to find the list of available $operations ? The doc says: $operation : specifies the action to perform. The set of available operations depends on the file type. Generally, the actions available from an object's shortcut menu are available verbs. object's shortcut menu ? Could you elaborate please :-) ? You can either find the list of actions if you manualy rightclick a file of that type in Windows Explorer (the topmost section of the menu except Open With) or go to the registry (regedit.exe) go to HKEY_CLASSES_ROOT\.doc, look at the default value (the type of the file), then go to HKEY_CLASSES_ROOT\the_type\Shell and the subkeys are the different available actions. ShellExecute lets you use either the name of the subkeys or the title specified in the default value in that subkey. If you need to find the list of actions programaticaly you just use Win32::Registry ro Tie::Registry to do the same. Find the type from HKEY_CLASSES_ROOT\.ext, go to HKEY_CLASSES_ROOT\the_type\Shell and list the subkeys. A very nice hack, It leads me to imagine lot more possibilities, such as printing invoice when a sale get confirmed ... So glad to hear about this !! Many many thanks for the tips!! Bee -- 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 file with default application software on Windows ?
-Original Message- From: Jenda Krynicky [mailto:[EMAIL PROTECTED] Sent: Thursday, October 07, 2004 6:14 PM To: [EMAIL PROTECTED] Subject: RE: Open file with default application software on Windows ? From: NYIMI Jose \(BMB\) [EMAIL PROTECTED] -Original Message- From: Jenda Krynicky [mailto:[EMAIL PROTECTED] The system('start file.doc') only allows you to trigger the default action defined for the file type. If you want to use the other actions you might likeuse Win32::FileOp qw(ShellExecute); ShellExecute 'Print' = 'c:\temp.doc'; ShellExecute $operation = $file; How to find the list of available $operations ? The doc says: $operation : specifies the action to perform. The set of available operations depends on the file type. Generally, the actions available from an object's shortcut menu are available verbs. object's shortcut menu ? Could you elaborate please :-) ? You can either find the list of actions if you manualy rightclick a file of that type in Windows Explorer (the topmost section of the menu except Open With) or go to the registry (regedit.exe) go to HKEY_CLASSES_ROOT\.doc, look at the default value (the type of the file), then go to HKEY_CLASSES_ROOT\the_type\Shell and the subkeys are the different available actions. ShellExecute lets you use either the name of the subkeys or the title specified in the default value in that subkey. If you need to find the list of actions programaticaly you just use Win32::Registry ro Tie::Registry to do the same. Find the type from HKEY_CLASSES_ROOT\.ext, go to HKEY_CLASSES_ROOT\the_type\Shell and list the subkeys. HTH, Jenda P.S.: Please do not CC me on emails sent to the list. Both emails end up in the same folder anyway. Great ! I think you should add such info in the module documenation. Thanks, José. DISCLAIMER This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer. Thank you for your cooperation. For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Tcl/Tk training class
Hello, Can anyone recommend a Tcl/Tk training in DC/MD/VA? I am specifically looking for a course in intermediate to advance Tcl/Tk (including namespaces, packages, and GUI appearance). Thanks. __ William Ampeh (x3939) Federal Reserve Board -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Tcl/Tk training class
On Thu, 7 Oct 2004 [EMAIL PROTECTED] wrote: Can anyone recommend a Tcl/Tk training in DC/MD/VA? Can anyone on a global list for Perl beginners suggest local information for Tcl/Tk training ? No, probably not. But good luck to ya ! -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Linux strings for Perl
I have a captured file that is in a odd format. I can use the Linux strings command to parse all the information I need. The problem is that it requires a file as input. I am looking for the same functionality that strings gives me, but in a filter. I want to just pipe the output of my captured data to this module and have it perform the same functionality as strings. Does anyone know of such a module in Perl? John -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Linux strings for Perl
On Thu, Oct 07, 2004 at 01:20:47PM -0400, Cockerham, John (US SSA) wrote: I have a captured file that is in a odd format. I can use the Linux strings command to parse all the information I need. The problem is that it requires a file as input. I am looking for the same functionality that strings gives me, but in a filter. I want to just pipe the output of my captured data to this module and have it perform the same functionality as strings. Does anyone know of such a module in Perl? ppt? http://ppt.perl.org/commands/strings/index.html -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: auto dial
thanks Chris, for correcting syntax. the scenario is: operating system: Linux phone line is normal phone we use in our homes. I have a list of phone numbers in a spredsheet file(e.g *.xls) pick up number from there and automatically dial to that number through phone. I am new to Perl thats why i posted it here to know how it could be done in Perl. which module should be use, is there any program similar to this one has been built or not. etc. thanks Adam, On Wed, 6 Oct 2004 23:32:51 -0400 (EDT), Chris Devers [EMAIL PROTECTED] wrote: On Thu, 7 Oct 2004, Adam Saeed wrote: dear all, i want to dial automatically to phone through my PC getting numbers from text/etc. file. how could i do it in Perl? * Perl is the language, perl is the program that implements it. PERL is not a word; please do not capitalize it. * Questions end in question marks. Easy, right? :-) * We need to know about your environment -- what kind of PC (Windows?), what kind of phone (cell phone? landline?), how you're connecting to the phone (serial communication? Intellisync or similar software?), etc. This is an interesting problem, but you need to describe what tools you have to work with in order for us to begin to help you. Please write back to the list describing in detail what you've got, and especially, what you've tried to do so far. -- Chris Devers - -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: auto dial
On Thu, 7 Oct 2004, Adam Saeed wrote: the scenario is: operating system: Linux phone line is normal phone we use in our homes. I have a list of phone numbers in a spredsheet file(e.g *.xls) pick up number from there and automatically dial to that number through phone. I am new to Perl thats why i posted it here to know how it could be done in Perl. which module should be use, is there any program similar to this one has been built or not. etc. Okay, we still need to be more concrete here. Do you actually mean an Excel spreadsheet .xls file, or something else? If the data you need is in an Excel file, you need to use the CPAN module Spreadsheet::ParseExcel to get the data out: http://search.cpan.org/~kwitknr/Spreadsheet-ParseExcel-0.2603/ParseExcel.pm If it's a simple CSV file, you could get away with parsing the file manually, but Excel is too complicated to bother with manually. It looks like Modem::Vgetty may be able to interact with a voice modem, but the most recent version was 1998, so I'm not sure how well it'll work. Still, that seems to be about the only option, so you might as well start there: http://search.cpan.org/~yenya/Modem-Vgetty-0.03/Vgetty.pm Setting aside Perl for a moment, what tools do you have that have actually gotten you anywhere with this project? Are you able to get your contact info out of the file it lives in, or do you need help there? Are you able to get the computer to dial a number, or talk to the modem /or phone, or does that need to be sorted out? Please describe in some detail what you have so far. Also, be aware that this list isn't a script writing service -- we can point you towards good documentation and we can answer concrete questions, but we cannot help without first knowing what you've tried so far and what did and did not work the way you were expecting. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Grep Weirdness
Greetings, Encountering some unexpected behavior illustrated in the code snippet below. In the first foreach loop Seems like when I check for a match between gid306 and the contents of the the ACTIVES array I get an erroneous hit. But as shown in the second foreach loop if I remove gid and just try to match the number 306 it correctly determines there is no match. Is this a bug in Perl or in my understanding? Thanks John Kent #!/usr/bin/perl my($DEBUG) = 1; my(@ACTIVE) = qw {gid240 gid278 gid301}; my(@LOGGED) = qw {gid306 gid240 gid278 gid301}; # This doesn't work, finds a match for every item in # LOGGED, seems to be matching on gid but ignoring the number foreach (@LOGGED){ unless (grep /$_/,@ACTIVE){ print No Match for $__\n if ($DEBUG == 1); #do something here with what didn't match; } else { print found $_ in ACTIVES\n if ($DEBUG == 1); } } print \nNew test\n; # This works!!! foreach (@LOGGED){ my($match) = $_; # Remove the gid from the term to look for $match =~ s/gid//g; unless (grep /$match/,@ACTIVE){ print No Match for $_\n if ($DEBUG == 1); # do something here with what didn't match\n; } else { print found $_ in ACTIVES\n if ($DEBUG == 1); } } Results: [EMAIL PROTECTED] cgi-bin]$ ./test_grep.pl found gid306 in ACTIVES found gid240 in ACTIVES found gid278 in ACTIVES found gid301 in ACTIVES New test No Match for gid306 found gid240 in ACTIVES found gid278 in ACTIVES found gid301 in ACTIVES -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: auto dial
thanks again for quick reply Chris, I want to built a opensource utility for telemarketers. i.e they have a list of hundreds of numbers they have to dail, for windows there exists a commercial software, but for linux i do not know any, so i want to built it for linux so that linux users could also enjoy it. I did'nt mean to get script from here, i posted here to get initial ideas to be purified and sharpened so problem statement and algo, must become clear. i.e a way should be seen to do this. Thanks again Adam On Thu, 7 Oct 2004 14:45:52 -0400 (EDT), Chris Devers [EMAIL PROTECTED] wrote: On Thu, 7 Oct 2004, Adam Saeed wrote: the scenario is: operating system: Linux phone line is normal phone we use in our homes. I have a list of phone numbers in a spredsheet file(e.g *.xls) pick up number from there and automatically dial to that number through phone. I am new to Perl thats why i posted it here to know how it could be done in Perl. which module should be use, is there any program similar to this one has been built or not. etc. Okay, we still need to be more concrete here. Do you actually mean an Excel spreadsheet .xls file, or something else? If the data you need is in an Excel file, you need to use the CPAN module Spreadsheet::ParseExcel to get the data out: http://search.cpan.org/~kwitknr/Spreadsheet-ParseExcel-0.2603/ParseExcel.pm If it's a simple CSV file, you could get away with parsing the file manually, but Excel is too complicated to bother with manually. It looks like Modem::Vgetty may be able to interact with a voice modem, but the most recent version was 1998, so I'm not sure how well it'll work. Still, that seems to be about the only option, so you might as well start there: http://search.cpan.org/~yenya/Modem-Vgetty-0.03/Vgetty.pm Setting aside Perl for a moment, what tools do you have that have actually gotten you anywhere with this project? Are you able to get your contact info out of the file it lives in, or do you need help there? Are you able to get the computer to dial a number, or talk to the modem /or phone, or does that need to be sorted out? Please describe in some detail what you have so far. Also, be aware that this list isn't a script writing service -- we can point you towards good documentation and we can answer concrete questions, but we cannot help without first knowing what you've tried so far and what did and did not work the way you were expecting. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- Allah Hafiz O! God Thy sea is so great and my boat is so small. Adam -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Grep Weirdness
Mr. John Kent wrote: Encountering some unexpected behavior illustrated in the code snippet below. In the first foreach loop Seems like when I check for a match between gid306 and the contents of the the ACTIVES array I get an erroneous hit. snip Is this a bug in Perl or in my understanding? You missed that when using grep(), $_ is set locally to each LIST element, i.e. in that context $_ does not represent the element in the @LOGGED array. my(@ACTIVE) = qw {gid240 gid278 gid301}; my(@LOGGED) = qw {gid306 gid240 gid278 gid301}; # This doesn't work, finds a match for every item in # LOGGED, seems to be matching on gid but ignoring the number foreach (@LOGGED){ unless (grep /$_/,@ACTIVE){ Consequently, that is always true. To get rid of the confusion, you can make use of a named variable in the foreach loop: foreach my $logged (@LOGGED) { unless (grep { $logged eq $_ } @ACTIVE) { print No Match for $logged\n; } else { print found $logged in ACTIVES\n; } } -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: auto dial
On Thu, 7 Oct 2004, Adam Saeed wrote: I want to built a opensource utility for telemarketers. Ahh, I see. Well, I'm fresh out of ideas in that case. Good luck, and let us know how it goes! :-) -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Grep Weirdness
Kent, Mr. John (Contractor) wrote: Greetings, Hello, Encountering some unexpected behavior illustrated in the code snippet below. In the first foreach loop Seems like when I check for a match between gid306 and the contents of the the ACTIVES array I get an erroneous hit. But as shown in the second foreach loop if I remove gid and just try to match the number 306 it correctly determines there is no match. Is this a bug in Perl or in my understanding? Thanks John Kent #!/usr/bin/perl always put use strict; use warnings; here. that will solve 99% of the problems for you by telling you what is off ;p my($DEBUG) = 1; my(@ACTIVE) = qw {gid240 gid278 gid301}; my(@LOGGED) = qw {gid306 gid240 gid278 gid301}; No need to surround those variable/array neame with () my $DEBUG = 1; my @ACTIVE = ... Also it works but is confusing to use curly braces qith qw. my @LOGGED = qw(gid306 gid240 gid278 gid301); is better because there's no need to guess if you're trying to do an array of items or an array with one hashref in it. # This doesn't work, finds a match for every item in # LOGGED, seems to be matching on gid but ignoring the number Your $_ are going out of scope. the grep() $_ is an item in @ACTIVE and in that case will always be true. Also the unless and else is a bit odd Try nameing the variables: foreach (@LOGGED){ unless (grep /$_/,@ACTIVE){ print No Match for $__\n if ($DEBUG == 1); I think you meant $_ not $__ strict and warnings would have told you about that. #do something here with what didn't match; } else { print found $_ in ACTIVES\n if ($DEBUG == 1); Again, no () are really necessary Also you can shorten it to if $DEBUG; then set $DEBUG to 0 when you don't want that output. } } Here it is with all the changes, (necessary and cosmetic): #!/usr/bin/perl use strict; use warnings; my $DEBUG = 1; my @ACTIVE = qw(gid240 gid278 gid301); my @LOGGED = qw(gid306 gid240 gid278 gid301); for my $logd(@LOGGED) { if(grep { $logd eq $_ } @ACTIVE) { print Found $logd in ACTIVES\n if $DEBUG; } else { print No match for $logd\n if $DEBUG; } } __END__ No match for gid306 Found gid240 in ACTIVES Found gid278 in ACTIVES Found gid301 in ACTIVES HTH :) Lee.M - JupiterHost.Net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Grep Weirdness
Kent, Mr. John (Contractor) wrote: ... my(@ACTIVE) = qw {gid240 gid278 gid301}; my(@LOGGED) = qw {gid306 gid240 gid278 gid301}; # This doesn't work, finds a match for every item in # LOGGED, seems to be matching on gid but ignoring the number foreach (@LOGGED){ unless (grep /$_/,@ACTIVE){ print No Match for $__\n if ($DEBUG == 1); #do something here with what didn't match; } else { print found $_ in ACTIVES\n if ($DEBUG == 1); } } Others have explained the localization of $_ issue. It's not important for such a small data set, but if @ACTIVE is large, you can improve performance by doing a hash lookup instead of a grep(): use strict; my(@ACTIVE) = qw {gid240 gid278 gid301}; my(@LOGGED) = qw {gid306 gid240 gid278 gid301}; my %h; @[EMAIL PROTECTED] = (); print exists $h{$_} ? Found : No match for, $_\n for @LOGGED; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: auto dial
On Thu, 7 Oct 2004 15:52:14 -0400 (EDT), Chris Devers [EMAIL PROTECTED] wrote: On Thu, 7 Oct 2004, Adam Saeed wrote: I want to built a opensource utility for telemarketers. Ahh, I see. Well, I'm fresh out of ideas in that case. Good luck, and let us know how it goes! :-) -- Chris Devers Wait! Why don't you give us your home telephone number and We'll call you (probably everyday) with our ideas to help you (probably when you are eating or trying to go to sleep). Won't that be nice? --Errin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: auto dial
On Fri, 8 Oct 2004 03:53:55 +0600, Adam Saeed [EMAIL PROTECTED] wrote: Hi Errin! good tracking...! lema hee hee.. i am in Pakistan...It would be a nice thing but., phone calls will cost you $. It would be a reasonable approach. if some others also want to work on this proj. then we create some bugzilla account and start developing .. It would also be a nice approach if we use some A.I techniques in regarding using/indexing etc. for getting/extracting information from voice mails/calls that have been saving during the process... On Thu, 7 Oct 2004 16:30:45 -0500, Errin Larsen [EMAIL PROTECTED] wrote: On Thu, 7 Oct 2004 15:52:14 -0400 (EDT), Chris Devers [EMAIL PROTECTED] wrote: On Thu, 7 Oct 2004, Adam Saeed wrote: I want to built a opensource utility for telemarketers. Ahh, I see. Well, I'm fresh out of ideas in that case. Good luck, and let us know how it goes! :-) -- Chris Devers Wait! Why don't you give us your home telephone number and We'll call you (probably everyday) with our ideas to help you (probably when you are eating or trying to go to sleep). Won't that be nice? --Errin -- Allah Hafiz O! God Thy sea is so great and my boat is so small. Adam -- Allah Hafiz O! God Thy sea is so great and my boat is so small. Adam -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Any way to handle Windows WM_QUERYENDSESSION message?
I have a Perl script running on Windows that functions as a wrapper to a second program -- a compiled executable I cannot change. Within my Perl script, I use 'system' to call the second program and wait for it to return -- pretty basic. However, the second program calls ExitWindows() when it eventually ends (a few minutes to a few hours later), so my Perl script gets control back just long enough to print a line before perl (or wperl) gets terminated by Windows. What I need is for the Perl script to stay alive long enough to log this event to a file before Windows finishes logging out. A Windows GUI program could intercept the WM_QUERYENDSESSION message it receives as Windows logs out, so it could have a few seconds to do what it needs to do before responding to the message that it is ready to terminate (cf. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/exitwindows.asp). Is there any similar functionality available in Perl or a module or would this require hacking the perl source? I didn't find anything after a search through CPAN and on the web. Thanks for any ideas, Garyl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Question to use SOAP::Lite
Hi, I would like to use SOAP::Lite to communicate with the web server, but I need to send the token to get the access. Does anyone know how to set up in SOAP::Lite? I have the following code, but I get the errorcode 1001, Request must have exactly one security token message back. Does anyone give me some hints? Thanks use SOAP::WSDL; use SOAP::Lite; my $soap=SOAP::WSDL-new( wsdl = 'http://172.16.230.101/ccws/ccws.asmx?WSDL' ); $soap-proxy( 'http://172.16.230.101/ccws/ccws.asmx'); $soap-wsdlinit; $soap-on_action(sub{'http://comverse-in.com/prepaid/ccws/RetrieveVoucherByB atchSerial'}); $serializer = SOAP::Serializer-envelope(method = 'security', SOAP::Header-name(Security= '')-attr({mustUnderstand='1'},{xmlns='http://schemas.xmlsoap.org/ws/2002/ 07/secext'}), SOAP::Header-name(UsernameToken = '')-attr({xmlns='http://schemas.xmlsoap.org/ws/2002/07/utility'}, {Id='SecurityToken-2b8987f9-37e4-47b1-9a4a-12415aef5735'}), SOAP::Header-name(Username = 'web'), SOAP::Header-name(Password = 'qwerty')-attr({'Type'='PasswordText'}), SOAP::Header-name(Nonce = '0AJuLu+MMip44x1Mv9S1fg=='), SOAP::Header-name(Created = '2004-09-17T21:05:38Z'), ); my $som=$soap-call( 'RetrieveVoucherByBatchSerial', batchNumber = '77000', serialNumber = '7120408'); if ($som-fault) { print \nfaultdetail:\n; print $som-faultdetail; print \nfaultcode:\n; print $som-faultcode; print \nfaultstring:\n; print $som-faultstring; print \nfaultactor:\n; print $som-faultactor; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Compiling and distributing Perl
Thanks for the reply, Jenda. (OS/arch is Solaris8/Sparc) The difficulty will be knowing exactly which files were added by a module install -- if I want to distribute per module. Otherwise, I guess I can just roll the updated site_perl directory structure. Yes? - Original Message - From: Jenda Krynicky [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 07, 2004 9:10 AM Subject: Re: Compiling and distributing Perl From: Karl Kaufman [EMAIL PROTECTED] Ok, I have a sane compiler toolset installed on my development server, but NOT on several servers on which I want Perl. (Where the development and production servers are the same architecture.) Can I build install Perl on my development server, and then just distribute it as a tarball to the production servers? Yes. If all servers are using the same OSarchitecture you should be able to do that. It would be better if you told us what architecture it is though. I can confirm that this does indeed work just fine for al kinds of MS Windows in Intel machines. To keep things simple you should keep the path to the instalation the same on all servers. Otherwise you may have to change some paths in Config.pm and maybe a few other places. What about installation of custom Perl modules? How can these be integrated into my custom distribution on the production servers without a compiler toolset on the production servers? Can they? Again ... if the OS architecture is the same you should be able to compile the modules on the dev server and then copy the results to the production ones. Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- 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
Question to use SOAP::Lite
Hi, I would like to use SOAP::Lite to communicate with the web server, but I need to send the token to get the access. Does anyone know how to set up in SOAP::Lite? I have the following code, but I get the errorcode 1001, Request must have exactly one security token message back. Does anyone give me some hints? Thanks use SOAP::WSDL; use SOAP::Lite; my $soap=SOAP::WSDL-new( wsdl = 'http://172.16.230.101/ccws/ccws.asmx?WSDL' ); $soap-proxy( 'http://172.16.230.101/ccws/ccws.asmx'); $soap-wsdlinit; $soap-on_action(sub{'http://comverse-in.com/prepaid/ccws/RetrieveVoucherByB atchSerial'}); $serializer = SOAP::Serializer-envelope(method = 'security', SOAP::Header-name(Security= '')-attr({mustUnderstand='1'},{xmlns='http://schemas.xmlsoap.org/ws/2002/ 07/secext'}), SOAP::Header-name(UsernameToken = '')-attr({xmlns='http://schemas.xmlsoap.org/ws/2002/07/utility'}, {Id='SecurityToken-2b8987f9-37e4-47b1-9a4a-12415aef5735'}), SOAP::Header-name(Username = 'web'), SOAP::Header-name(Password = 'qwerty')-attr({'Type'='PasswordText'}), SOAP::Header-name(Nonce = '0AJuLu+MMip44x1Mv9S1fg=='), SOAP::Header-name(Created = '2004-09-17T21:05:38Z'), ); my $som=$soap-call( 'RetrieveVoucherByBatchSerial', batchNumber = '77000', serialNumber = '7120408'); if ($som-fault) { print \nfaultdetail:\n; print $som-faultdetail; print \nfaultcode:\n; print $som-faultcode; print \nfaultstring:\n; print $som-faultstring; print \nfaultactor:\n; print $som-faultactor; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Compiling and distributing Perl
On 10/7/2004 2:43 PM, Karl Kaufman wrote: Thanks for the reply, Jenda. (OS/arch is Solaris8/Sparc) The difficulty will be knowing exactly which files were added by a module install -- if I want to distribute per module. Otherwise, I guess I can just roll the updated site_perl directory structure. Yes? From: Karl Kaufman [EMAIL PROTECTED] Ok, I have a sane compiler toolset installed on my development server, but NOT on several servers on which I want Perl. (Where the development and production servers are the same architecture.) Can I build install Perl on my development server, and then just distribute it as a tarball to the production servers? I think that there are configure and MakeMaker options to explicitly support what you are trying to do. This is what the package maintainers like dep and rpm use. But I've never really looked into it myself and I'm on a Windows box right now, so I can't easily check. Have you looked at all the options? Randy. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response