RE: using current date to make a filename
Actually, the format can vary from platform to platform, and might also depend on the user's regional settings. So, instead of trying to interpret that, use the array output. something like: my $trans_hash = ( 1='Jan', 2='Feb', 3='Mar', ...); my ($month, $day) = (localtime(time))[4,3]; $month++; my $filename = $day . $trans_hash{$month}; For more info, and to see why I did what I did, look at the perldocs for the 'localtime' function... HTH, Ricky -Original Message- From: Raj Subedi [SMTP:[EMAIL PROTECTED]] Sent: Thursday, November 15, 2001 11:24 AM To: [EMAIL PROTECTED] Subject: using current date to make a filename Hi, I would like to create a new file with a name that combines third and second column of scalar localtime. For e.g. printf scalar localtime; produces Thu Nov 15 10:26:15 2001 I actually want to create a file named 15Nov in differnt directory. Any help will be highly appreciated. Thanx Raj __ Do You Yahoo!? Find the one for you at Yahoo! Personals http://personals.yahoo.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: Need help with cli parameters
Faron Hopper wrote: I am running into a problem with input from the command line. I want to be able to call the program with an input of something like program.pl 10.1.1.1/30 and get it to process the information using the Net::IP module. It looks like when I am joing the pamarameters back together, and passing them to the function, it tries to divide the ip address by the mask. I really don't know what to do next. My searches through the documentation have not proven fruitful. Does anyone have any ideas? oh yeah, I'm running win2k with perl v5.6.1 build 629 code snip error === C:\Documents and Settings\fwh\My Documents\scripts\perlip-manip.pl 10.1.1.1/30 input ip = 10.1.1.1 input mask = 30 new val = 10.1.1.1/30 IP : 192.168.0.0 Short : 192.168.0.0 Bin : 110010101000 Int : 3232235520 Mask: 255.255.255.0 Last: 192.168.0.255 Len : 24 Size: 256 Type: PRIVATE Rev : 0.168.192.in-addr.arpa. Invalid prefix 101100010001/30 at C:\Documents and Settings\ fwh\My Documents\scripts\perl\ip-manip.pl line 24. Basically you're getting an error due to the IP address you are inputting. Try changing 10.1.1.1 to 10.0.0.0. The trailing part of the IP must be 0's when you supply a prefix. use Net::IP; my ($input_ip, $input_mask) = split '/', $ARGV[0] ? $ARGV[0] : '127.0.0.1'; print input ip\t = $input_ip\n; print input mask\t = $input_mask\n; my $new_val = join '', $input_ip, $input_mask ? /$input_mask : ''; print new val\t = $new_val\n; my $ip = Net::IP-new('192.168.0.0/24') or die Error: , Net::IP::Errno, (, Net::IP::Error(), )\n; print IP\t: . $ip-ip() . \n; print Short\t: . $ip-short() . \n; print Bin\t: . $ip-binip() . \n; print Int\t: . $ip-intip() . \n; print Mask\t: . $ip-mask() . \n; print Last\t: . $ip-last_ip() . \n; print Len\t: . $ip-prefixlen() . \n; print Size\t: . $ip-size() . \n; print Type\t: . $ip-iptype() . \n; print Rev\t: . $ip-reverse_ip() . \n\n; $ip = Net::IP-new($new_val) or die Error: , Net::IP::Errno, (, Net::IP::Error(), )\n; print IP\t: . $ip-ip() . \n; print Short\t: . $ip-short() . \n; print Bin\t: . $ip-binip() . \n; print Int\t: . $ip-intip() . \n; print Mask\t: . $ip-mask() . \n; print Last\t: . $ip-last_ip() . \n; print Len\t: . $ip-prefixlen() . \n; print Size\t: . $ip-size() . \n; print Type\t: . $ip-iptype() . \n; print Rev\t: . $ip-reverse_ip() . \n\n; __END__ -- ,-/- __ _ _ $Bill Luebkert ICQ=14439852 (_/ / )// // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /-- o // // http://dbecoll.tripod.com/ (Free site for Perl) -/-' /___/__/_/_ Castle of Medieval Myth Magic http://www.todbe.com/ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: using current date to make a filename
This should do it... ### use strict; my($sec,#retrieves current date/time elements $min,# $hours, # $mday, # $month, # month is relative to zero $year) = localtime();# my $mName=qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)[$month]; my $runlogname=c:\\temp\\.$mday.$mName..log; open (RUNLOG, $runlogname) or die can't create runlogerr; print RUNLOG Is this what you're looking for?\n; close RUNLOG; ### -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Raj Subedi Sent: Thursday, November 15, 2001 10:24 AM To: [EMAIL PROTECTED] Subject: using current date to make a filename Hi, I would like to create a new file with a name that combines third and second column of scalar localtime. For e.g. printf scalar localtime; produces Thu Nov 15 10:26:15 2001 I actually want to create a file named 15Nov in differnt directory. Any help will be highly appreciated. Thanx Raj __ Do You Yahoo!? Find the one for you at Yahoo! Personals http://personals.yahoo.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Off Topic: Email Question
This is a bit off-topic, but I would like the benefit of the expertise here on another question. I am tired of using Microsoft Outlook as my email/contacts/scheduling software (for a whole variety of reasons). I own Eudora, and could go back to that, but that only solves the email part of it. I am looking at Lotus Notes, which may be a solution. I was wondering if there is something from the wonderful world of unix/linux that may have been ported to Win32. Or perhaps, with Perl, it could all be done through scripts (I'm sure it could, but would it be a good idea). How do other people handle email and/or contacts/scheduling under Win32? TIA, Paul ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: How to go out from for loop if found some restrictions?
If after you find a restriction and want to get out, then use: last; Wags ;) -Original Message- From: Mark Remesnitskiy [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 15, 2001 12:30 To: [EMAIL PROTECTED] Subject: How to go out from for loop if found some restrictions? Hi, when I doing some check with for loop, and found restrictions, I want to leave loop before it finished. This is my script: $bRestrict = 1; for ($i2 = 3; (($i2 = ($#Record - 1)) or ($bRestrict == 0)); $i2++) { #Cheking multyword Names #for ($i2 = 3; ($i2 = ($#Record - 1)); $i2++) { #Cheking multiword Names open (DEBUG, 'c:\\mydocu~1\\Perl\\Temp\\debug.txt') or die Can't open debug.txt.\n; print (DEBUG Title $i2 is $Record[$i2]\n); print (DEBUG There is $#Record elements in record\n); print (DEBUG Checked to $_\n); print (DEBUG '$bRestrict is : ' . $bRestrict\n); close (DEBUG); if ($Record[$i2] =~ m/$_/) { #Found restrictions $bRestrict = 0; open (DEBUG, 'c:\\mydocu~1\\Perl\\Temp\\debug.txt') or die Can't open debug.txt.\n; print (DEBUG '$bRestrict is : ' . $bRestrict\n); print (DEBUG 'found restriction for: ' . $Record[$i2]\n\n); close (DEBUG); } #End of restrictions found } # End of Cheking multiword Names if ($bRestrict == 0) {last;} Logic or doesn't work for me in for clause, without or it run whole loop after restrictions found. Thanks, Mark ___ Visit http://www.visto.com. Find out how companies are linking mobile users to the enterprise with Visto. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
SQL y Perl (column's name of a table in a database)
Hello, I'm needing your help, I'm using SQL library for Microsoft SQL Server from perl, I have SQL Server 7, Perl 5.22 and windows NT Server 4.0 installed in my computer. I have tried to read from a perl cgi the column's names of a table which I have created in my database, and i get a wrong. what you see is my program's code: $dbh=MSSQL::DBlib-dblogin($user,$password,$server,$database); $status=$dbh-dbuse($database); $dbh-dbcmd(SELECT * FROM PROYECTO) ; $dbh-dbsqlexec() ; $dbh-dbresults() ; $cont=0; while($cont=$dbh-dbnumcols) { $string=$dbh-dbcolname($cont); print $string; $cont++; } $status=$dbh-dbcanquery; : : : It print a output with the column's name table but it ends with this error message DB-Library error: 10011 Column number out of range. I'd thanks your help Jackeline ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Looking for Win32::TieRegistry
PPM search tieregistry Packages available from http://www.ActiveState.com/PPMPackages/5.6: Win32-TieRegistry [0.23] Powerful and easy ways to manipulate a registry PPM -Original Message- From: Rob Lugton [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 15, 2001 7:50 PM To: [EMAIL PROTECTED] Subject: Looking for Win32::TieRegistry Hi all, I'm looking for the Win32::TieRegistry package. I've tried searching through PPM but it can't find it. Does anyone know if it been removed from the Repositry? If so, where can I get it from? Thanks in advance Rob -- Rob Lugton Software Test Engineer Computer Associates - Vet Anti-Virus Software PH: +61 3 9825 5635 Email: [EMAIL PROTECTED] __ __ This message and any attachments have been virus checked by Vet MailSafe ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Mod_Perl - Activestate Perl
Friends, I am trying to code a simple dynamic page using mod_perl. However I am not able to proceed anywhere. a) I installed Apache 1.3.22 on Windows 98 machine. b) I have ActiveState Perl 5.6 Build 629. c) I downloaded the mod_perl module via ActiveState PPM by setting the repository location to http://theoryx5.uwinnipeg.ca/ppmserver?urn:/PPMServer ) The PPM had downloaded and had run successfully the post-installation script. However, I have no clue or documentation to proceed further. Please help. Thanks, Rex ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Net:SMTP
Hi! I have this code and it works to send mail but I dont receive the message body. use CGI ':standard'; use Net::SMTP; $sever= 'mail.anyhost.com'; $from= '[EMAIL PROTECTED]'; $to= '[EMAIL PROTECTED]'; $subject= 'test'; $body='this is a test'; $objMail=Net::SMTP-new($server); $objMail-mail($from); $objMail-to($to); $objMail-data(); $objMail-datasend(Subject: $subject\n); $objMail-datasend(To: $to\n); $objMail-datasend(From: $from\n); $objMail-datasend($body); $objMail-datasend(); $objMail-quit; I have tried and tried and I cannot get the body of the message come out. Any help would be appreciated. Thank you in advance. Mauricio ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Looking for Config:IniFiles
Does anyone know where I can find a ppd for Config:IniFIles? I have a script that requires it. I have downloaded the tar.gz, but, being a newbie to Perl, down really know how to install the module without ppm. If it matters, I am running Perl 5.61. Output of perl -V follows: Summary of my perl5 (revision 5 version 6 subversion 1) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef use5005threads=undef useithreads=define usemultiplicity=define useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='cl', ccflags ='-nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX', optimize='-O1 -MD -DNDEBUG', cppflags='-DWIN32' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=8, usemymalloc=n, prototype=define Linker and Libraries: ld='', ldflags ='-nologo -nodefaultlib -release -libpath:"C:\Perl\lib\CORE" -machine:x86' libpth="C:\Perl\lib\CORE" libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release -libpath:"C:\Perl\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS Locally applied patches: ActivePerl Build 626 Built under MSWin32 Compiled at May 2 2001 01:31:15 @INC: C:/Perl/lib C:/Perl/site/lib . Thanks, jake Jake Brown, MCSE, CNE, BCIPChief ConsultantDravrahton Consultingwww.dravrahton.come. [EMAIL PROTECTED]p 512-695-6413
RE: Sort Hashes
Hashes by their very nature have no defined way in which you pull them out. I know that on one of the lists there was some type of module which would tie the keys to how they were inputted. Unforunately I don't have it. Depending on what you are trying to do, you could use an array where you would have [0][0] = Nombre [0][1] = p_nombre, etc If doing search, then combo of both array for order and has for getting at the data. I took a quick look using ppm looking for hash and around 21 items came up. Try it( search hash ) and maybe there is one that will be what you are after. Wags ;) -Original Message- From: Mauricio Lairet P. [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 15, 2001 18:51 To: [EMAIL PROTECTED] Subject: Sort Hashes Hi! First I want ot thak you for your soon responses. Now I have a new problem. Now with hashes. I have the following hash table and I would like it to be printed in the same oreder it is created but when I print it, it changes the order I put in the hash. How can I make this hash table to print in the same estict order that I have in the hash? %datos=( 'Nombre' = 'p_nombre', 'Dirección' = 'p_direccion', 'Ciudad' = 'p_ciudad', 'Estado' = 'p_estado', 'País' = 'p_pais', 'Código postal' = 'p_codigopostal', 'Teléfono' = 'p_telefono', 'Correo-e' = 'p_email' ) Thank you in advance, Mauricio ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Sort Hashes
From the EXCELLENT O'Reilly Perl Cookbook, pg 139: use Tie::IxHash; tie %HASH, Tie::IxHash; #add to %HASH... @keys = keys %HASH; #now @keys is in insertion order From: Wagner-David [EMAIL PROTECTED] To: 'Mauricio Lairet P.' [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: Sort Hashes Date: Thu, 15 Nov 2001 19:20:55 -0800 Hashes by their very nature have no defined way in which you pull them out. I know that on one of the lists there was some type of module which would tie the keys to how they were inputted. Unforunately I don't have it. Depending on what you are trying to do, you could use an array where you would have [0][0] = Nombre [0][1] = p_nombre, etc If doing search, then combo of both array for order and has for getting at the data. I took a quick look using ppm looking for hash and around 21 items came up. Try it( search hash ) and maybe there is one that will be what you are after. Wags ;) -Original Message- From: Mauricio Lairet P. [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 15, 2001 18:51 To: [EMAIL PROTECTED] Subject: Sort Hashes Hi! First I want ot thak you for your soon responses. Now I have a new problem. Now with hashes. I have the following hash table and I would like it to be printed in the same oreder it is created but when I print it, it changes the order I put in the hash. How can I make this hash table to print in the same estict order that I have in the hash? %datos=( 'Nombre' = 'p_nombre', 'Dirección' = 'p_direccion', 'Ciudad' = 'p_ciudad', 'Estado' = 'p_estado', 'País' = 'p_pais', 'Código postal' = 'p_codigopostal', 'Teléfono' = 'p_telefono', 'Correo-e' = 'p_email' ) Thank you in advance, Mauricio ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: SMTP
Before you issue the 'quit' method, you should instruct the server that you're not sending anymore data: $objMail-datasend($body); # Should it have a trailing \n ? $objMail-dataend(); # $objMail-quit;# -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Mauricio Lairet P. Sent: Thursday, November 15, 2001 6:20 PM To: [EMAIL PROTECTED] Subject: Net:SMTP Hi! I have this code and it works to send mail but I dont receive the message body. use CGI ':standard'; use Net::SMTP; $sever= 'mail.anyhost.com'; $from= '[EMAIL PROTECTED]'; $to= '[EMAIL PROTECTED]'; $subject= 'test'; $body='this is a test'; $objMail=Net::SMTP-new($server); $objMail-mail($from); $objMail-to($to); $objMail-data(); $objMail-datasend(Subject: $subject\n); $objMail-datasend(To: $to\n); $objMail-datasend(From: $from\n); $objMail-datasend($body); $objMail-datasend(); $objMail-quit; I have tried and tried and I cannot get the body of the message come out. Any help would be appreciated. Thank you in advance. Mauricio ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users