RE: Help connection to mysql database
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of zilore mumba Sent: 25 June 2013 23:04 To: activeperl@listserv.activestate.com Subject: Help connection to mysql database Excuse my total ignorance on the above subject. I am trying to access a mysql database via a perl script, and I came across the example below, but am not sure whether my are correctly filled (where marked below). I would appreciate assistance to clarify what should actually go into those fileds. The documentation for DBI and DBD::mysql will contain the information you want, and better examples. Better still for how-to's and examples is the book Programming the Perl DBI. Don't forget to 'use strict; use warnings;' in your script(s) and declare variables in the smallest scope necessary. Secondly when I run my script, it says $rv and $rc are used once. A variable that is only used once often indicates of a bug, hence the warning. In the case of the example that you came across, it is probably just poor programming. HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Please consider the environment before printing this email. Visit our website at http://www.nyse.com Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: cURL in ActiveState Perl
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of Kevin Holleran Sent: 11 April 2013 17:34 To: activeperl@listserv.ActiveState.com Subject: cURL in ActiveState Perl Good afternoon, Is there a cURL library for ActiveState perl? I am running ActiveState on a Win 2008 x64 system need to use cURL or wget or something to call a URL. I came across this: http://search.cpan.org/~sunnavy/Plient-0.03/lib/Plient.pm#DEPENDENCIES but it seems like this is a wrapper (though it lists no dependancies). I tried: ppm install WWW-Curl-Simple ppm install failed: Can't find any package that provides WWW-Curl-Simple Sounds like you are looking for LWP, which is part of the standard distribution, IIRC. Look at LWP::Simple to start with, and if that's not enough 'perldoc lwptut' and 'perldoc lwpcook' should help. HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: DBD::Oracle loaded by ppm does not work with Perl 5.14
-Original Message- From: activeperl-boun...@listserv.activestate.com [mailto:activeperl- boun...@listserv.activestate.com] On Behalf Of Fischer, RonaldX O Sent: 29 November 2012 15:16 To: activeperl@listserv.ActiveState.com Subject: DBD::Oracle loaded by ppm does not work with Perl 5.14 I have used previously Perl 5.8.8 on Windows 7, and now try to port the application to 5.14.2. The new Perl version is installed, the PATHes set up correctly. Next I used ppm to get the newest version of DBD::Oracle for this Perl version. According to ppm, this is version 1.52. I installed this version. However, when using the module, perl -we use DBD::Oracle qw(:ora_types); an error dialogue pops up, saying that OCI.dll is missing. After clicking OK, I get the error message Can't load 'c:/UserData/rofischx/p/perl_5.14.2/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:The specified module could not be found at c:/UserData/rofischx/p/perl_5.14.2/lib/DynaLoader.pm line 191. It is not clear, why OCI.dll is not found, or where it is supposed to be. However, when I set my PATH and PERL5LIB that it points to the Perl 5.8.8 installation on the same host, I don't see this error. Does environment variable ORACLE_HOME point to where you installed the Oracle client? HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: ActivePerl on OS X: ppm not working, no DBD::mysql PPM available
-Original Message- From: activeperl-boun...@listserv.activestate.com [mailto:activeperl- boun...@listserv.activestate.com] On Behalf Of Michiel Beijen Sent: 04 October 2012 08:54 To: activeperl@listserv.activestate.com Subject: ActivePerl on OS X: ppm not working, no DBD::mysql PPM available Hi, I just installed ActivePerl on OS X. When I set the PATH correctly and I started PPM; I saw a screen flash briefly and then crash. PPM on the command line works though. Also, there seems to be no PPM package for DBD-mysql on OS X available; even though DBD-mysql is, according to the PPM site, the most popular PPM package. http://code.activestate.com/ppm/DBD-mysql/ A quick look at the failed build logs found there suggest that mysql may not have been installed on the build box. Can't exec mysql_config: No such file or directory at Makefile.PL line 83. Perhaps somebody at Activestate could check that. Alternatively, if you have mysql installed you could try downloading the module from CPAN and building it yourself. The CPAN Testers Matrix (http://matrix.cpantesters.org/?dist=DBD-mysql+4.022) shows successful builds for OS X (Darwin). HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Odd warning w/ Mail::Header
-Original Message- From: activeperl-boun...@listserv.activestate.com [mailto:activeperl- boun...@listserv.activestate.com] On Behalf Of Philip Prindeville Sent: 12 September 2012 00:11 To: ActivePerl@listserv.ActiveState.com Subject: Odd warning w/ Mail::Header I'm running ActiveState Perl 5.14_02 on Win7 x64. I'm seeing: C:\Users\philipp\Desktop\scayl\agent\trunk\testsperl test001.pl Can't use string (From) as an ARRAY ref while strict refs in use at C:/Perl64/site/lib/Mail/Header.pm line 278. C:\Users\philipp\Desktop\scayl\agent\trunk\tests The $VERSION of Header.pm is 2.11. The line in question is: while(@$lines $lines-[0] =~ /^($FIELD_NAME|From )/o) I'm a little boggled by this warning. Anyone else seen it? I do no see this on Linux or MacOS with Perl 5.10 or 5.12, respectively. That line is in the extract function. You don't show any of your code, but the error message suggests that extract is being called with a string containing From, or possibly an array whose first entry is From, rather than an array ref, which it is clearly expecting. Clearly, that is, from the code rather than (IMHO) the documentation which just says array. If you think it important enough, feel free to suggest changes to the module's maintainer. Clarifying the documentation, and perhaps some parameter validation, may make it easier to use the module as intended. HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Known issues with Win32::OLE?
-Original Message- From: activeperl-boun...@listserv.activestate.com [mailto:activeperl- boun...@listserv.activestate.com] On Behalf Of Philip Prindeville Sent: 22 August 2012 22:52 To: ActivePerl@listserv.ActiveState.com Subject: Known issues with Win32::OLE? I was originally going to check the list archives before posting, but I get a 403 from pipermail on the website, so can't do that. I'm running ActiveState perl (community version) on Win7-x64 updated, and wrote the following simple/stupid test program. #!/usr/bin/perl -w use strict; use warnings; sub obj_cb($) { my $obj = shift; my $class = Win32::OLE-QueryObjectType($obj); printf STDERR %s=%s\n, $obj, $class; } my $count = Win32::OLE-EnumAllObjects(\obj_cb); printf STDERR count=%d\n, $count; exit 1; and running it (both as myself and as Administrator) I get: count=0 Anyone have a simple/stupid program that detects whatever programs are present that are manipulable via OLE? I'm trying to get up to speed on Win32::OLE so I can write some test- automation tools to exercise our products' GUIs. I may be missing something, but if you want to test a GUI, wouldn't something like Win32::GuiTest be more useful? -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Testing Success of Opening Pipe in Windows
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of Edwards, Mark (CXO) Sent: 12 August 2012 21:49 To: activeperl@listserv.activestate.com Subject: Testing Success of Opening Pipe in Windows The typical test for open is ... open(HANDLE, something _to_open) or die Open failed, $!; These days, a lexically scoped handle is recommended, e.g. open my $handle... That works on Windows for a file but not a pipe. $status=open(PIPE, hostname |); This works and I can read from the pipe but $status is always non-zero so I don't know whether it succeeds or fails. Even testing for $! or $? doesn't work. $? is always -1 and $! is always Inappropriate I/O control operation. This works as expected on Unix be how do I test for success or failure of opening the pipe? The first half of the code below works but I forced a failure on the second half Code use warnings; use strict; my($pid, $pipe); print Open pipe with real file\n; $pid=open(PIPE, hostname |); print(OS Error: $!\n); print(Child Error: $?\n); print(PID: $pid\n); print Host Name:, PIPE; close PIPE; print \n\n; print Open pipe with fake file to force a failure\n; $pid=open(PIPE, non_existent_file |); print(OS Error: $!\n); print(Child Error: $?\n); print(PID: $pid\n); print Host Name:, PIPE; close PIPE; Output === Open pipe with real file OS Error: Inappropriate I/O control operation Child Error: -1 PID: 10464 Host Name:MEDWARDS5 == Open pipe with fake file to force a failure OS Error: Inappropriate I/O control operation Child Error: -1 PID: 10468 'non_existent_file' is not recognized as an internal or external command, operable program or batch file. Host Name: Perl is executing the command in a subsidiary shell (as indicated by the 'not recognized' output from your fake file example, which comes from the child process), so strictly speaking the pipe open succeeds from perl's point of view. Note that the child process exit status ($?) will not be available until close has been called, which triggers the wait call. You could try validating the command before the open call, or possibly capturing stderr as well (21) and checking for error messages. See the Pipe Open section of 'perldoc opentut' for some other suggestions. HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: help regex replacement
Sorry to be a bit late to the party, but that does seem rather fragile. Also, from your original post, you seem to make hard work of formatting the date strings. The following suggestion adresses both points. use strict; use warnings; use constant {SECS_PER_DAY = 24 * 60 * 60}; use POSIX qw{strftime}; my $startDate = strftime %Y-%m-%d_, localtime(); my $endDate = strftime %Y-%m-%d_, localtime(time + 2 * SECS_PER_DAY); my $dateRE = qr{\d{4}-\d{2}-\d{2}_}; while (my $line = DATA) { if ($line =~ m/^start_date/) { $line =~ s/$dateRE/$startDate/g; } elsif ($line =~ /^end_date/) { $line =~ s/$dateRE/$endDate/g; } print $line; } __DATA__ First line start_date = '2012-04-29_00:00:00', '2012-04-29_00:00:00', '2012-04-29_00:00:00', end_date = '2012-05-01_00:00:00', '2012-05-01_00:00:00', '2012-05-01_00:00:00', Last line HTH -- Brian Raven From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of zilore mumba Sent: 01 May 2012 08:22 To: zilore mumba; $Bill Luebkert Cc: activeperl@listserv.ActiveState.com Subject: Re: help regex replacement Thanks very much all who spent precious time looking at my problem. Below is how I got round the problem, i.e. the first three lines are not to be changed hence copied as they are. Then the lines with 'start_date' and end_date are inserted and then the rest of the file is copied unchanged. I really appreciate the spirit of assisting. Zilore * # open input and output files. * * open (IN, namelist.wps.dailyGFS) or die open 'namelist.wps.dailyGFS: failed $! ($^E); * open (OUT, namelist.wps) or die open 'namelist.wps: failed $! ($^E); * * print OUT scalar(IN) for 1..3; * print OUT start_date = '${syear}-${smonth}-${sday}_00:00:00','${syear}-${smonth}-${sday}_00:00:00','${syear}-${smonth}-${sday}_00:00:00',\n; * print OUT end_date = '${eyear}-${emonth}-${eday}_00:00:00','${eyear}-${emonth}-${eday}_00:00:00','${eyear}-${emonth}-${eday}_00:00:00',\n; * print scalar(IN); * print scalar(IN); * print OUT scalar(IN) for 6..37; * close IN; * close OUT; ** From: zilore mumba zmu...@yahoo.commailto:zmu...@yahoo.com To: zilore mumba zmu...@yahoo.commailto:zmu...@yahoo.com; $Bill Luebkert dbec...@roadrunner.commailto:dbec...@roadrunner.com Cc: activeperl@listserv.ActiveState.commailto:activeperl@listserv.ActiveState.com activeperl@listserv.ActiveState.commailto:activeperl@listserv.ActiveState.com Sent: Tuesday, May 1, 2012 12:43 AM Subject: Re: help regex replacement T add a bit more precision, the lines must appear as they are because the program which reads the file will look for start_date=followed by the date. I was looking, in perl, for something like replace line starting in, say /^start_date .. and ending in ...'2012-04-29_00:00:00',$/ I hope this is possible. Zilore From: zilore mumba zmu...@yahoo.commailto:zmu...@yahoo.com To: $Bill Luebkert dbec...@roadrunner.commailto:dbec...@roadrunner.com Cc: activeperl@listserv.ActiveState.commailto:activeperl@listserv.ActiveState.com activeperl@listserv.ActiveState.commailto:activeperl@listserv.ActiveState.com Sent: Tuesday, May 1, 2012 5:31 AM Subject: Re: help regex replacement Thanks very much Bill, and also for the assistance to me over the years. Your suggestion does not do exactly what I want to do. The start_date and end_date are in a file, in the middle of other text. The idea is to replace daily the year,month and day to the current year,month and dayand on end_date to replace to tomorrow or after tomorrow, The fields may appear twice or yhree times because the model has nests in it which all use the same times. I hope this is clear. From: $Bill Luebkert dbec...@roadrunner.commailto:dbec...@roadrunner.com To: zilore mumba zmu...@yahoo.commailto:zmu...@yahoo.com Cc: activeperl@listserv.ActiveState.commailto:activeperl@listserv.ActiveState.com activeperl@listserv.ActiveState.commailto:activeperl@listserv.ActiveState.com Sent: Tuesday, May 1, 2012 12:02 AM Subject: Re: help regex replacement On 04/30/2012 14:28, zilore mumba wrote: sample input start_date = '2012-04-29_00:00:00','2012-04-29_00:00:00','2012-04-29_00:00:00', end_date = '2012-05-01_00:00:00','2012-05-01_00:00:00','2012-05-01_00:00:00', The model would have run on 29th May, to produce a 48hour forecast to 1sr May 2012. When I run it on 30th May it should produce a 48hour forecast to 2nd May, i.e. change the entries above so that start_date is 30th and end_date is 2nd May as below. start_date = '2012-04-30_00:00:00','2012-04-30_00:00:00','2012-04-30_00:00:00', end_date
RE: Inline test data
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl- boun...@listserv.activestate.com] On Behalf Of Phillip Richcreek Sent: 02 May 2012 14:56 To: activeperl@listserv.activestate.com Subject: Inline test data A recent post used a nice feature for providing test data to a script. (See __DATA__ below) I've seen it before but never understood it. How does it work? What signals the end of the data to the while (my $line = DATA) { ? Is this a type of here document? Can someone point me where it's descibed in the perl doc? That's a good question. It took me a while to find it, but see the Special Literals section in 'perldoc perldata'. The __DATA__ is just a marker to tell the perl compiler that there is no more code after this point. The DATA file handle is the same one used by the compiler when it stopped parsing (or a duplicate), so the next read will be the first line after __DATA__. You can read all the way to the end of the source file. In fact you can rewind (perldoc -f seek) the DATA file handle and read the script from the beginning, if you want. For (a trivial) example... use strict; use warnings; seek DATA, 0, 0; while (DATA) { print; } __DATA__ HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: BAT scripts in bin\ directory
-Original Message- From: activeperl-boun...@listserv.activestate.com [mailto:activeperl- boun...@listserv.activestate.com] On Behalf Of Michael Ludwig Sent: 25 February 2012 10:33 To: activeperl@listserv.activestate.com Subject: BAT scripts in bin\ directory There are lots of BAT scripts in the distribution's bin\ directory. They mostly (or exclusively) contain a copy of the homonymous Perl script, plus the following: C:\Opt\Perl512.32\bin :: diff pwhich pwhich.bat 0a1,12 @rem = '--*-Perl-*-- @echo off if %OS% == Windows_NT goto WinNT perl -x -S %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl :WinNT perl -x -S %0 %* if NOT %COMSPEC% == %SystemRoot%\system32\cmd.exe goto endofperl if %errorlevel% == 9009 echo You do not have Perl in your PATH. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2nul goto endofperl @rem '; 1a14 #line 15 141a155,157 __END__ :endofperl (Useful script, by the way - try pwhich -a perl to see all perls.) My question is: Do the BAT scripts contain a copy of the Perl script to be backward- compatible with some old version of cmd.exe ? Because at least with a current cmd.exe you could simply do the following to call Perl with a script of the same name as the BAT file (like foo.bat - foo.pl): @CALL %~dp0perl.exe %~dpn0.pl Or just: @CALL perl.exe %~dpn0.pl Which would use (I think) a perl.exe installed in the same directory as the BAT script. See CALL /? in cmd.exe . I'm using this feature a lot since I've discovered it. The idea is that the file is both a valid batch script and a valid perl script. Many are probably the result of running pl2bat.bat on a Perl script. The documentation in that file (See 'perldoc pl2bat') may answer your questions. Also, I am not a win32 expert, but isn't the call command intended for executing one batch file from another, rather than executing a program? HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Post here or ActiveState Form?k
-Original Message- From: activeperl-boun...@listserv.activestate.com [mailto:activeperl- boun...@listserv.activestate.com] On Behalf Of Phillip Richcreek Sent: 27 February 2012 15:32 To: activeperl@listserv.ActiveState.com Subject: Post here or ActiveState Form?k I'm wondering whether it's more effective to post here than at the ActiveState Forum or vice versa? I assume it's considered bad form to post the same question in both places? I may be missing something, but it's not clear what you mean. I would describe this mailing list as an activestate forum. To what other forum are you referring? As long as your question was on topic for both fora, and one was not a mirror of the other, I wouldn't expect that posting to both would be a problem. -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Problem with Win32::OLE
-Original Message- From: activeperl-boun...@listserv.activestate.com [mailto:activeperl- boun...@listserv.activestate.com] On Behalf Of Francisco Zarabozo Sent: 22 February 2012 18:21 To: j...@activestate.com; Active State Perl Mailing List Subject: Problem with Win32::OLE Hello Jan! I thought about sending this question to the ActivePerl mailing list but then I noticed you’re actually the author of Win32::OLE module, so, although I’m still sending the message to the mailing list and I’ll really appreciate any answer from other people here, I want to directly ask you about this problem. I need to access some functionality of a C# assembly DLL. Such DLL can be referenced in any .NET project but is not COM visible. So, I thought about writting a new .NET project that references that DLL and makes its methods COM visible. For that, I started by following the simple example you can see on the following page to creating COM registered assemblies: http://generally.wordpress.com/2006/07/28/exposing-your-net-assembly- through-com/ It seems to have worked perfectly. I can access the new COM object from the VB script they create there as a test. However, I can’t use Win32::OLE to access it. By using the following code: my $w = new Win32::OLE 'COMExample.Example'; print Win32::OLE- LastError(); I get the following output: Win32::OLE(0.1709) error 0x80070002: “The system cannot find the file specified”. (note that is not about not finding the class in the system - when not finding it it returns a different error) I’m working on a Windows 7 Ultimate x64 machine, with Active Perl 5.12 x64 and Visual Studio Professional 2010 (using the “all CPUs” configuration in C#). Do you have any clue of what might be wrong here? Did you look at Win32::Api? It might have been better way to go if you just wanted to call execute a function in a DLL. HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: getting a file name
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of John DePasquale Sent: 20 February 2012 07:05 To: activeperl@listserv.ActiveState.com Subject: getting a file name Hi all, I am unable to get a full file name ( including path ) from a form. I'm using input id=filename type=file name=filename in the form. In the perl code I've tried using both of the following: 1: my $cFile = substr( CGI::param( 'filename' ), 0, 100 ); 2: my $cgi = new CGI(); my $cFile = $cgi-param('filename'); the html presents me with a browse button, and when I select a file via the browse I end up with the string c:\images\file.jpg in the input box. However, I only get file.jpg assigned to the variable $cFile. I am unable to acquire the entire value ( i.e. c:\images\file.jpg ), even though that entire string is appearing in the input box after the file is selected via the browse button. I'm guessing I'm missing something simple and I've tried to track down an answer, but I'm stuck. Any help is appreciated. Thank you. I don't think that this is a Perl problem. Your script is simply reporting the data as it was presented by the browser. As I understand it, that type of input field is normally used for uploading files, so only the file name is needed, not the full path. There may be a good reason for your browser to behave that way, such as security. You may stand a better chance of getting help in a forum that specialises in browser/html/cgi issues. HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: help formatting string
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of zilore mumba Sent: 10 February 2012 17:33 To: 'Active State Perl Mailing List' Subject: help formatting string Please help with some very simple code below which somehow I a, not getting right. I have strings consisting of $day, $month, $year, $hour, $min, followed by some float values which I call @rain, as in the attached file 'text1.txt'. I want rewrite this data as $year, $month, $day, $hour, $min, @rainin as in 'text2.txt', but with the date also formatted to have one space between each field Help will be appreciated. Zilore #!/usr/bin/perl -w use strict; use warnings; open (IN, text1) or die open 'text1' failed: $!\n; open (OUT, $text2) or die open 'text1' failed: $!\n; # Copy first 3 lines unchanged. print OUT scalar(IN) for 1..3; # Reformat the numbers on each remaining line. while (IN) { my ($month,$day,$year,$hour,$min,@rain) = split; # printf (%04d%02d%02d%02d%02d\n,$year,$month,$day,$hour,$min); $_ = sprintf %5.1f, $_ foreach @rain; print OUT ($year,$month,$day,$hour,$min, join( , @rain), \n); Did you mean like ... print OUT join( , $year,$month,$day,$hour,$min, @rain), \n; } # Close files close IN or die close IN: $!\n; close OUT or die close OUT failed: $!\n; } HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Using Parallel::ForkManager with ActivePerl
-Original Message- From: activeperl-boun...@listserv.activestate.com [mailto:activeperl- boun...@listserv.activestate.com] On Behalf Of Octavian Rasnita Sent: 07 January 2012 18:45 To: activeperl@listserv.ActiveState.com Subject: Using Parallel::ForkManager with ActivePerl Hi, In the POD documentation of Parallel::ForkManager I read that it can share the $dbh db handle among threads, but when I tried it with ActivePerl, it gave the following error: DBD::mysql::db clone failed: handle 2 is owned by thread 2944fc not current thread 24475cc (handles can't be shared between threads and your driver may need a CLONE method added) at... Does this happen because Perl can't use threads under Windows, but only a kind of fork() as pseudo threads? ...although, Parallel::ForkManager docs say that it can also work with fork. I think you have that the wrong way round. Fork is implemented on win32 using threads, which would explain the thread references in the error message. I could be wrong, but I can't imagine why using the same database connection in parallel processes/threads would be a good idea, even if it were possible. Could be very messy. Also, see the 'perldoc DBI' section on threads and thread safety. Thanks. Octavian ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: reverse of modulo (inverse?)
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of deane.rothenma...@walgreens.com Sent: 14 June 2011 14:39 To: activeperl@listserv.ActiveState.com Subject: reverse of modulo (inverse?) Greetings. I'm not having much luck finding this, and it's been a long time since college math, so I thought I'd throw it at you folks and cross my fingers... I'm looking for an algorithm that reverses the modulo function. That is, if x = y % 256, given x, what is y? That's not possible, because you have discarded necessary information. Broader picture is, I'm trying to back-figure a site number from an IP address. E.g., given number x = 12345, the IP's middle octets ( x/256 and x%256 respectively) come out to 48 and 57 . Is there an algorithm I can put the numbers 48 and 57 into and have 12345 come out? Well, that's a different question (assuming that I have understood the last paragraph). If you have both x/256 and x%256, and you know the modulus/divisor was 256, then you have enough to reconstruct the original. For example ... use strict; use warnings; my $mod = 256; for my $x (@ARGV) { my $o1 = int($x / $mod); my $o2 = $x % $mod; my $orig_x = $o1 * $mod + $o2; print Starting with x=$x and mod=$mod, o1=$o1 o2=$o2, reconstructed x=$orig_x\n; } HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Stupidity on my side - readdir(), chdir() ..
-Original Message- From: Francisco Zarabozo [mailto:fzarab...@hotmail.com] Sent: 30 March 2011 01:13 To: Brian Raven; activeperl@listserv.ActiveState.com Subject: Re: Stupidity on my side - readdir(), chdir() .. From: Brian Raven bra...@nyx.com Sent: Tuesday, March 29, 2011 11:16 AM Also, if using or which has lower precedence than ||, you don't need the brackets. Wow. Everyday you can learn something new just by reading these posts. :-) I was under the impression that using || or or was just a matter of preference. I suppose the same applies for using or and. Yes indeedy. See 'perldoc perlop'. HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: PERL5LIB env variable import possibly broken for large contents on Win32? ( Was: Re: Your CPAN smoker is misconfigured? )
-Original Message- From: activeperl-boun...@listserv.activestate.com [mailto:activeperl- boun...@listserv.activestate.com] On Behalf Of Christian Walde Sent: 30 March 2011 09:55 To: p...@0ne.us Cc: CPAN Testers Discuss; 'p5p'; activeperl@listserv.activestate.com Subject: PERL5LIB env variable import possibly broken for large contents on Win32? ( Was: Re: Your CPAN smoker is misconfigured? ) On Wed, 30 Mar 2011 02:22:32 +0200, p...@0ne.us p...@0ne.us wrote: Hello, I just got this FAIL report today from CPANTesters: http://www.cpantesters.org/cpan/report/0ee8eb99-6c5d-1014-a630- 0d8a02da96e1 As you can see, the prereq is correctly recognized by the toolchain and loaded - it's even in the lengthy @INC list, BUT when executing the test script it seems like @INC disappears somehow? Since I don't know the details of your setup I have to assume something is broken. Can you verify that it's not a problem with just my module? There's no easy way to search the cpantesters database for all of your reports so I can check to see if you've been sending bad FAILs or not. Can you please test my module by hand to see if it really works? Thanks! I suspect it's something to do with MSWin32 limitations, as I have received several other FAILs in the past with the same symptoms as this one. However, as I don't have access to a box now I can't quickly test my theory out. I have sent an email to the list several weeks ago but seems like everyone was busy :( The subject was Weird failures from smokers on MSWin32? Thanks again for your assistance with this and again, BIG THANKS for running a smoker! :) ~Apocalypse I reproduced this case and it seems that this might actually be a Perl bug. Situation is as follows: My CPAN is still 1.9402 and configured to reuse_build_dir. This means that in order to run a test on a module, it will throw *all* the build dirs in ~/.cpan/build into $ENV{PERL5LIB}, which i understand is added to @INC by the perl executable itself. ( http://perldoc.perl.org/perlrun.html#ENVIRONMENT ) Reproduction thus was relatively easy: Stop the smoker, run cpan, `look` at an affected dist, in my example Params::Classify and `make test`. In order to make the output more useful i added debug statements to CPAN.pm and gutted the test suite of Params::Classify, replacing it with a single test that tries to use the module and dumps environment and INC information. Here's the output: https://gist.github.com/893981 Of note: The test ( https://gist.github.com/893981#L225 ) clearly has a whole battery of directories in $ENV{PERL5LIB} ( https://gist.github.com/893981#L247 ) which the perl executable can obviously see, including the Params::Classify dir as the very first; since that's a Data::Dumper output of %ENV. However @INC remains unchanged by that. ( https://gist.github.com/893981#L579 ) This seems to indicate to me that the perl executable itself is, for whatever reason, flat out ignoring the PERL5LIB and/or failing to inject it into @INC. Other possibilities include Module::Build messing things up or the Windows Perl executable exclusively having issues. I do not know how to further pursue this issue, but will happily provide any assistance needed in digging deeper into this. (And for now will try to at least follow up bugs FAIL reports with proper PASSes by periodically cleaning out /build and removing fails from my reports-sent.db.) I don't know if this is your problem, but a bit of googling found this. http://support.microsoft.com/kb/830473 Especially the part about cmd ignoring variables that are longer than its limit. HTH P.S. I have not replied to the lists that don't know me from Adam. -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: PERL5LIB env variable import possibly broken for large contents on Win32? ( Was: Re: Your CPAN smoker is misconfigured? )
-Original Message- From: Christian Walde [mailto:mitha...@yahoo.de] Sent: 30 March 2011 10:40 To: activeperl@listserv.activestate.com; Brian Raven Subject: Re: PERL5LIB env variable import possibly broken for large contents on Win32? ( Was: Re: Your CPAN smoker is misconfigured? ) On Wed, 30 Mar 2011 11:30:59 +0200, Brian Raven bra...@nyx.com wrote: Of note: The test ( https://gist.github.com/893981#L225 ) clearly has a whole battery of directories in $ENV{PERL5LIB} ( https://gist.github.com/893981#L247 ) which the perl executable can obviously see, including the Params::Classify dir as the very first; since that's a Data::Dumper output of %ENV. However @INC remains unchanged by that. ( https://gist.github.com/893981#L579 ) This seems to indicate to me that the perl executable itself is, for whatever reason, flat out ignoring the PERL5LIB and/or failing to inject it into @INC. Other possibilities include Module::Build messing things up or the Windows Perl executable exclusively having issues. I don't know if this is your problem, but a bit of googling found this. http://support.microsoft.com/kb/830473 Especially the part about cmd ignoring variables that are longer than its limit. HTH P.S. I have not replied to the lists that don't know me from Adam. At first i thought that was the case too. But the fact that the perl executable knows that value is in %ENV makes me think it's something else going on, as i'd expect that to be empty as well then. Maybe so, but spawning a sub process with large environment variables does seem to cause problems. For example, running the following ... - use strict; use warnings; my $var = SOMEVAR; my $check = check; my $addthis = x x 500; if (@ARGV 0) { if ($ARGV[0] eq $check) { print $var is , length($ENV{$var}), bytes long\n; } else { print What '$ARGV[0]'?\n; } } else { for my $i (1..1000) { $ENV{$var} .= ;$addthis$i; system perl $0 $check; #system cmd /c perl $0 $check; exit if $?; } } - ... on an XP box, ends as follows... SOMEVAR is 27153 bytes long SOMEVAR is 27656 bytes long SOMEVAR is 28159 bytes long SOMEVAR is 28662 bytes long Can't spawn cmd.exe: No such file or directory at t4.pl line 19. The contents of PERL5LIB in your link seems to be 46647 bytes long. The link I gave mentions that the win32 limit is 32767. This would suggest that it is unlikely that perl inherited an environment variable that long from its parent process. It seems more likely that perl constructs PERL5LIB, but fails to pass it on to a child process. Of course, I could be wrong. HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Stupidity on my side - readdir(), chdir() ..
-Original Message- From: activeperl-boun...@listserv.activestate.com [mailto:activeperl- boun...@listserv.activestate.com] On Behalf Of Ken Slater Sent: 28 March 2011 21:06 To: 'Claus Kick'; activeperl@listserv.ActiveState.com Subject: RE: Stupidity on my side - readdir(), chdir() .. ... use lexical file handles three argument form of open open (FILE, , $list) or die cannot open file: $^E; open (FILE, .$list) or die cannot open file; A bit of a typo, I think. With a lexical file handle, that should look something like... open my $fh, , $list or die ... Also, if using or which has lower precedence than ||, you don't need the brackets. Other than that, ++$what_he_said; HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Please, someone explain this behavior in Perl
-Original Message- From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of Francisco Zarabozo Sent: 04 February 2011 17:26 To: activeperl@listserv.activestate.com Subject: Please, someone explain this behavior in Perl Hello All, Right now I'm using Active Perl 5.10.1. I've been working with Perl for more than 10 years. Yet, today is the first time I notice this wierd thing. Maybe I ignore something about how Perl's math works, yet it's driving me crazy. I can't believe this is the first time I notice this and makes me wonder how many applications I've written in the past that are actually doing this without me knowing about it. I'm talking about this: print 1.1 - 1; # Gives 0.1 print \n; print 2.1 - 2; # Gives 0.1 print \n; print 3.1 - 3; # Gives 0.1 print \n; print 4.1 - 4; # Gives 0.0996 ??? print \n; print 6.2 - 6; # Gives 0.2 print \n; print 7.2 - 7; # Gives 0.2 print \n; print 8.2 - 8; # Gives 0.199 ??? print \n; Why is this? Thanks in advance. Sounds like a FAQ. See 'perldoc -q numbers'. HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Where's Tk?
-Original Message- From: Sisyphus [mailto:sisyph...@optusnet.com.au] Sent: 16 December 2010 22:26 To: Brian Raven; activep...@activestate.com; perl-win32-us...@activestate.com Subject: Re: Where's Tk? - Original Message - From: Brian Raven bra...@nyx.com To: activep...@activestate.com; perl-win32-us...@activestate.com Sent: Friday, December 17, 2010 12:02 AM Subject: Where's Tk? I have Activestate Perl 5.12.2 (build 1202) installed. I can see some Tk extension packages in the PPM gui, but no sign of Tk itself. Is there a problem, or is just me looking in the wrong place? There's a ppm package for Tk-804.029 at the bribes repo. You should be able to grab it with: ppm repo add bribes then ppm install Tk I had already added the bribes repository, but ppm (gui and command line) reports zero packages. However a fully qualified manual install, as suggested on the bribes web site, i.e. ppm install http://www.bribes.org/perl/ppm/Tk.ppd worked just fine. Tk is now installed. Thanks to Sysyphus for the pointer, and to everybody else that responded. -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Where's Tk?
-Original Message- From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of Brian Raven Sent: 17 December 2010 17:25 To: Sisyphus; activep...@activestate.com; perl-win32-us...@activestate.com Subject: RE: Where's Tk? ... I had already added the bribes repository, but ppm (gui and command line) reports zero packages. However a fully qualified manual install, as suggested on the bribes web site, i.e. ... Just a quick follow-up. I deleted the bribes repo from ppm and added it again. My ppm now sees the packages in the bribes repo. Whatever was stopping it before seems to have gone away now. -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Where's Tk?
I have Activestate Perl 5.12.2 (build 1202) installed. I can see some Tk extension packages in the PPM gui, but no sign of Tk itself. Is there a problem, or is just me looking in the wrong place? -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: timelocal question
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of deane.rothenma...@walgreens.com Sent: 08 October 2010 16:25 To: activeperl@listserv.ActiveState.com Subject: timelocal question Just for my information... the POD for Time::Local::localtime specifies the epoch for UNIX as Midnight, Jan.1, 1970 GMT. What's the epoch for Windoze? Is it the same? I can't seem to find this little gem anywhere... You could always ask perl... perl -MPOSIX=strftime -e print strftime(qq{%Y-%m-%d %H:%M:%S\n}, localtime(0)) HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Restoring Dumped Values
Eric Robertson wrote: -Original Message- From: Bill Luebkert [mailto:dbec...@roadrunner.com] Sent: 27 September 2010 03:01 To: Eric Robertson Cc: activeperl@listserv.ActiveState.com Subject: Re: Restoring Dumped Values On 9/26/2010 3:12 PM, Eric Robertson wrote: I've produced a complicated hash that has as its values anonymous hashes and I want to store the hash in a text file and then in another program use this text file to reconstitute the original hash. Using Data::Dumper I've succeeded with the first part and produced the text file with 'print OUT Dumper (%hash)' but using eval with the contents of the file doesn't reproduce the original hash file. Am I attempting the impossible, or if not how should I set about reconstituting to the original hash? Maybe try Storable (store retrieve / freeze thaw). No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.856 / Virus Database: 271.1.1/3160 - Release Date: 09/26/10 08:01:00 Bill That's great - Storable works a treat with the kind of hash I have, so I'll be using that as a link between the two parts of the programs I'm writing. Bill's suggestion of Storable is a good one, I have used it to good effect myself in the past. There are a couple of things you may want to give consideration to, though. I did have a problem when I upgraded Storable and it couldn't the file from the previous version because the file format had changed. So you need to have good control of which version(s) of Storable that you are using, and take care when upgrading. Also, and it may be stating the obvious, the Storable file format is binary, and a human readable form would have been useful in the situation described. A human readable format is also useful for debugging, and can easily be fixed by a bit of hand editing. I have also had good results using Data::Dumper for the same purpose. You don't seem to have provided any code, so I can't say what your problem was, but I am guessing that you used Data::Dumper with no config settings, which are often required if you intend to eval the output. For example $Data::Dumper::Purity. (See 'perldoc Data::Dumper' for more). Then again, I have also written code to produce Data::Dumper-like output when I wanted more control over the order and format of the output. Which, not surprisingly for Perl, wasn't that difficult either. But if Storable does everything you need, then that is probably the simplest solution to implement. HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Reading a line as an array
zilore mumba wrote: Excuse me for the missing attachments. As I composed the mail in gmail which is not recognised on the mailing list. The attachments are now included. The main problem with your code, in addition to Jusin's point about file handle naming, is with the line: my @rain = OUT; which reads the rest of the file into the array @rain, which is clearly not what you intend. The following seems to do what you are asking about. - use strict; use warnings; # You might want to initialise the file names from the command line. my $in_fn = sample.txt; my $out_fn = sample_tr.txt; # The preferred open is the 3 arg method with a localised file handle. open my $infd, , $in_fn or die open $in_fn failed: $!\n; open my $outfd, , $out_fn or die open $out_fn failed: $!\n; # Copy first 7 lines unchanged. print $outfd scalar($infd) for 1..7; # Reformat the numbers on each remaining line. while ($infd) { my ($year, $month, @rain) = split; $_ = sprintf %.02f, $_ foreach @rain; print $outfd \t$year $month\t, join(\t, @rain), \n; } # Close files. Don't forget that closing an output file can fail. close $infd; close $outfd or die close $out_fn failed: $!\n; --- HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Reading a line as an array
zilore mumba wrote: Hello Perl Community, This mail was posted on gmail but may have been vetted by the moderator. firstly my apologies for 1) a very basic question, 2) something I should do in C. 1. I have rainfal data (attached as sample.txt) month by month in mixed float and integer which I cannot handle in fortran. I need to first rewrite the data all in real (float) before I can use fortran. 2. The perl script I have written read line by line, but then how do I split the line into 31 values? 3. as it is, the script rewrites each line and does not change any int into float, I tried printf (with format) it doesn't work. Is it possible? Assistance will be appreciated. I couldn't see any sign of your sample data. It would also make it easier to help if you showed your code as well. HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Exchange 2003 replica list via WMI
Conor Lillis wrote: Hi all, I am hoping for some assistance in trying to enumerate Exchange 2003 public folder replication partners using Perl and WMI. I can enumerate all information I am trying to retrieve except the ReplicaList property, and can see that the query returns data, but when I try to enumerate it I get no usable output. I have included my snippet below, and the output below that. foreach my $host(sort @hosts) { chomp($host); print \n.gmtime().\tRetrieving Public folder sizes on $host\n; my $OLECon = Win32::OLE-GetObject(winmgmts:$host\\root\\MicrosoftExchangeV2)|| die Cannot access WMI on remote machine: $host,Win32::OLE-LastError; my $PublicFolders = $OLECon-ExecQuery(Select * From Exchange_PublicFolder) or die WMI Query Failed!\n; foreach my $PublicFolder(in $PublicFolders) { $PF1=$PublicFolder-AddressBookName; $PF2=$PublicFolder-TotalMessageSize/1024; $PF3=$PublicFolder-MessageCount; $PF4=$PublicFolder-Path; my $ReplicaList = $PublicFolder-ReplicaList; my $ReplicaList = $PublicFolder-ReplicaList; print Replica Array = $ReplicaList\n; # Treat as text foreach my $replica(@ReplicaList ) {print Replica $replica\n;} # Treat as array foreach my $key(sort keys %ReplicaList) {print Key is $key\tValue is $ReplicaList{$key}\n;}# Treat as hash } } exit; Thu Jul 22 12:53:01 2010Retrieving Public folder sizes on [Exchange server] Thu Jul 22 12:59:07 2010Working on pub folder [public folder] Replica Array = ARRAY(0x9ead7d4) That is telling you that you have a reference to an array, so you need to dereference it. Try the following: foreach my $replica(@$ReplicaList ) { #^ print Replica $replica\n; } See 'perldoc -f perlreftut' and 'perldoc perlref'. Also, your code suggests that you may not have 'use strict;' at the start of your script, at least the code you supply would not compile if it was there. It's a good idea to always to have that, and 'use warnings;' at the start of every script. HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Exchange 2003 replica list via WMI
Brian Raven wrote: Conor Lillis wrote: Hi all, I am hoping for some assistance in trying to enumerate Exchange 2003 public folder replication partners using Perl and WMI. I can enumerate all information I am trying to retrieve except the ReplicaList property, and can see that the query returns data, but when I try to enumerate it I get no usable output. I have included my snippet below, and the output below that. foreach my $host(sort @hosts) { chomp($host); print \n.gmtime().\tRetrieving Public folder sizes on $host\n; my $OLECon = Win32::OLE-GetObject(winmgmts:$host\\root\\MicrosoftExchangeV2)|| die Cannot access WMI on remote machine: $host,Win32::OLE-LastError; my $PublicFolders = $OLECon-ExecQuery(Select * From Exchange_PublicFolder) or die WMI Query Failed!\n; foreach my $PublicFolder(in $PublicFolders) { $PF1=$PublicFolder-AddressBookName; $PF2=$PublicFolder-TotalMessageSize/1024; $PF3=$PublicFolder-MessageCount; $PF4=$PublicFolder-Path; my $ReplicaList = $PublicFolder-ReplicaList; my $ReplicaList = $PublicFolder-ReplicaList; print Replica Array = $ReplicaList\n; # Treat as text foreach my $replica(@ReplicaList ) {print Replica $replica\n;}# Treat as array foreach my $key(sort keys %ReplicaList) {print Key is $key\tValue is $ReplicaList{$key}\n;} # Treat as hash } } exit; Thu Jul 22 12:53:01 2010Retrieving Public folder sizes on [Exchange server] Thu Jul 22 12:59:07 2010Working on pub folder [public folder] Replica Array = ARRAY(0x9ead7d4) That is telling you that you have a reference to an array, so you need to dereference it. Try the following: foreach my $replica(@$ReplicaList ) { #^ print Replica $replica\n; } See 'perldoc -f perlreftut' and 'perldoc perlref'. Lose the -f. Sorry, must pay attention. Also, your code suggests that you may not have 'use strict;' at the start of your script, at least the code you supply would not compile if it was there. It's a good idea to always to have that, and 'use warnings;' at the start of every script. HTH Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Replace white space between
Serguei Trouchelle wrote: Stephane Legault wrote: I need to replace white space between delemiter . After looking for do this I need to tell I did not find the solution! $test='test ROYALE JEWELLER@omr12.test.com mailto:ROYALE JEWELLER@omr12.networksolutionsemail.com test'; And I would like have this in $test3 (look the space between royale and jeweller is gone): test ROYALEJEWELLER@omr12.networksolutionsemail.com test $test =~ s/(.*?)/ $_ = $1; s!\s!!g; $_; /gex; A possible alternative for matching the quoted substring is to use Regexp::Common. It may be more verbose, but it has the advantage of handling embedded quotes, as long as they are escaped. For example: use strict; use warnings; use Regexp::Common; while (DATA) { chomp; print Before: '$_'\n; s/$RE{quoted}{-keep}/$_ = $1; s!\s!!g; $_/egx; print After: '$_'\n; } __DATA__ test ROYALE JEWELLER@omr12.test.com test test ROYALE \JELLY\@omr12.test.com test See 'perldoc Regexp::Common' for more useful REs. The code is quite interesting too. -- Brian Raven ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: named pipes or files on disk?
From: Jer A [mailto:jeremy...@hotmail.com] Sent: 23 April 2010 04:55 To: Brian Raven; activeperl@listserv.activestate.com Subject: RE: named pipes or files on disk? It is for cache purposes. I don't want to be writing hundreds of compiled pages to disk, and I need a solution that does not depend on a database...so that is why I've chosen to write a daemon. That doesn't really answer my question (i.e. what advantage do you expect a daemon to give you over the simply reading files from disk?), but it does add a couple of additional snippets, namely hundreds of compiled pages and not depend on a database. -- Brian Raven Please consider the environment before printing this email. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: named pipes or files on disk?
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of Jer A Sent: 19 April 2010 23:54 To: activeperl@listserv.activestate.com Subject: named pipes or files on disk? All, I am new to the concept of named pipes on unix/linux by using use Fcntl; will the named pipe transaction be faster than reading a file off the hd? I am thinking a writing a daemon cron process, which a cgi process can attach to and read from memory, instead of file. I dont want to use mod_perl. This smells a bit like an XY problem (see http://www.perlmonks.org/index.pl?node_id=542341), and I can't immediately see what Fcntl has to do with pipes, named or otherwise. It might help if we had more information about what you are trying to accomplish. In any event, you might want to consider other IPC mechanisms before pipes, like shared memory or sockets. Also, bear in mind that if you are not using mod_perl, your CGI script, and the Perl interpreter, will be read from disk for every request. Unless reading that data file is time consuming for some reason (e.g. it is huge, or remote), speeding it up may not improve the response time for your HTTP request by very much. HTH -- Brian Raven Please consider the environment before printing this email. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Missing Tk::MListbox in PPM
Neil Hughes wrote: Help! The last time I had this problem it was because my 5.8.x installation was out-of-date. This time, I've just wiped my 5.8.9 installation on Windows Vista and replaced it with 5.10.1 (1007). I've started reinstalling modules using PPM but I cannot see Tk::MListbox; however according to the repository website it's there. Can somebody else confirm it's available and then let me know what silly mistake I've made? http://www.cpantesters.org/distro/T/Tk-MListbox.html#Tk-MListbox-1.11 ... suggests that the module fails to test successfully on 5.10.1 for any platform. This seems to be confirmed by the logs on the ppm repository website http://ppm4.activestate.com/idx/TK...TY.html. Also, I take the absence of anything in the PPMX column to suggest that there will not be a ppm to download. You could try downloading the module from CPAN and trying it for yourself. However, it does seem to be quite old (untouched since 2001). Still, if it works for you, that may be good enough. HTH -- Brian Raven Please consider the environment before printing this email. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Help with sort
Barry Brevik wrote: I'm having a problem sorting data items that are alpha-numeric strings. I know how to do it if the string is all alpha or all numeric, but the combo eludes me. Take as example the following code. It is my desire that the machine names be processed in the order that they have been loaded into the hash. This is an example only- the machine names will not actually be loaded in order. Also, there will not always be dashes separating the alpha from the numbers: use strict; use warnings; my %mdata = ( 'CALIBRATION1',1, 'CALIBRATION02', 1, 'LABVIEW-1', 1, 'LABVIEW-2', 1, 'LABVIEW-4', 1, 'LABVIEW-11', 1, 'LABVIEW-12', 1, 'LABVIEW-114', 1, 'YESTECH-L3-RW1', 1, 'YESTECH-L03-RW2', 1, 'YESTECH-L4-RW125',1 ); foreach my $key (sort(keys(%mdata))) { print $key\n; } The output of this code is as follows, and you can see that the sort order is not what I wanted: CALIBRATION02 CALIBRATION1 LABVIEW-1 LABVIEW-11 LABVIEW-114 LABVIEW-12 LABVIEW-2 LABVIEW-4 YESTECH-L03-RW2 YESTECH-L3-RW1 YESTECH-L4-RW125 Any ideas on how to get this to come out in the right order? When you say It is my desire that the machine names be processed in the order that they have been loaded into the hash, it suggests that your question is not about sorting at all. Indeed, it is a FAQ, see 'perldoc -q hash.*order'. If your question really is about sorting, then a more accurate description of the keys and how to comare them is needed. However, the following sort function, which splits the keys into strings of digits and non-digits for comparison seems to work for the data provided. use strict; use warnings; use List::Util qw{shuffle}; sub sortfun ($$) { my ($v1, $v2) = @_; my @v1 = split /(\d+)/, $v1; my @v2 = split /(\d+)/, $v2; while (@v1 and @v2) { my $val1 = shift @v1; my $val2 = shift @v2; if ($val1 =~ /^\d+$/) { if ($val1 != $val2) { return $val1 = $val2; } } elsif ($val1 ne $val2) { return $val1 cmp $val2; } } return @v1 = @v2; } my @data = DATA; chomp @data; my @result = sort sortfun @data; print join(\n, @result), \n\n; print Now after a shuffle\n; @data = shuffle(@data); print join(\n, @data), \n\n; print Results in:\n; @result = sort sortfun @data; print join(\n, @result), \n\n; __DATA__ CALIBRATION1 CALIBRATION02 LABVIEW-1 LABVIEW-2 LABVIEW-4 LABVIEW-11 LABVIEW-12 LABVIEW-114 YESTECH-L3-RW1 YESTECH-L03-RW2 YESTECH-L4-RW125 HTH -- Brian Raven Please consider the environment before printing this email. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Leaning Toothpicks across OSs
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of deane.rothenma...@walgreens.com Sent: 24 February 2010 16:08 To: activeperl@listserv.ActiveState.com Subject: Leaning Toothpicks across OSs O Wise Ones, Yeah, right. (Slap me twice for this one--got my operating systems mixed up!) Happy to oblige. This is one of those silly moments when I can't remember a simple trick, and I'm too cotton-pickin' lazy to dig through all my Perl books to find it. I'm maintaining some old DOS code that has pathed Linux filenames suffering from LTS. you know... \/usr\/local\/fardle\/whang\/dang\/doodle\/etc. I know there's a way to eliminate all that \/ stuff, but I can't think of it to save my life. I'll gladly accept a Gibbs head-slap (for all you fellow NCIS fans out there), if it's accompanied by the solution. Not sure what you mean by eliminate them. Couldn't you just use an editor to change them to /? HTH -- Brian Raven Please consider the environment before printing this email. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Variable scoping
Barry Brevik wrote: I was under the impession that when I use the keyword our when declaring a variable, that the variable was then available to subroutines called from the routine that declared the variable. No, it can only be referred to without package qualification within the lexical scope in which it was declared, but see below. However, the code shown below fails with the following message: Variable $clr is not imported at test5.pl line 17. Global symbol $clr requires explicit package name at test5.pl line 17. What gives? -Barry Brevik === use strict; use warnings; my $color = 'blue'; setColor($color); sub setColor { our $clr = $_[0]; adjustColor(); } sub adjustColor { print $clr\n; } You have declared $clr as a package variable. It can be referred to within the declared scope without being qualified by the package name, and outside that scope with package name qualification. In this case the package is main, so this should work: print $main::clr\n; However, I am not sure that this example is a good use of 'our', as you are effectively declaring a global variable, but hiding its declaration within a subroutine. I would prefer to see the two subs that refer to the $clr being declared within a distinct package, and $clr declared at package scope. But then again, its not entirely clear from your simple example what you are trying to achieve. It could even be an X/Y problem. HTH -- Brian Raven Please consider the environment before printing this email. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: system/backticks output not as expected
Oeschey, Lars (I/ET-83, extern) wrote: Hi, I have a problem getting the output of a system call. It's a simple code: my $return=`$command`; print $?\n; print result:$return\n; (I am calling a command which actually doesn't exist, to check error handling) as result on the console I have: Das System kann das angegebene Laufwerk nicht finden. 256 result: The first error says it can't find the program. Actually I expected this in $return. compared to system(): my $return=system($command); print $?\n; print result:$return\n; Das System kann das angegebene Laufwerk nicht finden. 256 result:256 So obviously system() returns the error code. But why don't the backticks return anything at all? Ideally I'd want all the output catched to log, but still be able to react on errors... Backticks only capture output from stdout, while error messages are generally output on stderr. In unix-like shells it usual to redirect stderr to stdout by adding 21 to the command line. I don't know if it works the same on win32, but it might be worth a try, if that is your platform. Also, you could always try verifying that the command exists before trying to run it. HTH -- Brian Raven This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Help with unpack
Barry Brevik wrote: I am writing an app which, at a certain point, needs to read a .PNG graphics file. Your unpack question having been ably answered by others, I just thought to ask whether you had considered using any of the existing modules that understand png files, if it is image meta data that you are after? For example Image::Info or Image::ExifTool. HTH -- Brian Raven This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: PERL create file
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of SAQIB RAFIQUE Sent: 03 July 2009 07:27 To: activeperl@listserv.activestate.com Subject: PERL create file Hi, Can any body tell me what is wrong with my code below, I am trying to create a file before writing/appending data in it? Code line to create and open it as below: $output = /home/saqib/performance_debug_20090703.txt; open(OUTPUT,+$output) || die(Could not open output file ! \n); Its not exactly clear what you are trying to do, as your code doesn't quite match you description (you don't mention wanting to read from the file as well). Also, you don't say what problems you are having. To improve your I would advise using the 3 argument form of open, localise the file handle, and include the reason for the failure in your error message. So, to open a file for appending, creating it if it doesn't exist, I might have the following. my $output = /home/saqib/performance_debug_20090703.txt; open my $fd, , $output or die Failed to open $output: $!\n; As it is an output file you should also check that the close was successful, as this is where any disk dull errors will, usually, be discovered. HTH -- Brian Raven This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Perl / CGI and IIS6
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of Campbell, Scott Sent: 08 June 2009 13:58 To: anthony.okusa...@usbank.com; ActivePerl@listserv.ActiveState.com Subject: RE: Perl / CGI and IIS6 Anthony, I wrote a little method for my libraries which I use to authenticate all of my web-based apps off of Active Directory (LDAP). You will need to use the Net::LDAP module. This works on all platforms. Hope this helps, Scott Sorry to be picky when you are trying to help somebody, but I have a couple of issues with your code. *** =item Bldap_authenticate() This method accepts a username, password, and an array of LDAP servers, in that order. It returns a true/false code, and a message. IE: ldap_authenticate(u...@mydomain.com,MYPass,@dc_list) That example call doesn't appear to match the parameters in the sub below. =cut sub ldap_authenticate{ my($class,$username,$password,@ldap_servers)=...@_; #LDAP Connect# my $ldap = Net::LDAP-new(\...@ldap_servers, async = 1); if(!$ldap){ return(0,LDAP ERROR! Cannot connect to LDAP server(s).); } else{ #If LDAP servers are listening, attempt BIND (Authentication)# my $msg=$ldap-bind($username,password=$password); Try to avoid useless quoting. See 'perldoc -q quoting' if($msg-error=~m/success/i){ $ldap-unbind; return(1,Successful Logon); } else{ $ldap-unbind; return(0,Error: . $msg-error); } } } *** HTH -- Brian Raven This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Perl / CGI and IIS6
Bill Luebkert wrote: Brian Raven wrote: From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of Campbell, Scott Sorry to be picky when you are trying to help somebody, but I have a couple of issues with your code. *** =item Bldap_authenticate() This method accepts a username, password, and an array of LDAP servers, in that order. It returns a true/false code, and a message. IE: ldap_authenticate(u...@mydomain.com,MYPass,@dc_list) That example call doesn't appear to match the parameters in the sub below. It kinda does if it's a 'method' rather than a plain old sub. Maybe better written/documented in that case as: $obj-ldap_authenticate('u...@mydomain.com', 'MYPass', @dc_list) Yes, good point. Its good to see that you corrected the double quoting as well, unless, of course, the array @mydomain is supposed to be interpolated there. -- Brian Raven This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: listbox error
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of Tony W. Bass Sent: 22 May 2009 01:45 To: activeperl@listserv.activestate.com Subject: listbox error Hi All, Can anyone explain to me why I get the error: Can't call method g_bind without a package or object reference at C:\scripts\Error Code\listbox_error.pl line 17. Whenever I run the following code. This is put together from a larger program and if you take out the bind language you get the same basic error on the curselection statement. This is driving me crazy at this point. Start by putting ';use strict; use warnings;' at the start of your script, and declaring variables in a small a scope as necessary. use Tkx; my $mw = Tkx::widget-new(.); $mw-g_wm_title(Test Program); (my $nb = $mw-new_ttk__notebook(-height = 768, -width = 1024))-g_grid(); testtab1(); testtab2(); Tkx::MainLoop(); sub testtab1 { $tab1 = $nb-new_ttk__frame(-padding = 10); $userbox = $tab1-new_tk__listbox(-height = 20, -listvariable=\$cnames)-g_grid(-column=1,-row=1); I'm not a Tkx expert, but it looks like g_grid doesn't return what you think it does, so you need to split the above. $userbox = $tab1-new_tk__listbox(-height = 20, -listvariable=\$cnames); $userbox-g_grid(-column=1,-row=1); Then you can move on to your next error, which is a bit more obvious :-) $userbox-g_bind(ListboxSelect, sub {GetSecurity()}); $nb-add($tab1, -text = 'Test Tab', -state='hidden'); } @countrynames = (Argentina, Australia, Belgium, Brazil, Canada, China, Denmark, Finland, France, Greece, India, Italy, Japan, Mexico, Netherlands, Norway, Spain, Sweden, Switzerland); $cnames = ''; foreach $i (@countrynames) {$cnames = $cnames . ' {' . $i . '}';}; sub GetSecurity { my $u; my @idx = $userbox-curselection; if ($#idx==0) { $u = $countrynames[$idx[0]]; } print $u\n; } HTH -- Brian Raven This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Concatenation of files
-Original Message- From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of zilore mumba Sent: 20 April 2009 11:52 To: activeperl@listserv.activestate.com Subject: Re: Concatenation of files Just in case you are able to spend another 5 five minutes for me, at the end of writing the data in one file, I need to remove the original files. If I try to unlink the files I could end up deleting the newly created file. I do not want to mess this wonderful code. If you don't need to keep the original files, why move them? Just copy them to the concatenated file from the original directory, and delete each file after copying. use strict; use warnings; use POSIX; use File::Path; use File::Copy; # Variable declaration my $debug = 1; my $from_dir = C:/Temp; my $top_dir = C:/Weather; my ($day, $mon, $year) = ( localtime(time - 86400) )[ 3, 4, 5 ]; my $dat0 = sprintf( %04d%02d%02d, $year + 1900, ++$mon, $day ); my $out_file = $top_dir/$dat0/$dat0.txt; print out_file='$out_file'\n if $debug; $dat0 = $top_dir/$dat0; # Create a directory called by yesterday's date if not there if ( ! -d $dat0 ) { print mkpath $dat0\n if $debug; mkpath( $dat0 ) or die mkpath '$dat0' failed: $! ($^E); } # open output file - in dat0 print Creating output file '$out_file'\n if $debug; open my $OUT, '', $out_file or die Append to '$out_file: failed $! ($^E); opendir my $DIR, $from_dir or die opendir failed on $from_dir: $! ($^E); # Copy all files to output file, and delete them while ( my $item = readdir $DIR ) { my $fn = $from_dir/$item; next if -d $fn; # Extra filtering perhaps, to make sure we only copy message files ??? next unless $item =~ /^msg/; print Copying $fn\n if $debug; copy($fn, $OUT) or die Failed to copy $fn: $!\n; unlink $fn or die Failed to delede $fn: $!\n; } closedir $DIR; HTH -- Brian Raven This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: help concatenation of files
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of zilore mumba Sent: 14 April 2009 18:38 To: activeperl@listserv.activestate.com Subject: help concatenation of files Dear Perl Users, In the program below, am trying to put many text files into one. The program creates the directories as desired, moves the files to the directories as per commands and creates an output file. But the file created is empty and the error message is indicated as the path specified is not found. Am not sure exactly which line is not correct. Help will be appreciated. Zilore Mumba It would help greatly if you provided the exact error message, and exactly what part of your script caused it. However there is your code to comment on. #!/usr/bin/perl -w use strict; use warnings; A good start. use POSIX; You might want to change this to 'use POSIX qw{strftime};'. See below. use File::Path; use File::Copy; # my $debug = 0; # my @now = localtime; my ($day, $mon, $year) = (localtime(time() - 60 * 60 * 24) ) [ 3,4,5]; $year = $year+1900; $mon = $mon+1; open(DAT_OUT, datefile.txt); You should always check whether the open was successful. printf DAT_OUT (%04d%02d%02d\n, $year, $mon,$day); close OUT; Its probably a good idea to check that the close for an output file succeeded, because it will likely be here that you learn that your disk is full. Also, it's a good idea to close the file handle that you actually opened and wrote to, not some random one. open(DAT_OUT, datefile.txt); # we write date in a file so that month is tow-digit my $dat0=DAT_OUT; chomp $dat0; close OUT; Its not clear why you want to write a string to a file, only to read it in again. Unless you actually need that file for something else, the above code can be accomplished by: my $dat0 = strftime %Y%m%d, localtime(time - 24 * 60 * 60); my $msg_pref = 'msgs'; my $ext ='.txt'; my $out_file = $dat0$msg_pref$ext; my $msg_dir = 'Messages'; if ( ! -d $msg_dir ) { # Create a directory called Messages print mkpath $dat0\n if $debug; mkpath ($msg_dir ) or die mkpath '$msg_dir' failed: $! ($^E); } my $cmd01 = mv msg* $msg_dir; # Move all messages to directory Messages print doing system ($cmd01)\n if $debug; system ($cmd01); You need to check whether this command succseeded. See 'perldoc system' for how. The same applies to following system commands. chdir ($msg_dir) or die cd to '$msg_dir' failed: $! ($^E); # Change directory to directory Messages if ( ! -d $dat0 ) { print mkpath $dat0\n if $debug; mkpath ($dat0) or die mkpath '$dat0' failed: $! ($^E); } # Create a directory called by yesterday's date # Move all files to date_directory my $cmd02 = mv msg* $dat0; # Move all messages to date directory print doing system ($cmd02)\n if $debug; system ($cmd02); #But program remains in Messages # open output file - in dat0 # # print Creating output file '$out_file'\n if $debug; open OUT, $dat0/$out_file or die Create '$out_file: failed $! ($^E); You never write to this file, or explicitly close it. That being the case, this file is likely to be empty. my @files =(); opendir DIR, $dat0 or die opendir '$dat0' Failed: $! ($^E); while (my $file = readdir DIR) { next if $file =~ m/msg*/; So you are ignoring all files in the date directory which contain the string ms followed by zero or more gs. That is, by my reckoning, all of the files that you previously moved into the date directory with the command mv msg* $dat0. Perhaps you mean next unless $file =~ /^msg/; print Adding '$file'\n if $debug; push(@files,$file); } closedir DIR; #my $cmd03 = type @files $out_file; # for Windows my $cmd03 = (/cygdrive/c/progra~1/pcgrads/win32/cat @files $out_file); print doing system ($cmd03)\n if $debug; system ($cmd03); You should probably check that the array @files is not empty before attempting this command, which I believe is highly likely in this case. Also, note that the output file created by this command will not be the same as in the above open function. You use the same name, but write it to a different directory. #my $cmd04 = rm msg*; #print doing system ($cmd04)\n if $debug; #system ($cmd04); __END__ You are aware that everything from this point on will be treated as comments by perl? HTH -- Brian Raven This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com
RE: Concatenating files
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of zilore mumba Sent: 15 April 2009 15:59 To: activeperl@listserv.activestate.com Subject: Concatenating files Thanks to all who have spent precisous time looking at my code. Perhaps let me clarify a few things 1. I am working on Windows with cygwin (and perl) installed. When I did which cat I got the path and indded cat is there. However, if your command shell is the default for win32, it will not like you expressing a path like that (it treats '/' as a switch prefix, not a directory separator). What do you get when you try to run cat from the default win32 command prompt like that? Try cat without the explicit path. If it works for mv it should work for cat. 2. I write the date to file because when I use it I get 2009414 (for example istead of 20090414). That part of the code works. It is the printf part that does the formatting that you want. If you use sprintf instead you don't need to write a file. See 'perldoc -f sprintf'. 3. The files are meteorological reports (synop, temp, metar, etc) which keep coming as they are produced so one cannot guess the exact named of the report, except that it is msg where nnn... is an 8-digit number. 4. The idea of the program is to put all report for a day in one file and them they are processed by other programs. Your code seemed to have some logic errors. I believe I pointed out a couple of them. HTH -- Brian Raven This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Perl6 though IIS7 CGI
Lyle wrote: Just tested on WinXP. Works on Apache, just hangs on IIS 5.1... :( Lyle wrote: Bryan Keller wrote: Let's put this issue to rest. As Bill Luebkert said in a previous response, awful was being used as an intensifier Ok. Now that's sorted. Can we get back onto the subject matter? :) http://forums.iis.net/p/1156635/1899524.aspx#1899524 I don't know IIS from a hole in the ground, so just to check. I suspect that IIS might not honour the '#!' *nix magic as, I believe, Apache does, so have you configured it to run the appropriate Perl executable? HTH -- Brian Raven This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: PERL Pattern matching
Conor Lillis wrote: Hi all, I have a requirement to match a file against a number of possible strings. I also need to retain the successfully matching elements, and based on the match from the primary list, see if a corresponding secondary match is also in the file. E.g.. Picture the list below A B - 1 a 2 b 3 c 4 d 5 e 6 f I need to match any of the first column in the file, and for any matches in the first row match the corresponding entry for the second column. So if I match 3 and 5 in the file, I rescan and see if I can match c or e in the same file. Here is a snippet of how I am matching anything from column A, and then rescanning for only corresponding entries from column B. Is there a more efficient method than what I am doing here? Probably, but if it works, and is fast enough, why bother. So, assuming that it isn't fast enough (not sure if it works, as I am not sure if I understand what you are trying to do), here is where I get to pick holes in your code. (:-) in cast it isn't obvious). First, I realise that this is just a code fragment, but you do have use strict; use warnings; at the start, don't you? If not consider this the first comment. Note that Outlook has decided to wrap some of your lines. while(FILE) { foreach my $string (@strings) { if (grep /$string/i, $_) grep is wasted here. if (/$string/i) is more Perl-ish. Also it would probably be more efficient to perform a single match for the whole set of strings, than multiple matches for each one. See below. { $primary =++$primary; Weird! What's wrong with just ++$primary;. That's the equivalent of saying $primary += 1; $primary = $primary. if (!grep /$string/i, @matchindex){push(@matchindex, $string);} That's more appropriate use of grep, but your quoting of $string is unnecessary. Useless quoting is generally frowned upon. print gmtime().\$file\ matched on primary - $string\n; } } } close(FILE); No need to close the file here. if (@matchindex) { # GetSecondaries() Reads array to get 2nd column entries for primary matches by splitting row on seperators my @matches = GetSecondaries(@matchindex); open(FILE, $file); You could just seek back to the beginning of the file rather than open the file again. Also, you should always check that the open call was successful. LOOP: while(FILE) { foreach my $string (@matches) { if (grep /$string/i, $_) { $secondarycounter = ++$secondarycounter; As above. print gmtime().\t: Also matched on secondary - $string\n; logger($string,$file); # Logs output to a log file last LOOP; Are you sure about that? You exit from the loop after the very first secondary match. What about the others? } } } close(FILE); If my guess about what you are trying to do is right, the following might be a bit more efficient. --- use strict; use warnings; use Fcntl qw{:seek}; my %match_table = (1 = a, 2 = b, 3 = c, 4 = d, 5 = e, 6 = f); my $fn = shift; die Expecting filename\n unless $fn; open my $fd, , $fn or die Failed to open $fn: $!\n; my @primaries = find_matches($fd, sort keys %match_table); @primaries 0 or die No primaries found in $fn\n; print Found primaries: @primaries\n; seek $fd, 0, SEEK_SET or die Failed to seek: $!\n; $. = undef; my @secondaries = find_matches($fd, sort @match_tab...@primaries}); @secondaries 0 or die No secondaries found\n; print Found secondaries: @secondaries\n; close $fd; sub find_matches { my $fd = shift; my @strings = @_; my @matches; return () unless @strings 0; my $matchRE = makeRE(@strings); print Start looking at line $.\n; while ($fd) { if (/($matchRE)/i) { my $match_str = $1; push @matches, $match_str; @strings = grep {$_ ne $match_str} @strings; $matchRE = makeRE(@strings); # No point continuing if nothing left to look for last unless $matchRE; } } print Stopped looking at line $.\n; return @matches; } # Make regexp to match a list of words. sub makeRE { return undef unless @_ 0; my $str = join |, map {(?:$_)} @_; return qr{$str}; } --- You may be able to do better with a single pass through the file, depending upon the size of your file and the table of strings you are looking for. HTH -- Brian Raven This e-mail may contain
RE: Help with hex
Barry Brevik wrote: I am running Active Perl 5.8.8 on Windows and am writing a data conversion app into which I want to build some debug routines. To that end, I want to add a routine to take any string and display it as hex numbers. The string can be anywhere from 0 (zero) to over 1,000 characters and can contain any byte value from 00 to ff. I want to do this without adding the overhead of printf or sprintf to my program. Has anyone out there done this before? Probably lots of times. I am not aware of any modules that do this, but that may be because it is fairly trivial to do in a simplistic way, e.g. print unpack(H*, $string), \n; I also have a function that produces more readable output lying around that you are welcome to, if it helps, although it uses sprintf. It could almost certainly be made more efficient, but only if necessary. # Dump a message in hex (looks a bit like emacs hexl-mode). Parameters # are the message to dump, and an optional bytes per line (default # 16). Returns the dumped string ready to print. sub hex_dump_msg { my $msg = shift; my $bpl = shift || 16; return unless defined $msg and $msg ne ; $bpl 0 ($bpl % 2) == 0 or die Invalid bytes per line ($bpl). Should be positive and even.\n; my $res = ; my $addr = 0; while ($msg ne ) { my $seg = substr($msg, 0, $bpl); substr($msg, 0, $bpl) = ; my @words = unpack H4 x ($bpl / 2), $seg; $res .= sprintf %04x: , $addr; $res .= join( , map {pad4($_)} @words); $seg =~ s/[[:^print:]]/./g; $res .= $seg\n; $addr += $bpl; } return $res; } sub pad4 { my $str = shift || ; return substr($str, 0, 4); } Only worry about the cost of using [s]printf when it becomes more than you are prepared to pay. HTH -- Brian Raven This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Perl 10
Bill Luebkert wrote: Chris Prather wrote: On Fri, Mar 27, 2009 at 4:46 PM, Dukelow, Don duke...@hp.com wrote: Anyone know why they took TK out of Perl 10? Assuming you mean Perl5 version 10 ... it was never in Perl5. At least not according to Module::CoreList. It's still on cpan http://search.cpan.org/dist/Tk/ though. Try reading this: http://community.activestate.com/forum-topic/perl-tk-v5-10-0 I didn't see mentioned there the main reason that Perl/Tk is no longer maintained, and that is due to the passing of its primary developer and maintainer in 2006. http://news.perlfoundation.org/2006/09/thanks_nick.html Personally, I am still writing Tk scripts, mainly as I haven't worked out how to use Tkx effectively yet. HTH -- Brian Raven This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Peculier Issue with Mail::Sender and the machine
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of Perl Perl Sent: 18 March 2009 16:58 To: activeperl@listserv.activestate.com Subject: Peculier Issue with Mail::Sender and the machine Hi All, I have written a code which sends a mail using Mail::Sender utility. When I ran this code at 2 differenct machine (Linux, Solaris), observed the peculier issue. At Linux this code works fine, and sends the mail. At solaris this is not sending the mail, but no warnings errors. I used the specific path where the Mail::Sender utility is install. Your help will be greatly appreciated. #!/usr/bin/perl #!/apps/perl/5.8.3/bin/perl Missing use strict; use warnings;. You will be doing yourself a favour by using them in all of your scripts. use Mail::Sender; $sender = new Mail::Sender { from = 'm...@server.com', }; $sender-Open({to = 'm...@server.com', cc = 'mu...@server.com', subject = 'A machine.'}); $sender-SendLineEnc(I'm sorry, but due to a big load of work, I'll come at 10pm at best.); $sender-SendLineEnc(\nMustafa); $sender-Close; As you don't check for errors, it is not entirely surprising that you don't see any. I am not familiar with Mail::Sender, but a quick glance at the documentation shows that there are a number of ways to deal with errors, the simplest being the on_error = 'die' parameter to the object constructor. There are also some debugging options. HTH -- Brian Raven ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Issue with Mail::Sender : Help needed
From: activeperl-boun...@listserv.activestate.com [mailto:activeperl-boun...@listserv.activestate.com] On Behalf Of Perl Perl Sent: 04 March 2009 13:07 To: activeperl@listserv.activestate.com Subject: Issue with Mail::Sender : Help needed Dear All, I am getting the below error for Mail::Sender utility. Which sends the mail. Your help will be a great help for me. Error is, Can't find string terminator *END* anywhere before EOF at Mail_Attach.pl line 18. Please find the complete code as below, #!usr/local/bin/perl -w 'use strict;' missing. use Mail::Sender; $Sender = new Mail::Sender ( { from = 'mail...@network.com', Error = 'Code' } ) or die Can't create the sender object $Mail::Sender::Error \n; $Sender - OpenMultipart ( { to = 'maid_...@network.com', cc = 'mail_...@network.com', subject = 'Checked out Reminder' } ) or die Can't open Multiple connection $Sender - {'Error'} \n; #$Sender-Body({ msg = '*END*' }); # error is here $Sender-Body; $Sender-SendEnc('*END*'); # if I use this code, then error is here. Hi User, How are you ? Long time to send a mail. Here is a new module Mail::Sender. *END* $Sender - Attach ( { description = 'File file.txt is checked out', ctype = 'application/x-zip-encoded', encoding = 'Base64', disposition = 'attachment; filename=file.zip; type=ZIP archive', file = 'file.zip' }) or die Can't attach the file : $Sender - {'Error_Code'} \n; $Sender - Close() or die Can't Send the mail $Sender - { 'Error' } \n; What makes you think your problem is anything to do with Mail::Sender? (Hint: it isn't.) It looks like your terminator might have a space in front of it. There is a FAQ about this, see 'perldoc -q here doc'. Also, if you had tried adding 'use diagnostics;' (one of the first things to try if you can't understand a perl error or warning message) it would have explained the error in more detail, including a hint as to where the problem was. HTH -- Brian Raven --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: escape some char
p sena wrote: Hi, Can someone pls shed me some light I have a func -- sub get_formatStr { my $formatStr = '%#%#%z'; return $formatStr; } where in above, %xxx, %yyy %zzz are literals all three being delimeted by '#' and the combination should always be enclosed by double quotes. I have to use this string in a regex as below- $cmd = $prog -o $formatStr $queryStr; ## first $cmd But this cribs in cmd execution and o/p bangs! However $cmd = $prog -o \%l#%#%z\ $queryStr; ## second $cmd. works fine supplies expected o/p.no issues with $queryStr too. Now, problem arises when I use the first $cmd. Is there any way (built in funcs or tekniks) where in I can use the first $cmd and still get the good o/p as from second $cmd ? Sorry, but I find it pretty difficult to work out what you are asking from that. You refer to a regex but I see no sign of any regex, and this cribs in cmd execution and o/p bangs! lost me completely. A small, self contained example script (SSCE) that illustrated your problem and that I could cut and paste, and run on my box might have been more useful. My best guess from reading your post several times is that you are asking about quoting. If so, check out the quoting operators in 'perldoc perlop', probably qq. If not, please feel free to try again, especially with the SSCE. HTH -- Brian Raven --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Initializing list of variables
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 11 December 2008 16:29 To: activeperl@listserv.ActiveState.com Subject: Initializing list of variables Gurus, I'm almost ashamed to have to post this, because I know this is a newbie question, and I'm not really one of those any more, but I'm drawing a blank. Isn't there an easier way to initialize a list of variables, to a common value, than this: my ($a, $b, $c, $d, $e, $f) = ('init', 'init', 'init', 'init', 'init', 'init'); I'm not sure how I would do it with map, but the following is likely to be simpler. my ($a, $b, $c, $d, $e, $f) = ('init') x 6; See 'Multiplicative Operators' in 'perldoc perlop' for more details. I'm *sure* I've seen this done using map, but, like I said, every trip to the well yields an empty bucket-- except for the no-brainer line above. TIA, and PLEASE try not to laugh too loud... No more than a gentle chuckle. Promise. HTH -- Brian Raven --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Sorting version strings
Deans, Glenn (IT Solutions US) wrote: I'm trying to figure out the best way to sort version strings, like 2.13.87 (purely numerics for now), and found Sort::Versions at CPAN that seems to do what I want. However, I can't find it listed in PPM or any other repository that I load. I can download the pkg from CPAN but don't have a compiler installed on this box. My head's been full of vbscript for the past year and trying to jump back to Perl and work out a method to sort these is a challenge. Well, its in the repositories that my ppm is pointing to. At least, I have two entries for Sort::Versions and two repositories (activestate and uwinnipeg - it would be nice if ppm told you which repository a package was from). I am using version 5.10, BTW. You don't say which version you are using. If you really can't locate a ppm, then you shouldn't need a compiler to install from CPAN, as it looks like a pure Perl package. You would only need a make(-like) program. Your documentation should include a Windows Specific FAQ which includes the question Where do I get make for Win32, in case you need any help with that. Does anyone know where I can get this module or have a snippet of how to go about sorting version strings? Other than using said module, a fairly simplistic method of sorting version string that you subscribe might be: use strict; use warnings; sub vcomp { my @v1 = split /\./, $a; my @v2 = split /\./, $b; while (@v1 and @v2) { my $p1 = shift @v1; my $p2 = shift @v2; return $p1 = $p2 if $p1 = $p2; } return @v1 = @v2; } my @array = qw{3.5.6 2.18.27 3.5.7 3.5 1.1.1}; print $_\n for sort vcomp @array; HTH -- Brian Raven --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Sorting version strings
Gisle Aas mailto:[EMAIL PROTECTED] wrote: On Dec 10, 2008, at 8:23 , Brian Raven wrote: Well, its in the repositories that my ppm is pointing to. At least, I have two entries for Sort::Versions and two repositories (activestate and uwinnipeg - it would be nice if ppm told you which repository a package was from). From the command line run 'ppm desc num' to see what repository a package comes from. If your search only return a single match that's the form you will see directly. From the PPM GUI you can view the repo by selecting View View Columns Repo. This menu is also available by right-clicking on the column headers. Excellent. Thanks. Which means that I can now confirm that Sort::Versions is in the Activestate and uwinnipeg repositories for 5.10, rather than just guessing. -- Brian Raven --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Reading hash arrays in the order it was written
Fish, David wrote: Hello! The problem I am having is I am pulling data from a table in a certain order and loading it into the hash array but when I read the hash array it comes out in a different order than it is written. What I have done as a work around, is the read the data from a file that has it in the correct order. Is there away to build the hash so that it reads in the order it was created? Key creation and hash build: select statement ordering by certain columns .. $key = sprintf(%04d%07d%07d,$chk_num,$trans_seq,$dtl_seq); $midtlinfo{$key} = sprintf(%d|%d|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%s|%s|%d|%d|%0.2f|%0. 2f|%0.2f, $se_chk_mi_seq, $obj_num, $business_date, $chk_num, $trans_seq, ); Reading of the hash: foreach $mk (keys %midtlinfo) @mrec = split(/\|/,$midtlinfo{$mk}); } 1. Push keys into an array as you add them to the hash and use that instead of 'keys %hash', ... or ... 2. Use the module designed for that purpose. See http://search.cpan.org/~gsar/Tie-IxHash-1.21/lib/Tie/IxHash.pm HTH -- Brian Raven --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Long directory structure on one line
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of zilore mumba Sent: 15 November 2008 11:22 To: activeperl@listserv.activestate.com Subject: Long directory structure on one line Perl Users, Firstly my apologies for my very elementary knowledge of Perl. Thanks to ideas from Sena and Mustafa, and a lot of assistance from Bill Luebkert on an earlier script, I have below a snippet from a script which I tohught should work. The problem is $base_dir, which is supposed to be /home/Mumba/archive/11-November08/ukmo/20081115 is being put on several lines as /home/Mumba/archive/11 - November08 Hence my chdir ($base_dir/$dat) gives the error cannot cd, no such file or directory. I have another script which works, with a similar but even longer directory. I do not see the difference. Is there some trick I can do to force the whole directory on one line? Thanks my $base_dir=/home/Mumba/archive/$model_mon$dash$mon_name$yr/$model; The problem (probably) lies in the code that you are not showing. If you are still populating some of those variables by `date ...`, then they will be terminated by a newline character. You should 'chomp' them, or better still, use strftime. Easy to check: my $model_mon =`date +%m`; print model_mon='$model_mon'\n; Compared to: my $model_mon = srftime %m, localtime; print model_mon='$model_mon'\n; HTH -- Brian Raven --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: STDERR going to browser with IIS Perl.exe
Lyle wrote: Hi All, Every time I've setup ActivePerl on IIS, be it IIS 5, 6 or now 7, everything I print to STDERR gets sent to the browser. This can cause some weird problems. This simple test script:- #!perl print Content-type:text/plain\n\n; print TEST\n; print STDERR STDERR test\n; Causes the following error on IIS7 h2HTTP Error 502.2 - Bad Gateway/h2 h3The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are STDERR test Content-type:text/plain TEST ./h3 So even though the STDERR test is printed last, it's going to the browser first. Is this a problem with IIS config? Any pointers? I am not a CGI expert, but it was my understanding that anything written to STDERR was normally directed to the error log. I know nothing of IIS, but I would hope that it could be configured to do the same. Of course your post leads to the question of why you are writing directly to STDERR. If you are using CGI::Carp, you can direct error messages to STDOUT, STDERR, or a log file of your choice. HTH -- Brian Raven --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32-API-0.55 problem
Sean Lin wrote: 2008/10/22 Justin Allegakoen [EMAIL PROTECTED]: Please provide a *small* sample of the code that is failing for you, and let us know the dll that youre trying to interface with. This is my *small* sample... DLL function == API_TEST_API int __stdcall sum_integers_ref(int a, int b, int *c) { *c = a + b; return 1; } Perl script == use Win32::API; $function = Win32::API-new('API_test', 'int sum_integers_ref(int a, int b, int* c)'); $c = 0; $function-Call(3, 2, $c); print c = $c; Win32-API-0.53 result == c = 5 Win32-API-0.55 . 0.57 result == c = ? Complete DLL source code http://code.google.com/p/libwin32/source/browse/tags/Win32-API/?r=354#Wi n32-API/0.44/API_test_dll%3Fstate%3Dclosed It may not be your problem, but I notice that your file API_test.h contains no reference to the function you are trying to call. Does it work for other functions in that dll? HTH -- Brian Raven --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: suggestion substring and more
Mario R. Sanchez, Ph.D. wrote: dear perl gurus can someone suggest a design/approach on solving the following requirement: there is a string, say $ss, that is contained in a longer string, say $ls. for example $ss = jumps over and $ls = the cow jumps over the moon how do you suggest obtaining a string from $ls that is $n characters to the both left and right of $ss? for example and using the above, say $n = 4 so the results would be cow jumps ove (notice 4 characters to both the left and right of the target text $ss. Surely, that should be cow jumps over the, i.e. including the 4 characters either side of jumps over. any approach would be much appreciated! Well, its easy to find out the offset of the substring (see 'perldoc -f index'), and you know how long the substring is (see 'perldoc -f length'), so its just some simple arithmetic and a call to substr (see 'perldoc -f substr') to extract what you want. HTH -- Brian Raven --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: regexp to clean a text file
Alejandro Santillan Iturres wrote: I've tried this wonderful command: hexadump -c file.txt and I found that I have to include more and more chars to erase as follows: $text=~s/\177//g; $text=~s/\377//g; $text=~s/\335//g; $text=~s/\360//g; $text=~s/\204//g; $text=~s/\222/\n/g; $text=~s/\214//g; $text=~s/\216//g; $text=~s/\224//g; $text=~s/\240//g; $text=~s/\237//g; $text=~s/\234//g; $text=~s/\325//g; $text=~s/\351//g; $text=~s/\352//g; $text=~s/\355//g; $text=~s/\361//g; $text=~s/\362//g; $text=~s/\366//g; Is there a way to erase all the chars that are higher than, say, 300? Does this make sense? Try: $text =~ tr/\300-\377//d; or with control characters (i.e. less than space) as well: $text =~ tr/\000-\037\300-\377//d; HTH -- Brian Raven --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: regexp to clean a text file
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alejandro Santillan Iturres Sent: 02 October 2008 19:45 To: activeperl@listserv.ActiveState.com Cc: [EMAIL PROTECTED] Subject: Re: regexp to clean a text file Thank you William, Bill and Tim. Finally s/[\x00-\x1f]//g did the trick, almost perfect. The original file is the palm database of memo pads. The text is there, plain. Several mixed control characters were present. The system I working on is a Fedora linux box. I have no hex utility installed to make de dump, so I don't know if the ^E is really a ^E. I find that a little hard to believe. Try 'hexdump', or if that isn't present you should at least have 'od'. If neither of them are installed, you Linux installation sounds a bit broken. Unless you can identify which characters are to be kept or discarded, you will find it difficult to 'clean' your data effectively. HTH -- Brian Raven --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Connecting to Database as sysadmin using DBI
Rameez Thonnakkal wrote: Hi All, Not sure this is the correct mail id for posting this query. I am using DBI for connecting to a oracle Database. By using a specific user and password i am able to connect. But my requirment is to connect as sysadmin without password. Could any one give me the piece of code for the same. Tried bit of googling but of no luck :( Depends what you mean. If you want to connect using the username sysadmin, but with no password, then whether that is possible, or even advisable, is a question for your database admin (DBA). If you mean that you want to connect as a DBA with no password, then that is probably a very bad idea, right up there with allowing root/sysadmin access to your computer with no password. If you mean something else, please say. HTH -- Brian Raven --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Connecting to Database as sysadmin using DBI
Rameez Thonnakkal mailto:[EMAIL PROTECTED] wrote: Hi Brian, I am trying to code the following in perl.. sqlplus '/as sysdba' -- (Where we don't need to give password.) Typo .. please read sysadmin as sysdba.. Aaah... I think I see what you mean. As this is Oracle specific, see 'perldoc DBD::Oracle'. Look for ora_session_mode for details. HTH -- Brian Raven --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Help with strict
Barry Brevik wrote: I have seen it said many times, on this list, that we should always have: use strict; I have tried to use this many times, but all it does is give me hundreds of errors like this: Global symbol $version requires explicit package name at domainctrl.pl line 10. Global symbol %cmptrlist requires explicit package name at domainctrl.pl line 18. All of these are variables created in the main body of the program... I suppose that they are technically part of the main package, but if strict is trying to tell me that I have to refer to these as main::$version (for example), I don't think that I am willing to go there. Can anyone tell me what is going on here? You have had some good answers, but the following article might help you understand what is going on. http://perl.plover.com/FAQs/Namespaces.html I always get plenty of those errors in new code. They tell me where I have forgotten a declaration, or more often, identify a typo. In short, use strict helps me avoid some classes of bug. HTH -- Brian Raven --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: question about bugzilla perl ppm pacage update
Jan Dubois wrote: On Wed, 02 Jul 2008, Joel Friedman wrote: The command line still works; however, there is no longer an interactive shell. There still is a shell, it is just called `ppm-shell` because `ppm` without arguments invokes the GUI. If the ppm archive is as out of date as the instructions seem to be, it is quite possible that the modules that live there are not binary compatible with the latest Activestate Perl (5.10). HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: variables
Basil A. Daoust wrote: Thanks Bill, I'm not sure that answered my question, but it kind of did. Why does $hashref-{attributes}{charset} and $hashref-{attributes}-{charset} work and this fails $hashref{attributes}{charset}? The clue is in the error message that you get because you have 'use strict;' at the top of all of your code. Something like: Global symbol %hashref requires explicit package name at... To permit $hashref{attributes} to be a shorthand for $hashref-{attributes} would be ambiguous, as it already means look up a key in hash %hashref. The expressions $hashref-{attributes}{charset} and $hashref-{attributes}-{charset} are not ambiguous because the result of $hashref-{attributes} (or indeed $hashref{attributes} if %hashref exists) can only be a scalar, in this case a hash ref. Personally I always use the '-' so that I don't have to remember where it can be omitted. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Communication between Perl and VB script
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 25 June 2008 11:01 To: activeperl@listserv.activestate.com Subject: Communication between Perl and VB script Hi All, I want to call a Perl script ( assume test.pl ) in VB script (final.vbs). Is it possible to do this? It probably depends on what you mean by call, but I shall assume that you mean execute or run. This is really a VB question rather than a Perl question, so a VB forum may have been more appropriate. In any event, I would be surprised if VB didn't provide the ability to run external programs, indeed if I google for vb run external program it shows a number of likely looking answers. Remember, Google is your friend. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: install DBI
Steffen Haugk wrote: Thanks, Brian, apologies for replying to you directly, I somehow imagined the mailing list had posted it on your behalf. You can tell I am new around here. It turned out it was an INC problem. I had three installations of Perl on the machine, the one that comes with mac os, activePerl 5.8 and ActivePerl 5.10. The first line of my script called /usr/bin/perl which must be the one that comes with Mac OS. Yes, that would do it. Once I had figured out what perl to use it worked. Thanks for your help. I should have been able to figure that one out by myself. No problem. Glad you figured it out. HAND -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: [Fwd: Net::SSH::W32perl /Net:SSH::Perl on activeperl win32]
listmail wrote: Jenda Krynicky wrote: From: Michael Ellery [EMAIL PROTECTED] I've been trying to use Net::SFTP recently, without luck. When I try to execute a simple fetch with code like: use strict; use Net::SFTP; my $scp = new Net::SFTP( 'SOMEHOST', user = 'SOMEUSER', password = 'SOMEPASS', ) or die Unable to create host connection; my @list = $scp-ls('/tmp'); print HERE IS /tmp\n:; map {print \t$_\n;} @list; my $stat = $scp-get('/tmp/InstalledDB', 'c:/s2/InstalledDB'); print get status is $stat\n; ...I get the error: The getpwuid function is unimplemented at C:/Perl/site/lib/Net/SSH/Perl.pm line 110. Net::SSH2 works fine for me under Windows. 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 ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs This doesn't show up in 5.8.820 repo is there another repo that has it or did you build libssh2 and its dependancies manually. I don't usually build on Windows so I'm not sure what to do about the ./configure part. It seems to be here: http://theoryx5.uwinnipeg.ca/ppms/ HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: trying to parse a thunderbird mail file
Basil A. Daoust wrote: Bill Luebkert wrote: Basil A. Daoust wrote: Now I have to believe that some Perl modules must exist that can already parse a email file. I looked at email::simple but it didn't really work the way I hoped. It treated the email file as a single email. I found a example that looked very promising but it requires Email::Folder and that doesn't seem to be available for ActivePerl 5.10? I did find a version on cpan but being a windows user running a make has never worked for me. What I want to do is open a mail file, that is in plain text, Split it into individual emails. Then split the text/plain if available or the text/html if plain/text not available, out of a multi-part mime messages. Discarding the stuff that would be non-visible in the normal email. Now I can do all that using brute force but I kind of thought that something must exist. I would like any modules suggested be available via PPM, thanks. Try MIME::Parser - if it won't handle the file, just split the file at each '^File - date' marker you find and feed the individual msgs to the parser. I don't see MIME::Parser in PPM? That can happen for a number of reasons. It doesn't exist, a typo, or perhaps its part of a larger package. According to http://search.cpan.org/search?query=MIME%3A%3AParsermode=all it is part of MIME-tools, which does appear to be in several PPM archives. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: urgent help : Error while installing Crypt::DES at Windows XP
Curtis Leach wrote: Just in case you are still working on this, a few bullet points. 1) Active State doesn't have the Crypt::DES module pre-built. You have to download it from CPAN build it yourself. I ran into this a long time ago Active State said the more secure encryption packages require a license to distribute they didn't want to bother with that. I understand that this is a big headache to acquire from the government. Actually it looks like Activestate have built it (http://ppm.activestate.com/BuildStatus/5.10-windows/windows-5.10/Crypt- DES-2.05.txt), but it is not in the archive. It does seem to be available from the University of Winnipeg archive. You may need to install or upgrade your PPM::Repositories module for ppm to see it. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: urgent help : Error while installing Crypt::DES at Windows XP
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi Brian Baven, Extremely sorry to tell you that I am not aware of how to use ppm, When I am typing ppm at C:\perl\bin,then I getting GUI, which shows certain options like install etc, but I can't do anything there. And there is no ppm session will be established. Hope I have to do something here. Perhaps its just me, but it doesn't seem particularly difficult. Have you read the documentation? Assuming that you have a recent version (you don't say which IIRC), it should be a simple matter of selecting the module that you want to install in the GUI, and telling it to download and install, or typing something like 'ppm install Crypt::DES' at the command line. It is certainly a lot easier than trying to build it yourself, as the package in the ppm archive has already been built (an advantage that the ppm archive has over CPAN). HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: urgent help : Error while installing Crypt::DES at Windows XP
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 06 June 2008 16:46 To: activeperl@listserv.ActiveState.com Subject: urgent help : Error while installing Crypt::DES at Windows XP Hi All, Getting error while installing Crypt::DES, I thought it is due to Microsoft VC++, and I installed it successfully but still I am getting the below same error. Urgent response: Crypt::DES seems to be in the ppm archive, so it would seem to be simpler to install it using ppm. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: I would like to stop my subscription
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thomas Herman Sent: 23 May 2008 06:36 To: ActivePerl@listserv.ActiveState.com Subject: I would like to stop my subscription Dear Sirs: I would like to stop my subscription. Thomas, The messages that you receive from the list should contain the following fields: X-Mailman-Version: 2.1.8 Precedence: list List-Id: Discussions relating to ActivePerl activeperl.listserv.ActiveState.com List-Unsubscribe: http://listserv.ActiveState.com/mailman/listinfo/activeperl, mailto:[EMAIL PROTECTED] List-Archive: http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/activeperl List-Post: mailto:activeperl@listserv.ActiveState.com List-Help: mailto:[EMAIL PROTECTED] List-Subscribe: http://listserv.ActiveState.com/mailman/listinfo/activeperl, mailto:[EMAIL PROTECTED] These provide you with URLs and email addresses, either of which can be used to manage your subscription, including unsubscribing. HTH, HAND. -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Resources for reading MS Visio with Win32::OLE
Keith Talbert wrote: Does anyone have any good resources for learning about reading and possibly writing to Microsoft Visio using Win32::OLE. I found very little on the web or CPAN. I would like to read the text in shapes of Visio 2003 and possibly copy a shape and add text. I found sample code and am successfully using Win32::OLE with Excel. Using AS v5.8.8 on Win XP pro, Visio 2003 native format not XML. A good quick reference is the OLE browser kindly provided by Activestate (See the documentation for Win32::OLE). The main resource tends to be the documentation for the application itself. Check the table of contents for something like Automation Reference, and be prepared to translate Visual Basic to Perl, which is not to hard once you get used to it and you have some examples (albeit from other applications) to get you started. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: PPM's weird list
Roode, Eric wrote: Hello, I just did a fresh install of 5.10, and am now installing modules via PPM. Why is it that I often see module variants but not the main root module? For example, with All Modules selected, PPM lists: CGI-Session-BitBucket CGI-Session-FlexMySql CGI-Session-ID-UUID CGI-Session-ID-uuid CGI-Session-Remote CGI-Session-Serialize-DataDumper CGI-SessionM but not: CGI-Session Why is this? If you check the build status of those modules (http://ppm.activestate.com/BuildStatus/5.10-C.html) you will see that CGI::Session failed some tests, which is why it is not in the archive. You will also see that some of the modules that depend on it failed to build or test because CGI::Session was not present. The modules that depend on CGI::Session that passed, and therefore made it into the archive, did so because they didn't explicitly identify their dependency, and had no tests. I would be reluctant to recommend such modules. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: 5.10 and I18N::Langinfo
Roode, Eric wrote: All, I just installed AS 5.10 (1003) on my server here, and for some reason, I18N::Langinfo was not installed. At least, I get Can't locate I18N::Langinfo.pm in @INC (@INC contains [the stuff you'd expect it to contain] when I try to use certain modules. I can't find I18N::Langinfo on CPAN or in any of several PPM repositories. I assume that since it's a core module, it doesn't have a separate distro. My questions: how can I reinstall this module? How can I find out why it failed? Did any others fail, and are lurking problems waiting to bite me? This is reminiscent of another question I saw recently. According to the doco, it is just a wrapper for the C nl_langinfo() interface, so unless the build platform has appropriate support, I18N::Langinfo may not get installed. But I agree it would be useful to know that. A Not supported on this platform exception perhaps, rather than just being silently dropped. Yes it is a core module, so the source code is in the Perl distribution. Perhaps you could extract and build it on your platform. This is a frequent annoyance to me core modules are very difficult to install or upgrade independently. I can't recall ever needing to upgrade a core module, but I can imagine it being difficult if the source is only in the Perl distribution. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Spreadsheet::ParseExcel::SaveParser
mirz wrote: Hi all, I have following problem. I wrote script which change some values in the excel so I used Spreadsheet::ParseExcel::SaveParser. Script works fine but when I would like to convert this script to exe whit perl2exe I have many errors: First of all: Warning: Can't locate I18N/Langinfo.pm at C:\Perl1\lib\encoding.pm line 44 @INC = C:\Perl1\site\lib, C:\Perl1\lib, . If you look at the code that tries to load it in encoding.pm you will see the comment # I18N::Langinfo isn't available everywhere, so it may not be serious. A more meaningful warning would have been better. If you want to avoid the warning you will probably have to remove any use encoding statements in your code. It may be difficult to install I18N::Langinfo as it seems to be part of the core distribution that may only get installed if there is support for what it need on the build platform. Ok I tried find this module in ppm but I couldn't... then when I run my script I have following errors: PLEASE SEE THE PERL2EXE USER MANUAL UNDER Can't locate somemodule.pm in @INC FOR AN EXPLANATION OF THE FOLLOWING MESSAGE: Can't locate Spreadsheet/ParseExcel/Workbook.pm in @INC (@INC contains: PERL2EXE_STORAGE D:\perl2exe10 C:\DOCUME~1\RAFA~ 1\USTAWI~1\Temp/p2xtmp-1992 .) at (eval 8) line 3. ...propagated at PERL2EXE_STORAGE/base.pm line 93. BEGIN failed--compilation aborted at PERL2EXE_STORAGE/Spreadsheet/ParseExcel/SaveParser.pm line 14. Compilation failed in require at D:\perl2exe10\f.exe line 143. BEGIN failed--compilation aborted at D:\perl2exe10\f.exe line 143. Can somebody help me? This error is killing me... Did you try what the perl2exe user manual suggested? If so, what happened.? HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: threads package missing is_running
[EMAIL PROTECTED] wrote: Brian: Starting Thread Test This is the child thread (0 sec) This is the main thread (1 sec) This is the main thread (2 sec) This is the child thread (2 sec) This is the main thread (3 sec) This is the main thread (4 sec) This is the child thread (4 sec) This is the main thread (5 sec) This is the main thread (6 sec) This is the child thread (6 sec) This is the main thread (7 sec) This is the main thread (8 sec) This is the child thread (8 sec) This is the main thread (9 sec) This is the main thread (10 sec) This is the child thread (10 sec) Thread has ended. Thread killed. was that what was expected? I was thinking there'd be a count down or such as each thread died and *then* the main thread dies. That's pretty much what I would expect. My code was based on the OP's, in which there was only one child, and the counter in both main and child thread increment rather than decrement. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: threads package missing is_running (solvedish)
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I thought about the locking approach, but this will all eventually be wrapped into a Windows services tool that will shutdown the service gracefully. I don't see how that removes the need for locking when changing shared variables? The way services work, the process needs to ping the service control manager once in a while when it is still running. So, if a thread didn't shutdown after a join() in x number of seconds, Windows would assume the program is not responding. And who knows how long a worker thread will spend on one task before saying hello again. This is essentially how they will talk: Worker Threads - Master Thread / Services Callback Thread - Windows Services Sorry, but I don't really follow that. I can say I found something similar to your idea that works nicely. Thanks to the 'async' command, I can use a shared variable and adjust that variable after it asynchronously joins the threads. Yes, very much in the realm of hacks and bad ideas, but it works. With the verbage of this thing, it really sounds like nonsense spawning threads from the master and joining them to another child. I'm not sure that it does work (see comments in code),except by coincidence. It certainly doesn't work in later versions of Perl. xmp # Test Threads use threads; use threads::shared; use Win32; use strict; use vars qw ($counter $thr $thread $threads); Prefer declare variables lexically (i.e. my ...), unless you actually need to do otherwise. my $thread_shutdown : shared; Log (Starting Thread Test); $thr = threads-create (\ChildThread, 0); $counter = 0; while ($counter++ 60) { sleep (1); Log ('This is the main thread speaking: '.localtime(time())); } # Signal shutdown state $thread_shutdown = 1; # Asynchronously join threads. $threads = threads-list(); Note that $threads contains a single thread object ... async { my $result; foreach $thread ($threads) { ... this will therefor be a problem if you have more than one thread. $result = $thread-join (); Log (Result for thread .$thread-tid.: .$result); } # Signal final shutdown state $thread_shutdown = 2; }; Also you don't join the async thread. Older versions of Perl might not complain about that, but later ones will. # Await shutdown state change while ($thread_shutdown 2) { Log (Awaiting thread death.); sleep (10); } Log (Application is ended.); # Functions sub Log { my( $Message ) = @_; print $Message.\n; } sub ChildThread { my ($counter) = @_; while (!$thread_shutdown) { Log ('This is the child thread speaking: '.localtime(time())); Win32::Sleep ((rand(12)+1) * 500); } Log ('Thread has ended.'); return 10; } /xmp I don't see what creating a separate thread to do wait for your child/worker threads to terminate, then waiting for it to terminate gives you. It seems to be the very opposite of async. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France
RE: threads package missing is_running (solvedish)
Bill Luebkert wrote: Brian Raven wrote: use vars qw ($counter $thr $thread $threads); Prefer declare variables lexically (i.e. my ...), unless you actually need to do otherwise. Me too. # Asynchronously join threads. $threads = threads-list(); Note that $threads contains a single thread object ... Actually it doesn't - it contains the number of non-joined, non-detached thread objects. True, but only for more recent versions of Perl (certainly 5.10.0). In older versions, certainly in 5.8.5 and probably the OPs which is older, it returns a list. And the result of evaluating a list in a scalar context is the last entry. All of which, IMHO, adds weight to the argument that the OP should upgrade to a later version of Perl if he wants to use threads. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Basic PERL Script
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bernard Hill Sent: 06 May 2008 15:08 To: activeperl@listserv.ActiveState.com Subject: Basic PERL Script Good morning, All. Good afternoon :-) (this is an international forum). Not sure if this list supports basic questions, but I'll pose the query to find out. Shouldn't be a problem. I am new to PERL and working on an basic PERL script. The script will import values into an array. when complete, I want to do a calculation based on two feilds and drop the answer into the third field. Basically I have the following script, but keep getting a syntax error and can't figure out where I've gone wrong: sub { $output = ''; chomp $_[0]; $delim = $_[1]; @input_fields = split /$delim/, $_[0]; # input the values into the array for($i=0; $i$#input_fields; $i++) { if i$ == 2 { # perform the calculation $input_fields[$i] = $input_fields[$i-1] * $input_fields[$i-2]; } output = $output . $input_fields[$i] . $delim; } $output = $output . $input_fields[$#input_fields] . \n; return($output); } Any help is grealy appreciated! You seem to defining an anonymous subroutine that is not assigned to anything. It is hard to see how that could ever be called. Your code would be easier to understand if you indented it appropriately, and posted in plain text rather than html. It is also better to cut paste code, rather than typing it by hand, which I am guessing you did. Also, a short, self contained script, that we can simply copy and run, is better that posting a code extract. If I understand your intention correctly, you seem to be going to a lot of trouble for something that is relatively simple in Perl (note not PERL, 'perldoc -q perl.*Perl'). For example: -- use strict; use warnings; sub do_stuff { my $data = shift; my $delim = shift; chomp $data; my @input_fields = split /$delim/, $data; $input_fields[2] = $input_fields[1] * $input_fields[0]; return join($delim, @input_fields); } my $result = do_stuff(2,3, ,); print Result: '$result'\n; -- HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: threads package missing is_running
[EMAIL PROTECTED] wrote: Hi All, I'm attempting to use the 'threads' module in ActivePerl 5.8.0 build 805. Everything seems to work until I attempt to shut the process down gracefully. When I call is_running() the whole thing crashes with the following output (main thread starts the shutdown after 10 seconds): Starting Thread Test This is the main thread (1) This is the child thread (0) This is the main thread (2) This is the main thread (3) This is the child thread (1) This is the main thread (4) This is the main thread (5) This is the child thread (2) This is the main thread (6) This is the main thread (7) This is the child thread (3) This is the main thread (8) This is the main thread (9) This is the child thread (4) This is the main thread (10) Can't locate auto/threads/is_running.al in @INC (@INC contains: C:/Perl/lib C:/P erl/site/lib .) at thread_test.pl line 26 A thread exited while 2 other threads were still running. I'm including the module as follows: use threads; use threads::shared; use strict; Any idea why it can't find that function? How are you calling it? A small self contained example script that demonstrates the problem would help. Note that your Perl version is pretty old. Perl's threading was not nearly as mature as it is now (and some would say that it is still not mature enough for production use). I recommend installing a much later version. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: threads package missing is_running
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I'd love it if I could just upgrade perl, but corporate bureaucracy sucks and the new versions need approval for security purposes. I initially tried it with 5.6.1 with less success, and 5.8.0 seems to be very close less the is_running issue. All I really need is some way to determine if the thread is still running even if it's checking if the process id exists. When it is, I want to SIGUSR1 the thread. 'threads' is a standard module, so I have no clue why it's having amnesia. The module is found at C:/Perl/lib/threads.pm and not part of the ppm. Here is a short example of threads I'm testing: xmp # Test Threads use threads; use threads::shared; use strict; use vars qw ($counter $thr); Log (Starting Thread Test); $thr = threads-create (\ChildThread, 0, 1); $counter = 0; while ($counter++ 10) { Log (This is the main thread (.$counter. sec)); sleep (1); } # The following gives an error that is_running.al is missing. # Tried threads-list (threads::running) to search and compare: gave bareword error. # Tried $thr-is_running without success: also said is_running.al missing. while ($thr-is_running()) { Log (Killing thread.); $thr-kill('SIGUSR1'); sleep (4); } Log (Thread killed.); # Functions sub Log { my( $Message ) = @_; print $Message.\n; } sub ChildThread { my ($counter, $to_screen) = @_; my $count = 0; our $thread_term = 0; $SIG{'SIGUSR1'} = sub { Log('Received user1 notice.'); $thread_term = 1; return 0; }; $SIG{'KILL'} = sub { Log('Received kill notice.'); $thread_term = 1; return 0; }; while (!($thread_term)) { Log ('This is the child thread ('.($count++ * 2).' sec)'); sleep (2); } Log ('Thread has ended.'); } /xmp It occurs to me that you might be using the documentation for a later version of Perl than you are using. The function is_running is documented in 5.10.0, but not in an older version (5.8.5) that I have. Neither is the kill function come to that. Try something like the following, which seems to work in my older version. use strict; use warnings; use threads; use threads::shared; my $thread_term : shared = 0; Log (Starting Thread Test); my $thr = threads-create (\ChildThread, 0, 1); my $counter = 0; while ($counter++ 10) { Log (This is the main thread (.$counter. sec)); sleep (1); } terminate(1); $thr-join(); Log (Thread killed.); # Functions sub Log { my( $Message ) = @_; print $Message.\n; } sub ChildThread { my ($counter, $to_screen) = @_; my $count = 0; while (!terminate()) { Log ('This is the child thread ('.($count++ * 2).' sec)'); sleep (2); } Log ('Thread has ended.'); } sub terminate { lock $thread_term; $thread_term = $_[0] if defined $_[0]; return $thread_term; } HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: ActivePerl-5.8.8.822-MSWin32-x86-280952.msi HTML documentationmalformed
David Christensen wrote: activeperl: The following message bounced because it had an attachment. I have posted the original message and the screenshot to my Drupal site: http://www.holgerdanske.com/node/141 Any suggestions? This has come up before. Possible solutions: 1. Use a later version of Activestate Perl. 2. Use a different browser, e.g. firefox seemed to work OK 3. Fix the stylesheet, see a previous thread http://aspn.activestate.com/ASPN/Mail/Message/ActivePerl/3549698 HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Advice on hash sizes please
Barry Brevik wrote: I am now writing some database extraction utilities at the company I work for, using Perl on Windows 2000/XP. There are several static tables I download via ODBC that I perform lookups into... An ideal application for a hash. After the 5th table, I started to worry about how much memory this was using, so I checked the combined size of these hashes, and it came to about 64KB. This is without factoring-in the hash overhead. The app runs well right now, but I'm concerned about breakage going forward. Since this is used in-house, I can guarantee that the app will always run on a machine with at least 2 GB of RAM and a 4 GB swap file. The user might also be running a couple of Office apps, but that would be all. Granted that the answer to this question includes *many* variables I have not addressed, is there still some sort of guideline I can use to determine how much memory tied up in hashes is too much? If you want to get a better picture of how much memory your hashes are using, then something like Devel::Size might help, but I think you will need considerably more than 64kb to give you any problems. Of course if you are worried about the size of your hashes, it is generally recommended to store them on disk, using Tie and the DB modules, but you pay a penalty in access times, ... ... or alternatively store your hashes in a database! Also, if I reinitialize an existing hash to (), will that return the memory to Windows? Perl may well return some freed memory to the OS in some circumstances, but don't rely on it. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Redefining Constants
Zarabozo, Francisco (GE, Corporate) wrote: Hello All, I'm having some trouble with a module where I need to implement a change. Basically, this module defines constants that other modules will use at a later time. I need to detect parameters in the import() sub (that's the requested change) and, if the case, redefine some of those constants. I'm trying with evals but all I'm getting is a warning about constant redefined, AND the constant is not really changing (it keeps its previous value). No. It will be complaining about a subroutine being redefined. Is there a way to correctly redefine a constant at import() time? I would hope not! That would subvert the whole concept of a constant. However, ... Here is a simple example of the scene: Script.pl - use strict; use warnings; use myModule constantA = 'foo'; - myModule.pm - package myModule; use strict; use warnings; use constant constantA = 'bar'; sub import { my %params = @_; if ($params{constantA}) { # This should change constantA from 'bar' to 'foo' eval 'use constant constantA = \''.$params{constantA}.'\''; warn $@ if $@; } } - Any comments are highly appreciated. While this appears to do what you want (at least it does after modification), the warning about redefinition of a subroutine may be hard to inhibit without changing constant.pm. One way would be to avoid redefining any subroutines, e.g. use strict; use warnings; package myModule; our %defaults = (constantA = 'bar'); sub import { my $module = shift; my %params = @_; foreach my $k (keys %defaults) { my $val = defined($params{$k}) ? $params{$k} : $defaults{$k}; eval qq{use constant $k = '$val'}; warn $@ if $@; } } 1; -- Its not entirely clear what you are trying to achieve, but I don't think that variable constants (i.e. constants that are not constant) is a good way to do it. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Determine the OS
Rolando A Ampuero wrote: I need to determine the type of OS/Architecture that a script is running on. Whether is linux 32, linux 64, Windows 32, Windwows 64, etc. Is there a clever way in Perl to find this out without doing a system call? The special variable $^O will probably not be suitable for that level of detail, so see 'perldoc Config'. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Determine the OS
Stuart Arnold mailto:[EMAIL PROTECTED] wrote: From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Raven Sent: Thursday, February 28, 2008 5:03 AM To: activeperl@listserv.ActiveState.com Subject: RE: Determine the OS Rolando A Ampuero wrote: I need to determine the type of OS/Architecture that a script is running on. Whether is linux 32, linux 64, Windows 32, Windwows 64, etc. Is there a clever way in Perl to find this out without doing a system call? The special variable $^O will probably not be suitable for that level of detail, so see 'perldoc Config'. HTH For windows, its quite a mess! You can start by looking at 'Win32.pm' and the function 'Win32::GetOSVersion()' But that will get you only so far. You may want to look at how to get some of Windows internals by getting 'ScriptomaticV2.hta' from MS to see some internals. Not sure of *NIX ways. Hmmm... my original post missed the point that the OP was interested in the platform that the script was running on (I blame lack of caffeine). The Config module is created at build time, so its information may not be accurate at run time (e.g. you could have a 32 bit build running under a 64 bit OS). Getting detailed information about the platform on which a script is actually running is going to be platform specific, and it is almost certainly going to involve system calls, or running external commands (e.g. the uname command on *nix). I suppose that the 'clever' answer would be avoid write scripts that need to know that (see 'perldoc perlport' perhaps)! HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: URL Trimming s{} regex
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 12 February 2008 20:05 To: activeperl@listserv.ActiveState.com Subject: URL Trimming s{} regex Hi, all. I'm having a relatively simple problem, trying to trim stuff off the end of a URL. INPUT: http://www.wilbert.net www.worful.com/after-text.htm http://www.winston.com/argle.htm www.windoze.net DESIRED OUTPUT: http://www.wilbert.net www.worful.com http://www.winston.com www.windoze.net Presently I'm trying the code: if ($site =~ m{[^:/]/.*$}) { $site =~ s{/.+}{}; } which gives me the output: http://www.wilbert.com www.worful.com http: www.windoze.net Obviously I'm doing something wrong for the third string, but I've pulled out two or three hairs by now, trying to fix this. Anybody care to take a shot? It can help to answer your question if you also say what you are trying to achieve. Somebody might be able to direct you at a module that could help with your problem. For example, the following code doesn't do exactly what you ask, but it could be closer to what you need. -- use strict; use warnings; use URI::URL; while (my $d = DATA) { chomp $d; my $url = URI::URL-new($d); $url = URI::URL-new(http://$d;) unless $url-scheme; print $url-scheme, ://, $url-host, \n; } __DATA__ http://www.wilbert.net www.worful.com/after-text.htm http://www.winston.com/argle.htm www.windoze.net -- ... but then again, maybe not. Just a thought. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: How to avoid subroutine redefined warning Strict ref problem
Mark Knoop wrote: Hi I am not sure if these two problems are related or not. I am new to writing class moodules. I have a class which I use to store a load of values when calling a CGI app. One of them is the url which I get using the url function from CGI and then store in my global class. It makes sense to me to call it url even though this clashes with the CGI function. This has been working fine but I have now added a getter method to my globals module and it has broken it in two ways. The following code recreates the error. Example.pm # package Example; use strict; use warnings; use CGI qw(:cgi); This imports a number of CGI names into your package namespace, including url. If you want to call your subroutine url then you can't import the CGI sub of the same name. So, remove the qw(:cgi). sub new { my $class = shift; my $self = {}; $self-{url} = url(-path_info=1); As the CGI::url sub is no longer imported into this namespace you will have to fully qualify that call, e.g. $self-{url} = CGI::url(-path_info=1); or possibly using a CGI object my $cgi = CGI-new; $self-{url} = $cgi-url(-path_info=1); bless ($self, $class); return $self; } sub url { my $self = shift; return $self-{url}; } 1; ## example.pl ### use strict; use warnings; use Example; my $ex = Example-new; print $ex-url; Expected output: This should print the url which run in this example on my laptop defaults to http://localhost and works if I take out the use strict and warnings. Actual output: With use strict and warnings though I get Subroutine url redefined at Example.pm line 22. Can't use string (-path_info) as a HASH ref while strict refs in use at Exam ple.pm line 26. Is there some clever namespace thing I can do to avoid the first warning without renameing my method? Yes, see above. Depending on what you are trying to do, you might also consider inheriting from CGI. Any idea on what is causing the second error message? As the first warning says, the sub has been redefined. The first clue is the line number which is in your url sub. More specifically, the line return $self-{url};, which attempts a hash dereference (-{}) of the first parameter (the string -path_info), which isn't a hash reference. That is, the url call in your new sub is calling your url sub, not the CGI one. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Wrapping up a SOAP::Lite service in a class
Mark Knoop wrote: Hi It's Mark's class workshop today :) I want to wrap up a SOAP service handle (returned from a call to a wsdl file) in a class (ultimately so I can make it a singleton and only call it once but we'll leave that for the purposes of this example). So if I have something like this (calling a random public SOAP service) use strict; use warnings; use SOAP::Lite; use Data::Dumper; my $service = SOAP::Lite-service('http://ws.cisa.ca/WehireWS/JobsWs.asmx?WSDL'); my $result = $service-GetAll; print Dumper($result); It works fine and I get $VAR1 = { 'JobDetail' = { 'PostingDate' = '1/30/2006', 'Location' = 'British Columbia', 'Url' = 'http://www.wehire.ca/view.php?job_id=1408', 'Category' = 'Construction', 'Company' = 'XS West Construction Group', 'Title' = 'Equipment Operator' } }; However if I try to abstract it into my own class eg # package Soap; use strict; use warnings; use SOAP::Lite; sub new { my $class = shift; my $self = SOAP::Lite-service('http://ws.cisa.ca/WehireWS/JobsWs.asmx?WSDL'); bless ($self, $class); return $self; } 1; use strict; use warnings; use Soap; use Data::Dumper; my $service = Soap-new; my $result = $service-GetAll; print Dumper($result); # I get Can't locate object method GetAll via package Soap at soap2.pl line 6. I don't expect anyone to read the SOAP::Lite documentation for me but I am wondering whether there is anything fundamentally flawed in my approach? Yes there is. Basically, you are re-blessing the object returned by SOAP::Lite::service into your package namespace, and I don't see a subroutine named GetAll defined there. You should store the returned object in a container (hash or array), which you bless into your package namespace. But that only fixes the first part of your problem, you still don't have a subroutine named GetAll. You can delegate subroutine calls to your class using the AUTOLOAD feature, see at least 'perldoc perlobj' and 'perldoc perltoot' for help with that. However, do you really want to go to all that trouble when all you seem to be doing is hiding the service URL and only calling SOAP::Lite::service once? The following would seem to be a simpler way for Soap.pm to accomplish that: -- use strict; use warnings; package Soap; use SOAP::Lite; our $service; our $url = 'http://ws.cisa.ca/WehireWS/JobsWs.asmx?WSDL'; sub service { $service = SOAP::Lite-service($url) unless defined $service; return $service; } 1; -- Then all you need in Soap.pl is: -- use strict; use warnings; use Soap; use Data::Dumper; my $result = Soap::service-GetAll; print Dumper($result); -- HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France
RE: stat, readdir, opendir and friends
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Raful Mr Mitchell H Sent: 01 February 2008 14:26 To: Activeperl (E-mail) Subject: stat, readdir, opendir and friends I have tried using both DirHandle as well as the tradition opendir and readdir to get the mode. Depending on the directory I open, directories are somtimes found and sometimes they are skipped. However, the .. is never skipped over and is identified as a dircotry. Any ideas? Sorry, but I find it really hard to work out what it is you are asking for, or what your problem is. Perhaps you could explain what it is that you are trying to accomplish. A short example script that demonstrates your problem would also help. The more you help us to help you, the easier it is to help you. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: invoke script
Campbell, Scott wrote: Mario, try taking a look at the LWP module, in particular LWP::UserAgent. If you are attempting to hit an HTTPS url, you will also need to use Crypt::SSLeay. Without anything more specific from the OP, I would have suggested LWP::Simple first as it is easier to use, but in any event look at 'perldoc lwptut' and 'perldoc lwpcook'. HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Questions on porting Perl from Windows to Unix
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gary Yang Sent: 24 January 2008 19:17 To: activeperl@listserv.ActiveState.com Subject: Questions on porting Perl from Windows to Unix Hi All, I need to port my Perl script from Unix to Windows. Can someone tell me how to figure out which platform I am on? i.e. I need to know which Perl command can help me determin the platform. Once I know the platform, I'll code my script as the example bellow. But, how to figure out I am on Windows or Unix? if ($usingUNIX) { $directory = `ls`; #UNIX version. $copyCommand = `cp`; #UNIX version. } else { $directory = `dir`; #Win32 version. $copyCommand = `COPY`; #Win32 version. } First, it is probably better if you write your scripts so that you don't need to ask, i.e. aim for platform independence. Where this is not possible there is the special variable $^O (See 'perldoc perlvar' for details). If you need more detailed info about your platform you will need the Config module (See 'perldoc Config'). Also see the Activestate documentation for windows specific help. Second question: The UNIX #!/usr/bin/perl notation does not work with Perl scripts on Windows. How should I code if it is Unix I place #!/usr/bin/perl at the very first line of the script? But, I do not place it at the first line of code if it is not Unix? How should I do it? The #! notation us unix specific. Win32 achieves a similar effect by associating file extensions with a specific executable, called file association and managed with the assoc command, but I think that the Activestate installation procedure sets up the necessary associations for Perl, so you shouldn't need to. If you use the #! line for to specify run time switches you can still do that as perl will parse that as well (see 'perldoc perlrun'). HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Help separating arrays?
Mike Gillis wrote: Chris Prather wrote: my %names = (@fieldspecs); my @names = keys %names; # works if the files are *always* evenly paired The problem with this is that it doesn't preserve order. $ perl -le 'my %names = qw(a 1 b 1 c 1); print join(, , keys %names);' c, a, b You can preserve the order with Tie::IxHash, e.g. -- use strict; use warnings; use Tie::IxHash; my @fieldspecs = qw ( JobNum14 ProjectID 25 PartNum2 50 ProdQty13 15.2 ); tie my %hash, Tie::IxHash, @fieldspecs; my @names = keys %hash; print @names\n; -- ... or alternatively, if you don't want to use a hash, just extract the array entries with even indices: my @names = @fieldspecs[grep {$_ % 2 == 0} 0..$#fieldspecs]; print @names\n; HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Regarding using MLDBM with Storable
Roman Daszczyszak wrote: I have ActivePerl 5.8.8 build 820 installed, and used ppm to pull down the MLDBM module. I am trying to use Storable for the data serializer for MLDBM with a DB_HASH, but when I tried to test it, it returned this error: Can't locate auto/Storable/TIEHASH.al in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .) at C:/Perl/site/lib/MLDBM.pm line 143 I'm using the Storable that came with the distribution, so I'm not sure how to obtain whatever is missing. Can anyone point me in the right direction? Here is my test code: -- #!/perl/bin/perl use strict; use warnings; use Data::Compare; use Data::Dumper; use MLDBM qw(Storable); It looks like MLDBM expects the first 'use' parameter to be the DB package, and the second to be the serializer, although I don't think that is made very clear in the documentation. At least, that would be my guess from a quick look at the import function. See the examples in the documentation. They either have no 'use' parameters or 2, e.g. use MLDBM qw(DB_File Storable); Either that, or try the UseDB and/or Serializer methods. As an aside, it does seem quite old. Untouched for over 5 years. Still, if it does the job ... HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Trying to map an array into a hash
[EMAIL PROTECTED] wrote: didyou expect the comments to be removed automatically? Hmm (note the @ary/@data change) my %hash = map { split /\s\|/ } grep { /\|/ } @data; # line 76 Making sure that split can't produce more that 2 fields may be a bit safer, just in case there is a second occurrence of the separator. my %hash = map { split /\s\|/, $_, 2 } grep { /\|/ } @data; HTH -- Brian Raven = Atos Euronext Market Solutions Disclaimer = The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. = ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs