RE: Help with regex

2011-06-30 Thread Joe Discenza
Barry,

: I am trying to truncate a string so that it is only 39 characters long.
: The application is a label printing routine, and the label is only long
: enough to print 39 characters.

Wrong tool. Look for "substr".

Joe

Joseph Discenza
Senior Analyst/Software Developer 

  
1251 N. Eddy Street, Suite 202
South Bend, IN 46617- 1478
Phone: 574.243.6040 Ext. 233    
Fax:  574-243-6060

www.carletoninc.com
Visit our blog at:  carletoncompliance.blogspot.com

This email message is intended only for the addressee(s) and contains 
information that may be confidential and/or copyrighted.  If you are not the 
intended recipient, please notify the sender by reply email and immediately 
delete this email.  Use, disclosure or reproduction of this email by anyone 
other than the intended recipient(s) is strictly prohibited.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Acrobat::FDF and 5.6 vs. 5.8 or 5.10

2010-04-28 Thread Joe Discenza
We've been doing form filling using FDFs, using the FDF.pm. When Perl
5.8 came out, we couldn't quite make it work (I no longer remember any
specifics), but we could always instruct our clients to install Perl
5.6.

Now ActiveState has taken 5.6 down. Our sysadmin thought to try 5.10,
and in that installation, we get this error (after installing
Acrobat::FDF):

Error Type:
PerlScript Error (0x80004005)
Can't load 'C:/Perl/lib/auto/Acrobat/FDF/FDF.dll' for module
Acrobat::FDF: load_file:The specified module could not be found at
C:/Perl/lib/DynaLoader.pm line 201. at C:/Perl/lib/Acrobat/FDF.pm line
721 Compilation failed in require at (eval 2) line 53. BEGIN
failed--compilation aborted (in cleanup) Can't load
'C:/Perl/lib/auto/Acrobat/FDF/FDF.dll' for module Acrobat::FDF:
load_file:The specified module could not be found at
C:/Perl/lib/DynaLoader.pm line 201. at C:/Perl/lib/Acrobat/FDF.pm line
721
----
Any ideas?

Joe

Joseph Discenza, Senior Programmer/Analyst
mailto:jdisce...@carletoninc.com

Carleton Inc. http://www.carletoninc.com
574.243.6040 ext. 300
Fax: 574.243.6060

"Providing Financial Solutions and Compliance for over 35 Years"

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Adding matched files to zip archive

2008-01-29 Thread Tseng, Joe [CONTRACTOR]
I have mostly figured out how to add files to a zip archive using
Archive::Zip::addTreeMatching but I'm getting hung up on what seems to
be a subtle point.  I have a line that adds files to an archive
directory if they're text or INI files:
 
$objZip->addTreeMatching( $workingdir, 'config', "\.(ini|txt)");
 
But the following line doesn't work for adding what is remaining to
another archive directory :
 
$objZip->addTreeMatching( $workingdir, 'results', "!\.(ini|txt)");

I'm sure I'm overlooking something minor; assistance is always greatly
appreciated!
 
 - Joe
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: localtime failing on DST change

2007-03-13 Thread Dial, Joe
 
Hello $Bill,
I love reading your answers to other people's problems.  I hope I can
help you.
Microsoft announced that there is a patch to the MSVCRT.DLL which may be
used by the perl executable.
I don't know the windows equivalent to ldd to be sure MSVCRT.DLL is used
by perl, but if it is, then Microsoft's
KB article number 932950  (URL: http://support.microsoft.com/kb/932590)
seems directly related to the issue
you describe.

Hope this helps,
Joe Dial
"Long Time Lurker"

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Bill Luebkert
Sent: Tuesday, March 13, 2007 10:25 AM
To: [EMAIL PROTECTED]
Cc: Jan Dubois
Subject: localtime failing on DST change

My 'localtime' function output doesn't reflect DST since the Sunday
changeover.

System: XP Pro; Perl B811

The earlier DST change time seems to be picked up OK by Windoze clock.
There
was some mention of the table changes by Microsoft I believe and there
is some
info at http://support.microsoft.com/gp/dst_hu1 based on user type.

GetTimeZoneInformation API call looks OK to me - here's all the
pertinent
output:

ActiveTime:
'-52588' (BIN)
DaylightBias:
'-60' (DW)
StandardBias:
'0' (DW)
DaylightName:
'Pacific Daylight Time' (SZ)
StandardStart:
'720896' (BIN)
ActiveTimeBias:
'420' (DW)
Bias:
'480' (DW)
DaylightStart:
'196608' (BIN)
StandardName:
'Pacific Standard Time' (SZ)

GetTimeZoneInformation ret: 2 (Daylight Savings Time)

UTC bias from localtime: 480

StandardName: Pacific Standard Time
SYear: 0
SMonth: 11
SDayOfWeek: 0
SDay: 1
SHour: 2
SMinute: 0
SSecond: 0
SMilliseconds: 0
StandardBias: 0

DaylightName: Pacific Daylight Time
DYear: 0
DMonth: 3
DDayOfWeek: 0
DDay: 2
DHour: 2
DMinute: 0
DSecond: 0
DaylightBias: -60

StandardDate: first Sunday of November at 2
StandardDate-raw: 0-11-0-1-2-0-0-0
DaylightDate: second Sunday of March at 2
DaylightDate-raw: 0-3-0-2-2-0-0-0

However localtime returns the following:

Perl localtime: Tue Mar 13 05:56:54 2007

Actual time is 06:56 PDT not 05:56 PST.

GMT  : 54 56 13 13 2 107 2 71 0
GMT  : yr=2007, mo=3, day=13, hr=13, min=56, sec=54, DST=no

Local: 54 56 5 13 2 107 2 71 0
Local: yr=2007, mo=3, day=13, hr=5, min=56, sec=54, DST=no

Note the isdst field (last element) is set to 0 (off) and the time is
off
by an hour.

Registry SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation shows
the
following values:

ActiveTime:
'-52588' (BIN)
DaylightBias:
'-60' (DW)
StandardBias:
'0' (DW)
DaylightName:
'Pacific Daylight Time' (SZ)
StandardStart:
'720896' (BIN)
ActiveTimeBias:
'420' (DW)
Bias:
'480' (DW)
DaylightStart:
'196608' (BIN)
StandardName:
'Pacific Standard Time' (SZ)

Microsoft has this info
http://msdn2.microsoft.com/en-us/vstudio/bb264729.aspx
and other Q&A :

Q: I'm a C++ developer who uses the TZ environment variable,
what does this
mean to me?

A: For customers who rely on the TZ environment variable for the
DST
information, they will get outdated DST information for 2007 and
beyond (i.e.,
they will get DST information according to the previous system).
Microsoft is
currently working on a fix for this issue and will post
information about its
availability on the Visual Studio Support page. In the interim,
developers are
advised to test their applications to determine the impact of
the DST update
on their applications. This issue is also fixed in Visual Studio
code name
"Orcas".
Support page:
http://msdn2.microsoft.com/en-us/vstudio/aa718682.aspx
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Counting Matches In A Line

2006-12-05 Thread Joe Discenza
EwenMarshall wrote, on Tuesday, December 05, 2006 2:23 PM

: All I want to do is count the number of ;'s on each line of 
: 15,000'ish lined text file. The first 3 lines look like 
: (FINISH; is the end of 1 line):
: 
: NEW ANALOGUE; A.PS.19.601; 0;  4;NA;  0;OFF;%;NO;  100.0;
: 0.0;"ANALOGUE CARD #100 INPUT NO 01";FLOAT;FINISH;
: NEW ANALOGUE; A.PS.19.602; 1;  4;NA;  0;OFF;%;NO;  100.0;
: 0.0;"ANALOGUE CARD #100 INPUT NO 02";FLOAT;FINISH;
: NEW ANALOGUE; A.PS.19.603; 2;  4;NA;  0;OFF;%;NO;  100.0;
: 0.0;"ANALOGUE CARD #100 INPUT NO 03";FLOAT;FINISH;
: 
: Output: 
: found 14 ; in 1,232 lines
: found 13 ; in 7,456 lines
: found 12 ; in 2,321 lines

I think this is what you want (only slightly tested):

my @semis;
while ()
{
++$semis[tr/;/;/];
}

The tr/// operator counts all the occurrences of the translated
character(s) in $_ (the default), and then you just increment the @semis
array at the index of the number of semicolons found to indicate another
line with that number of semicolons.

Good luck,

Joe

Joseph Discenza, Senior Programmer/Analyst
mailto:[EMAIL PROTECTED]

Carleton Inc. http://www.carletoninc.com
574.243.6040 ext. 300
Fax: 574.243.6060
  

: -Original Message-
: From: [EMAIL PROTECTED] 
: [mailto:[EMAIL PROTECTED] On 
: To: Perl-Win32-Users@listserv.ActiveState.com
: Subject: RE: Counting Matches In A Line
: 
: 
: I only need total number of lines found. I do not know what 
: the max or min amount of ;'s there can be in one line.
: 
: Ewen
: 
: -Original Message-
: From: [EMAIL PROTECTED]
: [mailto:[EMAIL PROTECTED] On 
: Behalf Of Chris Wagner
: Sent: 05 December 2006 18:50
: To: Perl-Win32-Users@listserv.ActiveState.com
: Subject: Re: Counting Matches In A Line
: 
: We need some more information.  What is the match condition 
: and how do u find the number of matches?
: 
: If ur just trying to record the number of "something" per 
: line so that u can go back and correlate the number to the 
: line, then u can't use foreach.  U have to iterate over the 
: array so u can get the offset.
: 
: for $i (0 .. $#data) {
: $number = 0 + do_something;
: $matchcount[$i] = $number;
: }
: 
: Now $matchcount[$i] corresponds to the number of matches in $data[$i].
: 
: 
: 
: 
: 
: 
: --
: REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=--
: "...ne cede malis"
: 
: 0100
: 
: ___
: Perl-Win32-Users mailing list
: Perl-Win32-Users@listserv.ActiveState.com
: To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
: 
: ___
: Perl-Win32-Users mailing list
: Perl-Win32-Users@listserv.ActiveState.com
: To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
: 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: what?!? [OT]

2006-10-18 Thread Joe Discenza





  [EMAIL PROTECTED]  wrote, 
  on Wednesday, October 18, 2006 9:06 AM
   
   What makes you think there'll still be 
  32-bit machines around in 2038. I'd expect to see them only in museums by 
  then--being used as paperweights, door-stops, etc. 

 
Isn't that what they said in the 60s? "No way will they 
be using this program in thirty-five years; of course we can use a two-digit 
year!"
 
Joe
 
Joseph Discenza, Senior Programmer/Analystmailto:[EMAIL PROTECTED]Carleton 
Inc. http://www.carletoninc.com574.243.6040 
ext. 300Fax: 574.243.6060  
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: how to initialize an array

2006-10-17 Thread Joe Discenza
Su, Yu (Eugene) wrote, on Monday, October 16, 2006 8:52 PM
: How to initialize an array? I want to get a median by using 
: Statistics::Descriptive.
: I enter (12, 13, 14), (15, 16, 17), (16, 17, 18) I expect 
: 13,16,17. Instead, I get 13.00, 14.50, 16.00.
: 
: I thought my @temp_array=(); in the median sub (see code 
: snippet below) will get me new array. But I am wrong. How do 
: I initialize an array in my example?

Your array looks fine. To me, the suspicious line is this:

:   $stat->add_data(@temp_array); 

I've never used Statistics::Descriptive, but I bet it keeps all the
previous data. There should be a "clear" method somewhere; if not,
you'll need a new object each time.

Joe

Joseph Discenza, Senior Programmer/Analyst
mailto:[EMAIL PROTECTED]

Carleton Inc. http://www.carletoninc.com
574.243.6040 ext. 300
Fax: 574.243.6060
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Problem returning empty Safearray from OLE Component

2006-10-16 Thread Joe Discenza



Kevin Godden wrote, on Monday, October 16, 2006 10:21 
AM

:   saBound.cElements = 
elementCount;
:   
SAFEARRAY* pA = SafeArrayCreate(VT_I4, 1, 
&saBound);
 
While the loop is 
protected by checking elementCount, the SafeArrayCreate call is not, so it is 
almost surely the source of the error. Is it legal to pass an saBound struct 
with cElements set to 0 (I have no idea)? Should you simply return NULL if 
elementCount is 0, or do you have to return a SafeArray even with no 
elements?
 
Joe
Joseph Discenza, Senior Programmer/Analystmailto:[EMAIL PROTECTED]Carleton 
Inc. http://www.carletoninc.com574.243.6040 
ext. 300Fax: 574.243.6060
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Working Out Dates

2006-09-07 Thread Joe Discenza
Ewen Marshall wrote, on Thursday, September 07, 2006 2:18 PM
: my @date_time = localtime();
...
: my $mysql_today = "$year-$month-$monthday"; # Todays date in mysql
format 
: my $mysql_minus1 = "$year-$month-" . (sprintf("%02d", $monthday - 1));
# yesterdays date in mysql format

I like the suggestion of using the MySQL "INTERVAL" function. But if you
really want to do it in Perl, explicitly get the current time in seconds
before breaking it out with localtime(). Then do manipulations on that
(my $yesterday = $today - 86400;) and break *those* out with localtime()
as well.

Joe

Joseph Discenza, Senior Programmer/Analyst
mailto:[EMAIL PROTECTED]

Carleton Inc. http://www.carletoninc.com
574.243.6040 ext. 300
Fax: 574.243.6060
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Regular expression question

2006-08-01 Thread Joe Discenza
Title: Regular expression question



Cai, Lucy (L.) wrote, on Monday, July 31, 2006 8:21 
PM
: My 
$file = "c:\temp\zips\ok.txt"; 

: How can 
I split the $file to get the only path: 
: My $dir 
= "c:\temp\zips"; : My $file = "ok.txt"; 
May I 
suggest you use File:Basename instead of a regex?
Joe
Joseph Discenza, Senior Programmer/Analystmailto:[EMAIL PROTECTED]Carleton 
Inc. http://www.carletoninc.com574.243.6040 
ext. 300Fax: 574.243.6060  
 

  
  
  From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of 
  : Cai, Lucy (L.); perl-win32-users@listserv.ActiveState.com; 
  perl-unix-users@listserv.ActiveState.com; 
  [EMAIL PROTECTED]; 
  [EMAIL PROTECTED]Subject: Regular 
  _expression_ question
  
  I have a file such as: 
  Thanks in advance! 
  Lucy 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Sort not fixing order in equivalent subsequences

2006-05-05 Thread Joe Discenza
"Veli-Pekka Tätilä" wrote, on Friday, May 05, 2006 12:34 PM
: > I can't find anything in the doc about whether Perl's sort function 
: > maintaining the order in equivalent subsequences.
: 
: Hi,
: You could take a look at:
: 
: Perl\html\lib\sort.html
: 
: To summarize V5.8 seems to be using the merge sort algorithm 
: which is stable, i.e. maintains the original ordoring in 
: elements that are determined to be equal. 5.6 and earlier use 
: a quick sort by default and it is not stable. In 5.8 at 
: least, you can choose which algorithm should be used with the 
: sort pragma that the above HTMl page in Active State Perl documents.

Thanks to all who responded. Unfortunately, I'm stuck with 5.6 due to a 
third-party module that breaks with 5.8. Also, to those who suggested a 
two-criteria sort, I perhaps misled you by using 'a', 'b', etc.; the names 
don't come in a sorted order, but are read from a user preference file and we 
want to maintain that order. Unless ... I could also store the index in the 
hash ref (seems a little wasteful, but would solve the problem).

Thanks again,

Joe

Joseph Discenza, Senior Programmer/Analyst
mailto:[EMAIL PROTECTED]

Carleton Inc. http://www.carletoninc.com
574.243.6040 ext. 300
Fax: 574.243.6060
  


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Sort not fixing order in equivalent subsequences

2006-05-05 Thread Joe Discenza



Hello all,
 
I can't find anything in the doc about whether Perl's sort 
function maintaining the order in equivalent subsequences. Suppose I have an 
array of hashrefs that looks like this:
 
{name => 'a', status => 0}, {name => 'b', status 
=> 1}, {name => 'c', status => 1}, {name => 'd', status => 
0}
 
and I sort { $a->{'status'} <=> $b->{'status'} 
}
 
Should I expect the result (order of the names) to 
always be ('a', 'd', 'b', 'c'), or could it be, for example, ('d', 'a', 'b', 
'c') (i.e., could two entries with the same status value change relative 
order)?
 
Joe
 
Joseph Discenza, Senior Programmer/Analystmailto:[EMAIL PROTECTED]Carleton 
Inc. http://www.carletoninc.com574.243.6040 
ext. 300Fax: 574.243.6060
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Replace Leading Spaces (fwd)

2006-04-11 Thread Joe Discenza
Thomas, Mark - BLS CTR wrote, on Tuesday, April 11, 2006 10:28 AM
: $Bill Luebkert wrote:
: >  Rate  RE2  RE5  RE3  RE4  RE1 RE1a
: > RE2  136761/s   -- -58% -61% -64% -74% -74%
: > RE5  326584/s 139%   --  -6% -14% -37% -37%
: > RE3  347705/s 154%   6%   --  -9% -33% -33%
: > RE4  381098/s 179%  17%  10%   -- -26% -26%
: > RE1  516529/s 278%  58%  49%  36%   --  -0%
: > RE1a 516529/s 278%  58%  49%  36%   0%   --
: > 
: > 1  $str =~ s/\s(?=\s*\S)/0/og;
: > 1a $str =~ s/\s(?=\s*\S)/0/g;
: > 2  1 while ($str =~ s/\s(?=(\d|\.))/0/);
: > 3  $str =~ s/^(\s+)(?=\d)/'0' x (length $1)/e;
: > 4  $str =~ s/^(\s+)/sprintf "%s", q[0]x length($1)/eg;
: > 5  $str =~ s/ (?=.*\d)/0/g;
: 
: What surprises me is the substantial difference between the 
: lookahead expressions, RE1a and RE5. Can anyone explain why 
: there's such a difference?

I think I can explain it. When (5) sees the .*\d, the .* grabs all the
characters, then the RE engine backs up until it "releases" a digit to
match the \d. (1a), on the other hand, just grabs spaces with \s*; it
isn't allowed to grab anything else.

Perhaps a (5a), having .*?\d, thus making the engine stop at every
character to see if it's a digit before adding it to the .*?, would
bring it more into line with (1a) speed-wise.

Joe

Joseph Discenza, Senior Programmer/Analyst
mailto:[EMAIL PROTECTED]

Carleton Inc. http://www.carletoninc.com
574.243.6040 ext. 300
Fax: 574.243.6060

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Win32::OLE - Mem Leak? (FIXED)

2006-03-30 Thread Joe Discenza
Paul Sobey wrote, on Thursday, March 30, 2006 1:10 PM
: my $result_count = $ResultSet->{count};
: my $enum = Win32::OLE::Enum->new($ResultSet);
: 
: # print "Got $result_count items in set\n";
: for ( 1 .. $result_count ) {
: my $result = $enum->Next;

Instead of getting a count and explicitly iterating, could you just use
the method suggested in the Win32::OLE::Enum doc? I.e., replacing the
above four lines with:

  my $enum = Win32::OLE::Enum->new($ResultSet);
while (defined(my $result = $enum->Next)) {

Or does that still have the leak?

Joe

Joseph Discenza, Senior Programmer/Analyst
mailto:[EMAIL PROTECTED]

Carleton Inc. http://www.carletoninc.com
574.243.6040 ext. 300
Fax: 574.243.6060

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Regex Needed

2006-03-24 Thread Joe Discenza
Paul Rousseau wrote, on Friday, March 24, 2006 12:38 PM

:I am looking for help on a regex that examines strings such as
: 
: "xxxN yyy sssNNN"
: "xxxN yyyNyyy sss"
: "xxxN yyyNyyy ssN"
: 
: and returns only the sss part?  N is always a numeral, and s 
: is always alphabetic.

Does /.*(\d+)/ do what you want? Or is there more to the string after
what you've shown?

Good luck,

Joe

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Reg Expression Help

2006-03-23 Thread Joe Discenza



Scott Purcell wrote, on Thursday, March 23, 2006 3:05 
PM
 
: '^[a-zA-Z0-9-_. 
]+$'
 
The others helped you get [] in 
there. But hyphen (dash) has to be first, or it looks like a range operator. So 
try:
 
^[-a-zA-Z0-9_. 
\[\]]+$
 
Good 
luck,
 
Joe
 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Need help with range operator

2006-03-17 Thread Dial, Joe

Hi,
When I read the first post, I remembered seeing that somewhere before.
Then, I was amazed to see the "this is not what the range operator was
meant to do." 

So, I looked for it.  Found it in chapter 6 of the Perl Cookbook. Its
Recipe 6.8.
See this URL: http://www.unix.org.ua/orelly/perl/cookbook/ch06_09.htm

I don't understand exactly why the original posted code doesn't work,
but is remarkably
similar to that recipe.

Just had to weigh in...

Joe Dial
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Craig Cardimon
Sent: Friday, March 17, 2006 10:35 AM
To: activeperl@listserv.ActiveState.com
Cc: perl-win32-users@listserv.ActiveState.com
Subject: Re: Need help with range operator

Thanks for the replies, folks! I got all kinds of responses.

I've seen a "here's one way to do it," a "we could use more information
on what you're trying to do," and a "this is not what the range operator
was meant to do."

It's kind of fascinating, really. List members use perl for different
tasks, and our ideas vary a lot, it seems, on how perl should be used.

Keeps things from getting boring.

-- Craig



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0611-2, 03/17/2006
Tested on: 3/17/2006 10:35:10 AM
avast! - copyright (c) 1988-2004 ALWIL Software.
http://www.avast.com




___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Perl Bug (again)

2006-02-17 Thread Joe Discenza
Title: RE: Perl Bug (again)






 John Deighan wrote, on Fri 17-Feb-06 12:46
: my($nextID,$maxID) = @$L if $L;
:
: The parameter to getCached, $Customer, has a different value than
: during the first call. Because of that, the variable $L is undefined.
: What I expect the statement above to do is to create 2 new variables,
: $nextID and $maxID. Then, if $L has a true value in it, it's treated
: as a reference to a list and the first 2 values in that list would be
: assigned to the variables. However, if $L is false, then the
: variables would be left undefined. What's really blowing my mind is
: the that values in $nextID and $maxID get the values THAT THEY WERE
: ASSIGNED DURING THE PREVIOUS CALL TO THIS FUNCTION. Wow! They're "my"
: variables inside the getCached() function. How could they end up with
: values from a previous invocation of the function?

Fascinating! You have one misconception right off: The "my" line is never executed (not even to make the new variables) if $L is false.

Now I'm starting to speculate: Since your my variables aren't created the second time, the ones from the first time weren't destroyed, and those are the ones picked up (with their old values).

Make the code

my ($nextID, $maxID);
($nextID, $maxID) = @$L if $L;

and see if that doesn't fix it.

Good luck,

Joe

==
  Joseph P. Discenza, Sr. Programmer/Analyst
   mailto:[EMAIL PROTECTED]

  Carleton Inc.   http://www.carletoninc.com
  574.243.6040 ext. 300    fax: 574.243.6060

Providing Financial Solutions and Compliance for over 30 Years



-Original Message-
From: [EMAIL PROTECTED] on behalf ofTo: perl-win32-users@listserv.ActiveState.com; Lewis Foster; [EMAIL PROTECTED]; Todd Thurheimer; Chris Cain
Subject: Perl Bug (again)

OK, same caveat as before - apparent bugs in Perl are usually user
errors, but once again, I'm stumped. Here is my code. The problem I
have is in the second call to getCached(), specifically, the line:


I've added the output from when I run this below. BTW, I'm running
ActiveState ActivePerl v. 5.8.7 Build 815 under MS Windows 2000 Server.

# ---
use strict;

our $hCache = {};

my $id1 = getCached('x');
my $id2 = getCached('y');

print("id1 = '$id1\n");
print("id2 = '$id2\n");

# ---

sub getCached { my($Customer) = @_;

my $L = $hCache->{$Customer};
print(defined($L) ? "L defined\n":"L undefined\n");
my($nextID,$maxID) = @$L if $L;
print("nextID = '$nextID', maxID = '$maxID'\n");
if ($nextID==$maxID) {
    ($nextID,$maxID) = getNextMax($Customer);
    $hCache->{$Customer} = [$nextID+1, $maxID];
    }
else {
    ++$hCache->{$Customer}->[0];
    }
return $nextID;
} # getCached()

# ---

sub getNextMax { my($CustomerName) = @_;

if ($CustomerName eq 'x') {
    return (100,150);
    }
elsif ($CustomerName eq 'y') {
    return (200,250);
    }
} # getNextMax()


# ---
OUTPUT:
# ---
C:\Scripts>testIDs.pl
L undefined
nextID = '', maxID = ''
L undefined
nextID = '100', maxID = '150'
id1 = '100
id2 = '100

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs





___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Yet another regex question

2006-01-12 Thread Joe Discenza
Title: Yet another regex question






Ted Schuerzinger 
wrote, on Thu 12-Jan-06 08:45:  I have a text file with lines like 
this::: 1 (1) DAVENPORT, LINDSAY 3380.00 16 .00 49.00 USA .00: 2 (2) 
CLIJSTERS, KIM 3206.00 17 .00 .00 BEL .00: [...]: 28 (28) MOLIK, ALICIA 
671.00 15 .00 195.00 AUS .00: 29 (33) MEDINA GARRIGUES, ANABEL 660.75 27 
30.00 10.00 ESP 2.00: 30 (35) KOUKALOVA, KLARA 660.75 23 16.00 20.00 CZE 
2.00: that I want to turn into a tab-delimited file. Unfortunately, 
I can't simply
: turn all 
spaces into tabs: note that there are people with two-word surnames. 
 
Part of the problem with this 
code
 
:  if ($_ 
=~/\d\s[A-Z]{3}\s/) {:  $_ = s/$1/$1\t/g;:  }
is you have 
no capturing parentheses to populate $1. Toss this code.
 
You seem to have a 
pretty good picture of your data; why not turn that into a regex completely, 
instead of doing it piecemeal?
 
/(\d+)\s+\((\d+)\)\s+([A-Z\s]+),\s+([A-Z]+)\s+(\S+)\s+(\S+)\s+(\S+)\s+([A-Z]{3})\s+(\S+)/
 
and have a replace section 
that strings together all your captures with tabs between:
 
s/.../$1\t$2\t$3\t$4\t$5\t$6\t$7\t$8\t$9\t${10}/
 
You don't need the 
parentheses around field 2, or the comma after the last name, do you? If so, you 
can put those inside the captures.
 
Good 
luck,
 
Joe

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: split() skipping trailing delimiters

2005-12-05 Thread Joe Discenza
Title: split() skipping trailing delimiters






DZ-Jay wrote, on Mon 
05-Dec-05 07:58
:     I have a 
problem using the split() function:  When there are trailing: 
delimiters, without any content between them, split() skips them.  
For
From "perldoc -f 
split":
 
    If 
LIMIT is specified and positive, splits into no more 
than    that 
many fields (though it may split into fewer). If LIMIT 
is    
unspecified or zero, trailing null fields are stripped 
(which    
potential users of "pop" would do well to remember). If LIMIT 
is    
negative, it is treated as if an arbitrarily large LIMIT 
had    been 
specified.
 
Hence, if you use a negative LIMIT, 
you'll get all your trailing fields.
 
Remember, perldoc is your 
friend.
 
Good luck,
 
Joe

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Counting matches

2005-11-11 Thread Joe Discenza
Title: Counting matches






Артем Аветисян wrote, on Fri 11-Nov-05 11:06
: I have:: ...: $string =<<'EOS';: 
Returns the offset of where the last m//g search left off for the variable in 
question: ($_ is used when the variable is not specified). Note that 0 is a 
valid match offset,: while undef indicates that the search position is reset 
(usually due to match failure,: but can also be because no match has yet 
been performed on the scalar). pos directly: accesses the location used by 
the regexp engine to store the offset, so assigning to pos: will change that 
offset, and so will also influence the \G zero-width assertion in regular 
expressions.: Because a failed m//gc match doesn't reset the offset, the 
return from pos won't change either in this case.: See the perlre manpage 
and the perlop manpage.: EOS: : $string =~ /o.{2}(s)(et)/g;: 
...: : But i don't see the way to get all mathces (without having 
$string cycled).: Secong issue - to get them with their 
positions.
How about this 
(untested):
 
my 
@positions;
while ($string =~ 
/o.{2}(s)(et)/g)
{
    
push @positions, pos($string) - length($&);
}
 
Then the number 
of matches is simply scalar(@positions).
 
If you have a lot of work to do 
with regexes, I recommend _Mastering Regular Expressions_ by Jeffrey E. F. 
Friedl. It is my first reference for all questions regexish, and where I went to 
check the return values of the global (/g) match in list v. scalar 
context.
 
Good 
luck,
 
Joe
 

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: eval'ing a dumped data structure

2005-10-28 Thread Joe Discenza
Title: RE: spidering/crawling/scraping a site..







All,
 
Please disregard. It was another 
value not updating, and I've got it fixed. Thanks for your 
attention.
 
Joe
 

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years


From: 
[EMAIL PROTECTED] on behalf of Joe 
DiscenzaSent: Fri 28-Oct-05 14:17To: perl-win32-users 
mailing listSubject: eval'ing a dumped data 
structure


All,
 
I've got a dumped data 
structure. I can print the string I dumped to:
 
$form_hash_ary_ref = 
[   
{ 
'desc' => 'Agreement to Provide 
Insurance', 
'name' => 
'AGREE_PPI.pdf', 
'copies' => 
1, 
'field_hash' => 
{   
'INS_POLICY_NUM' => 
{ 
'disp_only' => 
1, 
'value' => 
'cpsex1'   
} }
   
}
 ];
 
This is fine, and looks just like I 
expect. Then I eval the dumped string, so the variable $form_hash_ary_ref should 
contain that anonymous array (in the example, containing one anonymous 
hash).
 
I have a debug line right after the 
eval
 
    print DEBUG 
ref($form_hash_ary_ref), ": @{$form_hash_ary_ref}\n";
and it prints
ARRAY: HASH(0xd5bea64)
I expected the ARRAY (ref of a reference to an array), and then I 
suppose it prints the single element of the array, which is a hash ref.
 
Then I get to the next debug line
 
 @form_hash_ary = @$form_hash_ary_ref;    
print DEBUG scalar(@form_hash_ary), 
$form_hash_ary[0]{'field_hash'}{'INS_POLICY_NUM'}{'value'}, "\n" if ($debug 
&& $next_form == -1);
This prints what I expect
 
1cpsex1
 
(Yeah, I should probably have put a space between them.)
 
But this next line crashes, and I can't figure out why (it's in 
ASP, and I'm not getting a Perl run-time error back, just a 500).
 
 my %my_hash = 
%{$form_hash_ary[$current_form]{'field_hash'}};
 
When I lift the chunk out into a console .pl file, hard-code the 
string to be eval'ed, everything works fine.
 
Any clues?
 
Joe
 

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


eval'ing a dumped data structure

2005-10-28 Thread Joe Discenza
Title: RE: spidering/crawling/scraping a site..






All,
 
I've got a dumped data 
structure. I can print the string I dumped to:
 
$form_hash_ary_ref = 
[   
{ 
'desc' => 'Agreement to Provide 
Insurance', 
'name' => 
'AGREE_PPI.pdf', 
'copies' => 
1, 
'field_hash' => 
{   
'INS_POLICY_NUM' => 
{ 
'disp_only' => 
1, 
'value' => 
'cpsex1'   
} }
   
}
 ];
 
This is fine, and looks just like I 
expect. Then I eval the dumped string, so the variable $form_hash_ary_ref should 
contain that anonymous array (in the example, containing one anonymous 
hash).
 
I have a debug line right after the 
eval
 
    print DEBUG 
ref($form_hash_ary_ref), ": @{$form_hash_ary_ref}\n";
and it prints
ARRAY: HASH(0xd5bea64)
I expected the ARRAY (ref of a reference to an array), and then I 
suppose it prints the single element of the array, which is a hash ref.
 
Then I get to the next debug line
 
 @form_hash_ary = @$form_hash_ary_ref;    
print DEBUG scalar(@form_hash_ary), 
$form_hash_ary[0]{'field_hash'}{'INS_POLICY_NUM'}{'value'}, "\n" if ($debug 
&& $next_form == -1);
This prints what I expect
 
1cpsex1
 
(Yeah, I should probably have put a space between them.)
 
But this next line crashes, and I can't figure out why (it's in 
ASP, and I'm not getting a Perl run-time error back, just a 500).
 
 my %my_hash = 
%{$form_hash_ary[$current_form]{'field_hash'}};
 
When I lift the chunk out into a console .pl file, hard-code the 
string to be eval'ed, everything works fine.
 
Any clues?
 
Joe
 

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: How to sort these elements

2005-10-26 Thread Joe Discenza
Title: How to sort these elements 






Maxmelbin Neson (RBIN/EDM3) wrote, on Wed 26-Oct-05 
06:50[snipped]
:  
"/view/test.max2kor1/vobs/maxvob/satish.c@@/main/tmp_maxtest1/12" 
:    
    "/view/test.max2kor1/vobs/maxvob/max.c@@/main/tmp_maxtest1/7" , 
:    
    "/view/test.max2kor1/vobs/maxvob/satish.c@@/main/tmp_maxtest1/2", 
:    
    "/view/test.max2kor1/vobs/maxvob/max.c@@/main/tmp_maxtest1/17" 
[should sort to]

: /view/test.max2kor1/vobs/maxvob/max.c@@/main/tmp_maxtest1/7 
: /view/test.max2kor1/vobs/maxvob/max.c@@/main/tmp_maxtest1/17 
: 
/view/test.max2kor1/vobs/maxvob/satish.c@@/main/tmp_maxtest1/2
: 
/view/test.max2kor1/vobs/maxvob/satish.c@@/main/tmp_maxtest1/12 
What's that "@@"? Is that a field separator? It looks like you want to sort 
first on the part before @@ and then numerically on the version at the end.
 
@sorted = map { $_->[0] }
 
sort { $a->[1] cmp $b->[1] || $a->[2] <=> $b->[2] }
 
map { [$_, (split(/@@/, $_))[0], (split(/\//, $_))[-1]] } @a;
(not tested). 
Here's what happens: You use the last (inner) map to grab the stuff you 
want to compare and put it into an anonymous array. I always stick the full data 
in the first slot, but if you didn't want the whole line, you could do whatever 
you wanted (here or in the outer map). The second and third slots of the 
anonymous array are the filename (everything up to the @@) and the version 
(everything after the last /). Then you hand that array of arrayrefs off to 
sort, with a custom function to sort first on filename and then numerically on 
version. The results of sort then get passed to the outer map which extracts 
just the data you really want; I've set it to extract the original data, which I 
put in the first slot, but, as I said, you can do whatever (maybe you only need 
the filename and version, which are in the second and third slots).
This is known as the Schwartzian Transform ("map {} sort {} map {}"), used 
when you want to sort on some extractible criteria but don't want to extract 
more than once per array element (important for long lists!).
Good luck,
Joe
==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Multiple .pl files and Hash values

2005-10-21 Thread Joe Discenza





Mike Fountain wrote, on Fri 10/21/2005 13:12
: There are several functions in the program, and 
they fall into 8 basic categories.  So, I've got one main file with the 
main
: functions and then 8 other files with all 
the other functions.
:
: The main file has this:
: use strict;
: use CGI qw(standard);
: require file1.pl;
: my @arryHoH = ();
: my %arryTrs = ();
 
This may sound silly, but try putting the "my" variables 
*before* the require statements. You may also want to investigate the "our" 
declarator; I've never used it myself.
 
Good luck,
 
Joe
 

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Regex Newbie Q: Non-Trivial Substitution and Modifying the MatchedString

2005-10-10 Thread Joe Discenza
Title: Regex Newbie Q: Non-Trivial Substitution and Modifying the MatchedString






"Veli-Pekka Tätilä" wrote, on Sun 10/9/2005 15:58: Yet another newbie question about regular 
expressions:: I'd like to find and replace bits of text as usual. However, 
rather than: replace all occurrences in one quick swoop using the s-operator 
and the: g-flag, the replacement is so complex that it cannot be expressed 
as a: straight substitution. So I would have to find a piece of text, 
process it: in a separate function, and replace the matched text with the 
newly computed: text. This goes on for n interesting matches in the 
input.
I can't tell from 
your note if you've investigated the /e flag yet, that allows you to replace a 
chunk of text with the result of a function call:
 
s/(stuff that's not a 
note)?(note)/$1tag_from_note($2)/ge;
 
Good 
luck,
 
Joe
 

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Variable definition

2005-10-07 Thread Joe Discenza







Pierce, Glen E wrote, on Fri 10/7/2005 09:35


: This may seem like a simple 
question, but I have a variable $month=7 but I want to represent it as 
$month=07.  How is this done. 
 
$month = sprintf("%02d", 
$month);
 
Good luck,
 
Joe
 

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 




___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Regex

2005-09-20 Thread Joe Discenza
Title: Regex






David Budd wrote, on Tue 9/20/2005 10:57:

: I thought this was working, but my logs just showed a case 
where it seems not to do what I want.: Why does:: 
$OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ;: Not become true when 
$body contains:: Library Card: 0240742
Probably because your regex explicitly requires a non-digit (\D) 
at the end, and your example line doesn't have it. Perhaps you want \D*$ so it 
finds no more than 7 digits, or if more digits are allowed as long as a 
non-digit intervenes, you might want (\D|$).
Good luck,
Joe
==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 
Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: help with defined and !not defined

2005-07-22 Thread Joe Discenza
Title: Re: help with defined and !not defined






lorid wrote, on Fri 7/22/2005 10:27: my $a;: my $b;:: $b = 10;:: if 
(defined $a){
All well and good; but in your 
original post (which I no longer have available to quote, but I believe I recall 
correctly), your $a (or equivalent) was the result of a substr operation. So it 
has, in fact, been assigned a value (the desired portion of the string). What 
you *want* to test is if that portion is the zero-length string, hence the 
length() function is what you need in this case.
Defined is for cases where 
nothing has actually been assigned, such as when a regex fails (or doesn't have 
enough matches to fill all the variables, or one alternation is chosen over 
another):
/("[^"]*")|(.*)/;
if (defined($1)) { #strip the 
quotes
See?
Good luck,
Joe
==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years


From: 
[EMAIL PROTECTED] on behalf of 
loridSent: Fri 7/22/2005 10:27To: Chris 
WagnerCc: perl-win32-usersSubject: Re: help with defined 
and !not defined

Chris Wagner wrote:>You want to check if it's null, 
not if it's defined.  Defined means that the>variable exists.  
You want something like if ($photo_year) {...}.>>At 01:48 PM 
7/21/05 -0700, lorid wrote:> >>>my $ARGV[0]  
will sometimes be passed a string like this:nvIGRA with no>>date at 
end and sometimes with date nvIGRA200511>>if it does not have date I 
need to set it another way but cant get>>syntax of 
!defined>>   >>>> >you 
are right about I should test for null or length of value instead butI found 
the place where I got information that says that to be defined avar must 
have a value:Beginnng Perl by Simon Cozens pg 123:"We can test if a 
variable is defined by...#!/usr/bin/perluse strict;#use 
warnings;my $a;my $b;$b = 10;if (defined 
$a){  print "a has a value.\n";}if (defined $b){  
print "b has a value.\n";}#only prints b has a 
value___Perl-Win32-Users 
mailing listPerl-Win32-Users@listserv.ActiveState.comTo unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Change in "goto" behavior

2005-07-13 Thread Joe Discenza




John Deighan wrote, on Wed 7/13/2005 09:55
: We have a goto in our code. I hate it, but there 
just isn't a good "switch" or "case" statement in Perl yet (I think I've heard 

: that it's planned), and the following just isn't 
efficient enough for us:: if ($op = 'thisop') {: 
}: elsif ($op = 'thatop') 
{: }: There are hundreds 
of possible values for $op. Anyway, I don't know how many people are aware of 
it, but the 
: destination of a "goto" can be a variable, 
e.g.:: goto $op;:: thisop:: 
 do_this();: thatop:: 
 
do_that();
Might I suggest a 
hash of sub refs? Then you can just do
 
&{$my_subs{$op}};
 
or something like 
that.
 
Good 
luck,
 
Joe
 

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Using canned subroutines with includes - an answer of sorts

2005-07-08 Thread Joe Discenza
Title: RE: Using canned subroutines with includes - an answer of sorts






Doug Loud wrote, on Fri 7/8/2005 12:17

: in Windows XP Pro, 
SP2, I have to use::: require 'includes/28ESP.pl';:: But in the 
*NIX days, I used::: require "../includes/28ESP.pl";
Are you sure that isn't
 
require "./includes/28ESP.pl";
 
? Because the double-dot means *go up* a level, then come down 
in the includes directory; so that implies that includes is a sibling directory 
to the current one. The single-dot means than includes is a child of the current 
directory.
 
Joe

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Test if string is a number?

2005-06-30 Thread Joe Discenza
Title: RE: Test if string is a number?






Chris Wagner wrote, on Thu 6/30/2005 14:41

: At 12:16 PM 6/30/05 -0500, Joe Discenza wrote:: >I bet 
you're right that "eval($var) eq $var + 0" works; have you: >benchmarked 
it against all the other (regex, e.g.) methods presented?:: I haven't 
benchmarked it but I can garuntee that it's faster than a regex.: Anything's 
faster than that. ;)  This should cover everything:
Thanks for playing. I compared your function with a regex I 
whipped up (/^[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?$/, which gave the same 
results, except for distinguishing "pure" numbers, on your dataset): 
Benchmark: timing 10 iterations of chris, 
regex... chris: 12 wallclock secs (11.86 usr +  
0.00 sys = 11.86 CPU) @ 8432.41/s (n=10) 
regex:  2 wallclock secs ( 1.56 usr +  0.00 sys =  1.56 CPU) @ 
63979.53/s (n=10)
Regex is pretty fast. Eval is usually pretty slow.
Joe

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Test if string is a number?

2005-06-30 Thread Joe Discenza
Title: RE: Test if string is a number?






Chris Wagner wrote, on Thu 6/30/2005 12:41

: At 09:48 AM 6/30/05 -0500, Joe Discenza wrote:: >Except 
if $var is, say, '0.00'. Then $var + 0 is '0', and won't eq $var.:: 0.00 
is not a valid internal representation of a number.  That can only: 
exist as a string.  Same goes for "1e7".  That is a print formated 
number,: not a valid internal number.  $var = 1e7 and print $var -> 
1000. $var =: 0.00 and print $var -> 0.  If u want to include 
"numberish" strings then u: need some eval's to digest the various number 
formats.  ... if eval $var eq: $var + 0;
IIRC (no longer have the message), the OP had *string* data to 
check for numerics. Your method would miss, say, a CSV full of prices if they 
ended ".00" or ".50".
I bet you're right that "eval($var) eq $var + 0" works; have you benchmarked 
it against all the other (regex, e.g.) methods presented?
Joe
 

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Test if string is a number?

2005-06-30 Thread Joe Discenza
Title: Re: Test if string is a number?






Chris Wagner wrote, on Thu 6/30/2005 08:48

: Wow there's been a lot of heavy duty code proposed to do 
something so: simple.  The answer is in how Perl converts between the 
two.:: print "is a number" if $var eq $var + 0;: print "not a 
number" if $var ne $var + 0;
Except if $var is, say, '0.00'. Then $var + 0 is '0', and 
won't eq $var.
 
Joe
==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 
Years


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: mystery

2005-06-29 Thread Joe Discenza
Title: RE: mystery






Peter Eisengrein wrote, on Wed 6/29/2005 13:04

: > Can someone tell me what's going on in my script? Here it 
is:: >: > use strict;: > use POSIX qw(INT_MAX);: 
>: > my $i = INT_MAX;: > my $n = INT_MAX - 1000;: > 
print("i = $i\n");: > print("n = $n\n");: >: : Not sure of 
the *why* (I'm sure someone on the list smarter than I can: answer), but it 
works if you change it to:: : my $n = INT_MAX() - 1000;
Simply because Perl handles constants like 
built-in functions. When you say "INT_MAX - 1000", that's equivalent to 
"INT_MAX(-1000)". Since INT_MAX is a constant function, you just get the max 
again.
 
Joe
 

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Array length reading problem

2005-06-14 Thread Joe Discenza




Apurva Shukla wrote, on Tue 6/14/2005 09:28
: XYZ can be an 'Array of hashes' or a 'Single Hash':: Now if 
I want to traverse all that is contained in XYZ I first read the array 
length
: and then traverse it one by one.:: How can I get a length of 
an array and in case its not an array I can know its length
: is zero.
 
perldoc -f ref
 
Look for "HASH" or "ARRAY" in the return value of ref.
 
Joe
 

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 
Years
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: restraining grep

2005-04-01 Thread Joe Discenza
Title: restraining grep






Spencer_Lists wrote, on Fri 4/1/2005 02:34

: I have a few programs that accept user input as a series of 
integer: values pairs separated by a delimiters between the pairs and 
the: elements of the pairs. I previously made an array out of the first: 
halves of the pairs and also a hash indexed by the first value and: 
containing the second element of each pair as the value of the hash.: Later 
in the program I would use grep to determine if an integer was: contained in 
the first array mentioned. After using these programs for: some time, I 
suddenly discovered that grep on an array didn't seem to: match integers 
exactly. It was as if the comparisons were of strings: and substrings would 
match larger strings so grep would return true: for 10 in an array that had 
110 in it. Not what I wanted so instead I: check to see if the value of the 
hash is defined. Still, I was: wondering if there is any way to use grep to 
exactly match an element: of an array.
You haven't actually provided any code, so I can't see what 
you're doing that's failing. It sounds like you're using a regex as the 
test.
You can use any test. Try
grep { $_ == 10 } @int_array;
and see if that helps.
Good luck,
Joe
==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 
Years


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Time::gmtime bad minutes

2005-03-30 Thread Joe Discenza
Title: Time::gmtime bad minutes






Roderick A. Anderson wrote, on Wed 3/30/2005 13:42

: use Time::gmtime;:: my $tst = 
gmtime(1107245405);:: printf( 
"%02d/%02d/%4d\t%02d:%0d2:%02d",
   
%02d
: 
    $tst->mon 
+ 1,:     
$tst->mday,: 
    $tst->year 
+ 1900,:     
$tst->hour,: 
    
$tst->min,: 
    
$tst->sec:   
);:: With this results.:: 
02/01/2005  08:102:05:: Any ideas?  
Probably something simple that I'm totally missing it.
Yes is was simple, but insidious!
 
Good luck,
 
Joe
 

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: DBI handle as hash key

2005-03-11 Thread Joe Discenza
Title: DBI handle as hash key






John Deighan wrote, on Fri 3/11/2005 09:14: I would like to use DBI handles as hash keys. I thought 
that I'd read: somewhere quite a while ago that Perl was adding the 
capability to use: non-scalar values as a hash key. However, when I 
try  $h->{$db} = $string,: where $db is a DBI handle, the DBI handle 
is converted to a string. If: that's the way it works, I'm wondering if 
that's a safe thing to do - i.e.: if I later do another  $h->{$db} = 
$string2, where $db is the same DBI: handle, can I be certain that $string2 
will replace $string in the same: hash slot created 
earlier?
I think you're really 
asking, when I look up $h->{$db} later, will I get $string2? The answer to 
that is, "yes."
 
The other question is whether you 
want to be able to iterate over your handles and use them: foreach $handle (keys 
%$h). The short answer is, "no," the stringified version that is the key is no 
longer a handle per se. However, if your value is not just a string, but an 
anonymous list containing both the string and the handle, it works 
fine:
 
  $h->{$db} = [$db, 
$string];
  ..
  foreach $handle_ref (values 
%$h) {
    # 
$handle_ref->[0] is the handle
    # 
$handle_ref->[1] is the string
  }
 
Good luck,
 
Joe

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: :Socket::INET Handle problem

2005-03-08 Thread Joe Discenza
Title: IO::Socket::INET Handle problem






Julian Brown wrote, on Mon 
3/7/2005 18:17
 
I do an accept on a listener socket.: 
$new_sock = $listener->accept ();:: Then I create a hash reference to 
store some state information:: $hashref = {: 
 'socket' => $new_sock,:  
'otherstuff' => "really cool stuff": };:: Then I add the socket 
to a global hash so I can enumerate them easily.:: 
$all_connections{$new_sock} = $hashref;:: Later when I want to 
manipulate my IO::Select:: foreach $x_socket (keys 
%all_connections): {:  $hashref = 
$all_connections{$x_socket};:  $socket = 
$hashref->{'socket'};::  $fn = fileno 
($socket);:  $fna = fileno ($x_socket);:: 
 print "FN ($fn) ($fna)\n";: }:: The 
contents of $socket and $x_socket are identical and are of the form::: 
IO::Socket::INET=GLOB(0x1ca3960):: Anyway what happens here totally sent 
me out into left field, $fna is: always blank, whereas $fn is always the 
proper fileno.    The strings: $socket and $x_socket are 
identical they pass the "if eq" test.  Yet: $x_socket will not render 
to the fileno.   Why do I care about the: fileno, because after 
several days of debugging I found that in the: IO::Select call it was not 
able to add the socket to the select vector: because it could not find the 
fileno.
I believe Rob explained why sufficiently. I only want to recommend 
that you, then, loop over the values, not the keys:
 
foreach (values %all_connections)
{
    $socket = $_->{'socket'};
    $fn = fileno($socket);
}
 
Saves a bit of trouble.
 
Good luck,
 
Joe

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Variable in a repeating pattern?

2005-02-15 Thread Joe Discenza
Title: Variable in a repeating pattern?






Ben 
Conrad wrote, on Tue 2/15/2005 15:00:: 
This works and gives me the first 3 chars of my string:: ($hoststr) = 
$hostname =~ /(^\D{3})/;:: Is it possible to do this so I can make the 
length of the repeating pattern: a variable?  It's not working for 
me.: $length = 4;: ($hoststr) = $hostname =~ 
/(^\D{\$length})/;
Works for me if I 
don't escape the $ in $length.
 
Good luck,
 
Joe

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Scriptomatic 2 (Win32::OLE)

2005-01-20 Thread Joe Discenza
Title: Scriptomatic 2 (Win32::OLE)






Chris wrote, on Thu 
1/20/2005 09:59
: For those who haven't seen this yet, it was in today's 
edition of Microsoft's TechNet newsletter. I didn't find it all that useful, but 
maybe someone on this list will.: http://www.microsoft.com/downloads/details.aspx?FamilyID=09dfc342-648b-4119-b7eb-783b0f7d1178&DisplayLang=en
The Perl version doesn't break out 
the dates. Open the HTA file in your favorite text editor, and look for the 
ComposePerlCode section. In there, find the two places bHasDates occurs, and 
make the appropriate replacements (long lines may be broken):
 
 bHasDates = 
True strHTML = strHTML & 
"  print " & Chr(34) & objProperty.Name 
& ": " & Chr(34) & ", WMIDateStringToDate($objItem->{" & 
objProperty.Name & "}), " & Chr(34) & "\n" & Chr(34) & ";" 
& Chr(10)
and the other:
 
   If bHasDates 
Then  strHTML = strHTML & Chr(10) & 
"sub WMIDateStringToDate()" & Chr(10)  
strHTML = strHTML & "{" & Chr(10)   
strHTML = strHTML & "   my $strDate = shift;" & Chr(10) 
  strHTML = strHTML & "   if 
($strDate =~ /^(\d{4})(\d{2})(\d{2})(?:\s*(\d{2})(\d{2})(\d{2}))?/)" & 
Chr(10)  strHTML = strHTML & "   
{" & Chr(10)   strHTML = strHTML & 
"   return sprintf '%s/%s/%s%s', $2, $3, $1, (length($4) ? "" 
$4:$5:$6"" : '');" & Chr(10)  strHTML = 
strHTML & "   }" & Chr(10)   
strHTML = strHTML & "   else" & Chr(10) 
  strHTML = strHTML & "   {" 
& Chr(10)   strHTML = strHTML & 
"   return $strDate;" & Chr(10)  
strHTML = strHTML & "   }" & Chr(10) 
  strHTML = strHTML & "}" & 
Chr(10)   End If
Have fun with it. You international 
types may want to change the order to "$3, $2, $1", of course :)
 
Oh, and you can make Perl the 
default by changing g_strCurrentLanguage to "Perl" (up near the top) and 
changing the default checked in the radio list "language" to ComposePerlCode. 
Likewise, you can change the default output type with g_strOutputFormat and 
radio list "output".
Joe
 

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years
 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Newbie: RegEx portions of a string into an array

2005-01-10 Thread Joe Discenza








[EMAIL PROTECTED] wrote, 
on Mon 1/10/2005 06:53
: What I have is
:
: $string = “my name is %name%, age 
%age%, department %dept%”;
:
: What I want is 
:
: The % wrapped text returned to an 
array like
:
: my @list = 
GetVars($string);
:
: Anyone done something similar or 
know how I could do a regex to return
:
: @list = qw (name age 
dept)
 
What characters can your variable 
names contain? Are they standard Perl/C varnames? Here's how you match a 
varname:
 
[_a-zA-Z][_a-zA-Z0-9]*
 
If your varnames can look 
different, adjust that sub-regex in the regexen below.
 
So here's how you get the list of 
%-wrapped varnames in a string:
 
my @list = $string =~ 
/\%([_a-zA-Z][_a-zA-Z0-9]*)\%/g;
 
But is what you really want to do 
to substitute the value of $hash{var} whenever %var% appears in the string? Then 
do that the first time:
 
$string =~ 
s/\%([_a-zA-Z][_a-zA-Z0-9]*)\%/$hash{$1}/eg;
 
I'm not sure you need to escape the 
%, but it doesn't hurt; and as always, not tested ;).
 
Good luck,
 
Joe

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years


To: 
perl-win32-users@listserv.ActiveState.comSubject: Newbie: RegEx 
portions of a string into an array


 
Ps name age and dept are just 
samples – there could be any number of variables in $string
 
Ken




___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Win32::AdminMisc::CreateProcessAsUser(.....) on Win Server 2003

2005-01-07 Thread joe
One thing to keep note is that CreateProcessWithLogonW will fail on XP (and
probably on K3 SP1 but I haven't tested it) if being launched by a process
running as localsystem (like when you run a script from scheduler). MS
changed something in XP SP2 which specifically disallows localsystem from
using the API call. I have been getting quite a few reports of it because of
people using a free tool I have out there called cpau. I haven't had the
chance to break away from work long enough to really dig into it and also I
specifically wrote my tool to be used interactively, if someone is trying to
make a fake service out of it I would rather they wrote a real service.


 joe



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Peter Guzis
Sent: Friday, January 07, 2005 7:27 PM
To: Smith, Gregory; perl-win32-users@listserv.ActiveState.com
Subject: RE: Win32::AdminMisc::CreateProcessAsUser(.) on Win Server 2003

Which version of Win32::AdminMisc are you using?

The source code for version 20030714 is available at
ftp://ftp.roth.net/pub/ntperl/AdminMisc/20030714/source/.  If Dave hasn't
responded yet, you might try making your changes to the source code and
sending him a patch.  

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Smith, Gregory
Sent: Friday, January 07, 2005 12:13 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: RE: Win32::AdminMisc::CreateProcessAsUser(.) on Win Server
2003


All, 

An update.
 
You won't be able to resolve this with the Win32::AdminMisc module  Roth
consulting will need to resolve this and they don't appear to be interested
in helping as I have sent two separate emails on 2004/11/18 and 2004/11/21
and have yet to even get a response.
 
I am pretty sure they are using two windows API calls in this module
"LogonUser" and "CreateProcessAsUser".  I worked with Microsoft technical
support to get this figured out and for Windows 2003 & XP we now need to use
only one "CreateProcessWithLogonW".  During my debugging with Microsoft I
wrote a C program that did the original two functions to prove the problem
(which was successful) and then after there solution I re-worked my test C
program to use the new function which was the easy part.  
 
I then attempted to use the Win32::API module to call the new function but
after a few days I gave up as part of the problem is
"CreateProcessWithLogonW" requires parameters to be wide character format
(Unicode) "WCHAR" and I

So, after many failed attempts I decided to convert what I had written in
PERL to C.

If someone out here has gotten this to work I'm all ears!

Regards
Greg



-Original Message-
From: Smith, Gregory
Sent: Monday, November 15, 2004 4:54 PM
To: 'perl-win32-users@listserv.ActiveState.com'
Subject: Win32::AdminMisc::CreateProcessAsUser(.) on Win Server 2003


I'm testing out a new server running Windows Server 2003 / SE  that's going
to replace our old Windows 2000 server.

Testing my existing Perl script included below.  The script will run however
the application started looks like a ghost on the console desktop as only
the frame appears.  Hopefully someone has some insight as to what's causing
this and a solution as I am currently at a loss..


Here's my working script:

use Win32;
use Win32::Process;
use Win32::AdminMisc;
use Win32::API;


logit("Script Started");

$exeFile = "C:\\windows\\notepad.exe";

$domain = 'YourDomain';
$value1 = 'YourId';
$value2 = 'YourPassword';

if(Win32::AdminMisc::LogonAsUser($domain, $value1, $value2,
LOGON32_LOGON_INTERACTIVE ))
{
$name = Win32::AdminMisc::GetLogonName();

if ( "\L$value1" ne "\L$name")
{
logit("  The Login Failed\n domain: $domain   user: $value1   Whos
logged in: $name", "-d");
}
else
{
logit("  $domain$value1 Logged in..");
}
}
else
{
logit("  The Login Failed For user: $value1", "-d");
}


#Create the process object.
if(Win32::AdminMisc::CreateProcessAsUser($exeFile))
{
logit("  Started: $exeFile");
}
else
{
logit("  Failed to Start $exeFile ", "-d");
}


Win32::AdminMisc::LogoffAsUser();

exit;



sub logit
{
open(log_out,">>script.Log") or die "Can't write to log: $! \n";

$str = (1900+(localtime)[5])."/".sprintf("%02d",(1+(localtime)[4]))."/".
   sprintf("%02d",(localtime)[3])."
".sprintf("%02d",(localtime)[2]).
 
":".sprintf("%02d",(localtime)[1]).":".sprintf("%02d",(localtime)[0])."  ";

print log_out $str, $_[0], "\n";

close(log_out);

}


 
Thanks in Adv

RE: black box

2004-12-15 Thread Joe Discenza







Lasher, Brian wrote, on Wed 12/15/2004 
14:38: Is there any way to keep the 
“black command-prompt looking box” from popping up when executing perl script on 
win 32 platform?



Probably one of a hundred 
replies: try wperl instead of perl.


 
Good luck,
 
Joe
 ==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 Years

 




___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: CGI - re-writing the content of the cell on the web page

2004-12-15 Thread Joe Youngquist
I think what your after is:


you'll need to have includes using exec turned on, I'm pretty sure that the
default is off on most servers...


- Original Message - 
From: "Greg Wardawy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 15, 2004 1:28 PM
Subject: Re: CGI - re-writing the content of the cell on the web page


> Thanks a lot $Bill. I will try all of your suggestions.
> So, there is no way to write the script, execute it as a SSI inside the
cell
> of the table:
>
> ---SNIP---
>   
> 1
> 
> 
> 
>   
> 
>   
> ---SNIP---
>
> and have the content of the cell re-written with a new value of the
> variable, right?
> Don't laugh too hard if this question is stupid. I'm quite new to the CGI
> programming and I thought that there is a way to send a new value to the
> cell avoiding sending the cell with a new value.
> Thanks again.
>
> Greg.
>
> - Original Message - 
> From: "$Bill Luebkert" <[EMAIL PROTECTED]>
> To: "Greg Wardawy" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Wednesday, December 15, 2004 10:11 AM
> Subject: Re: CGI - re-writing the content of the cell on the web page
>
>
> > Greg Wardawy wrote:
> >
> >> Hello all,
> >>
> >> My question is short even though I've spent the last couple of days
> >> trying
> >> to find the answer and am stumped.
> >> What is the trick to force the Server Site Included CGI script to
> >> re-write
> >> the content of the cell with the new value of the variable?
> >> My script (there is, actually a bunch of them printing values of
> >> different
> >> variables in a separate cells of the table) is as simple as follows:
> >>
> >> ###
> >> #!/usr/bin/perl -w
> >> use strict;
> >> print "Content-type: text/html\n\n";
> >>
> >> my $file_in = "nolram.in";
> >>
> >> open (IN,"<$file_in") or die "Can't open $file_in for reading: $!\n";
> >>
> >> my ($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10);
> >>
> >> while () {
> >> chomp;
> >> s/\s{2,}//g;
> >> ($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10) =
> >> split/,/;
> >> print "$var1\r";
> >> }
> >> close IN;
> >> exit;
> >> ###
> >>
> >> and works just fine in the command prompt or a terminal window but it
> >> prints
> >> a couple tousand values in a single cell on the web page. And that's
not
> >> what I need.
> >> Thanks a lot for any help.
> >
> > I would think that 1) you would bracket each cell with the appropriate
> > table syntax (like ...) and a  somewhere too.  2) you
> > probably want to change the \r to a \n on your last print also (after
> > adding the tr tags (eg: print "$var1\n";).  3) Add a 
> > and  before the loop and a  and  after (or include a
> > tr on each td : print "$var1\n"; )
> >
> > -- 
> >  ,-/-  __  _  _ $Bill Luebkert
Mailto:[EMAIL PROTECTED]
> > (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
> >  / ) /--<  o // //  Castle of Medieval Myth & Magic
> > http://www.todbe.com/
> > -/-' /___/_<_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
> > ___
> > Perl-Win32-Users mailing list
> > [EMAIL PROTECTED]
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> >
> >
> >
>
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: RegEx help

2004-12-14 Thread Joe Discenza
Title: RegEx help






Jeff Williams wrote, on Tue 12/14/2004 
11:23: I wrote a RegEx to let me know if a line of text 
has exactly 36 commas init (the comma is the separator) and I came up with 
this. I don't think itis quite right. I could use a little pointing in the 
right direction. Anythoughts?: $lines[0] 
=~/^(.*?,){36}.*?$/
Presumably you also want the fields, eventually. I'd 
use
 
@fields = split(/,/, $lines[0]);
 
and then you can simply check
 
if (@fields == 37)
{
}
 
(36 commas implies 37 fields). That way you already 
have the @fields array when you want them later.
 
Presumably the magic number 37 is a constant defined 
at the top of your script?
 
Good luck,
 
Joe
 

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 
Years


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Sorting question

2004-12-01 Thread Joe Discenza
Title: RE: Sorting question






Erich Beyrent 
wrote, on Wed 12/1/2004 11:39: > : I have the following data structure:: > 
:: > : $hash{$connid} = {"month"   => $month,: > 
: 
"day" => $day,: > 
: 
"time"    => $time,: > 
: 
"user"    => $user,: > 
: 
"host"    => $host,: > 
: 
"from_ip" => $from_ip,: > 
:    
};: > :: > : The time (where time is in hh:mm:ss format) and there 
could be a fewentries: > : with the same user and same timestamp - I 
only wish to display the first: > : one.: > :: > : So this 
works just fine.  The problem is that I need to also sort the: > : 
results by month, day, and time.  It looks as if the month and day 
fields: > : are sorting, but not the time field, and I am unsure as to 
how to sort: > this.: > : > What do you mean by "not 
the time field?" Perhaps you need to use "cmp": > instead of "<=>" 
(maybe you are; you :: > didn't show any sorting code!) since there 
are embedded colons, or you: > need to make sure your hours before 
10: > have leading zeros so they sort correctly ("hh:mm:ss" implies 
that they: > already do, but maybe you didn't mean: 
> that).: >  : > Joe:: Sorry for 
not being specific enough.  The data gets displayed with the times: in 
no particular order.  I might have::: 10:02:34: 06:05:01: 
09:00:01: : Etc.  I agree that cmp would have to be used instead of 
<=>, but I am not: sure as to how to implement this kind of sort on a 
single hash key when I am: doing a foreach loop on all the keys.  Any 
assistance would be greatly: appreciated!
So you want something like 
this?
 
foreach (sort { 
$hash{$a}{'month'} <=> $hash{$b}{'month'} ||
    
$hash{$a}{'day'}   <=> $hash{$b}{'day'}   
||
    
$hash{$a}{'time'}  cmp $hash{$b}{'time'} } keys 
%hash)
{
    # do 
stuff
}
 
Have I missed something in 
what you're doing? I'm afraid I no longer have your original message with your 
"do stuff" loop.
 
Joe
 

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 
Years


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Sorting question

2004-11-30 Thread Joe Discenza
Title: Sorting question






Apologies to the list if this isn't plain 
text; my corp just switched to Exchange, and I can't force plain 
text!
 
Erich Beyrent wrote, on Tue 11/30/2004 
10:53: I have the following data structure::: 
$hash{$connid} = {"month"   => $month,: 
    
    
"day" => $day,: 
    
    
"time"    => $time,: 
    
    
"user"    => $user,: 
    
    
"host"    => $host,: 
    
    "from_ip" 
=> $from_ip,:     
   };:: The 
time (where time is in hh:mm:ss format) and there could be a few entries: 
with the same user and same timestamp - I only wish to display the first: 
one.: : So this works just fine.  The problem is that I need to 
also sort the: results by month, day, and time.  It looks as if the 
month and day fields: are sorting, but not the time field, and I am unsure 
as to how to sort this.What do you mean by "not the time field?" Perhaps 
you need to use "cmp" instead of "<=>" (maybe you are; you didn't show any 
sorting code!) since there are embedded colons, or you need to make sure your 
hours before 10 have leading zeros so they sort correctly ("hh:mm:ss" implies 
that they already do, but maybe you didn't mean that).
 
Joe

==  
Joseph P. Discenza, Sr. 
Programmer/Analyst   
mailto:[EMAIL PROTECTED]   
Carleton Inc.   http://www.carletoninc.com  
574.243.6040 ext. 300    fax: 574.243.6060 Providing 
Financial Solutions and Compliance for over 30 
Years


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: adsi date type

2004-11-23 Thread joe
lastLogon should be returned by AD as a string though that string represents
an int8 value (i.e. 64 bit integer). It won't be displayed as a date
directly, it would need to be converted. I have posted in various locations
how to convert the value to a ctime value and then decode to a string

Here it is again
(http://groups.google.com/groups?q=Joe+Richards++ctime+perl&hl=en&lr=&selm=O
Yge%23r0QEHA.1048%40tk2msftngp13.phx.gbl&rnum=2) 


==
Ah and here is another post I have reused multiple times

It gets you to ctime format which you can use various tools to convert to a 
string, I have a perl script below to do it.

joe


I have been asked multiple times for this info in newsgroups and emails
to my joeware email and again at work yesterday so I wrote this up.
Thought I would share with the group here in case anyone cares.

---

First off the 64 bit Integer Time Values (Called Integer8) represents
the number of 100 nanosecond intervals between the time stamp and
January 1, 1601. Don't ask me why, this is just what it is, I am not
even going to attempt to explain it other than I wasn't around prior to
1969 so what happened with computers in 1601 is far outside my personal
scope of really caring. In fact I am not sure anything even existed then
because I didn't, it is up for debate.

1. Remove last 7 characters - Usually this will be all zeros but it may
be actual digits if you care to get down to 100 nanosecond accuracy, you
can figure it out.

2. Subtract off 11644473600

You are now at a value that is the number of seconds since since January
1, 1970. Again I will not explain even though I was around then. I still
wasn't at the point that I worried about time stamps on computers, I was
still flabbergasted that man had walked on the moon 6 short months
previously...

This value was targeted because there are functions out there that use
that format for time already and you can leverage them to convert to a
friendly time/date stamp such as ctime or localtime or gmtime.

So how to do this in perl??

Here is a quick perl script:

___t64.pl___
$t64=shift;
$t64=~s/(.+).{7,7}/\1/;
$t64-=11644473600;
($sec, $min, $hour, $mday, $mon, $year, $wday, $ydat,
$isdst)=localtime($t64); $mon++; $year+=1900;
print "$mon/$mday/$year - $hour:$min:$sec  DST - $isdst\n";


When you run it it will produce something like:

C:\Temp>t64 127069827243689315
9/2/2003 - 9:25:24  DST - 1


Use as you wish.

For other cool methods to play with those time fields in Perl check out
Robbie Allen's upcoming book - Active Directory Cookbook. :o)


joe



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Hon
Shi
Sent: Monday, November 22, 2004 8:38 AM
To: [EMAIL PROTECTED]
Subject: adsi date type

I've been working with perl/adsi and have not needed to look at anything but
string data.

Can someone give me a short example to read, say, the LastLogin time in a
user object?  I was just dumping some strings in a user object and this
doesn't work for nonstring data.  I suppose this is a two step process;
discover what kind of data it is, then converting it.

Thanks

  @main::userFields = qw(CN Description userPrincipalName GUID FullName
LoginScript sAMAccountName ADsPath HomeDirectory LastLogin);

  my $ldap;
  my $spec = "LDAP://"; . $dn;
  if (!($ldap = Win32::OLE->GetObject( "$spec"))) {
my $oleMsg = Win32::OLE->LastError();
my $erTxt = erMsg($0, $rev, __PACKAGE__, __FILE__, __LINE__, 'ole
message',
  qq(Failed AD "$spec".\n) .
  qq(BEGIN_OLE_MESSAGE\n$oleMsg\nEND_OLE_MESSAGE));
print STDERR $erTxt;
last EF;
  }
 
  foreach my $hit (@main::userFields) {
printf  qq/ %11.11s: %-64.64s\n/, $hit, $ldap->{"$hit"};
  }




__
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: BSOD - perl one liner

2004-10-06 Thread joe
 
Sounds like you are talking about the CSRSS bug, simply google for 

CSRSS bug perl  

Or something like that.


It will involve backspacing to a position that would be prior to BOL and
then outputting new text. 

  joe


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Allegakoen, Justin Devanandan
Sent: Wednesday, October 06, 2004 12:35 AM
To: [EMAIL PROTECTED]
Subject: BSOD - perl one liner

Just out of interest anyone have that funky little perl -e one liner that
causes Windows to puke and die?

I remember it has some \n's and \t's in it. I can't find it in the archives,
and it may only work on Win2k since it was posted quite a while back.

Just in

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Microsoft's SP2 Firewall blocking Net::FTP

2004-09-03 Thread Joe Youngquist
Thanks Lee for the response, but it's a no go.

I guess in SP2 they removed the ability of "fine grain control" of what
applications have access to down to port ranges and I think this is where
the Net::FTP is being blocked at.

>From tests, each time I run the script the port on the local machine changes
and I'm guessing that the firewall in SP2 is opening up a port that it sees
Perl trying to use for one instance and the next time the same script is
used, trying to access on a different port is being blocked.

Anywho, there doesn't seem to be a way to open port ranges in the Firewall
software for SP2.  It's more "run program X, program X doesn't have
permission to access internet, Prompt user asking if they want program X to
access the internet, user clicks yes/no, that's all user does".

You can edit the "scope" of the access rule, but that's all and it doesn't
allow ports or port ranges in the manual config of IP's.

Thanks for the idea to try though.


- Original Message - 
From: "Leroy G. Blimegger Jr." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Thursday, September 02, 2004 9:37 PM
Subject: RE: Microsoft's SP2 Firewall blocking Net::FTP


> I don't use the Windows Firewall in SP2 (I still prefer another vendor),
but
> I know you can open the Windows Security Center control panel, select
> Windows Firewall and add programs and ports to the exception list
> (Exceptions Tab), which will allow access through the firewall for the
> specified programs and/or ports.
>
> Hope this helps!
>
> Lee
>
>
> Hey folks,
>
> Here is a little annoying problem from Billy again.  With the
> "beefier" version of the personal firewall that comes with Win XP in the
> latest service pack (2) I've found that even when setting "Perl" to have
> access to the internet, it's still blocking the connection.
>
> I've tried to set the connections to passive, but still no dice.
>
> Best I can tell there are no options in the firewall to set specific
> port range that Perl can have access to.  So, only work-a-round fer
> now is to turn off the firewall and run the scripts then turn it back on.
>
> This isn't a live and death situation, I'm behind a hardware
> firewall as is, but wouldn't mind having an extra layer of protection,
just
> wondering if anyone else has bumped into the same problem and have come by
a
> solution.
>
>
> thanks,
>
> JY
>
>

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: [Attn: McCarty, Michael F] Re: Out of Office AutoReply: file handle strangeness

2004-07-18 Thread joe
Having the autoresponder Randy has set up to respond to OOO messages respond
directly back to the user instead of the user and the list may possibly
reduce it by another 1/3. :o)

  joe
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Glenn Linderman
Sent: Sunday, July 18, 2004 11:31 AM
To: [EMAIL PROTECTED]
Cc: McCarty, Michael F; [EMAIL PROTECTED]
Subject: Re: [Attn: McCarty, Michael F] Re: Out of Office AutoReply: file
handle strangeness

So what doesn't the list manager simply make "Out of Office" a forbidden
sequence in a subject or body, and trash such emails?  That would cut the
autoreplies at least by 2/3rds.

I could certainly live with that restriction and it seems you can't
teach people how to do it right, just like you can't teach people not to
install viruses on their computer, when the instructions are so clear and
self-contained.


On approximately 7/17/2004 11:50 PM, came the following characters from the
keyboard of Randy W. Sims:
> On 7/18/2004 2:36 AM, McCarty, Michael F wrote:
> 
>> I will be out of the office Thursday July 15 and Friday, July 16, 
>> returning on Monday, July 19.
> 
> 
> Please turn off your "Out of Office AutoReply" for the perl-win32-users 
> mailing list.
> 
> Randy.

-- 
Glenn -- http://nevcal.com/
===
The best part about procrastination is that you are never bored,
because you have all kinds of things that you should be doing.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: LDAP server search limits

2004-07-05 Thread joe
You do not want to change it. 

Changing that isn't a good way to do it. You want to set yourself up to use
paged ldap searching and specify a page size of less than 1000. 

http://search.cpan.org/~gbarr/perl-ldap/lib/Net/LDAP/Control/Paged.pm


Adjusting the return set size can cause undue hardship on the server if
cranked up high enough. 

  joe

-
http://www.joeware.net   (download joeware)
http://www.cafeshops.com/joewarenet  (wear joeware)
 
 


 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Jensen, John T
Sent: Monday, July 05, 2004 7:33 PM
To: [EMAIL PROTECTED]
Subject: LDAP server search limits

Somewhere in Active Directory an LDAP search limit is set of 1000 items
returned.  I have posted this on Net::LDAP but it's really an AD issue.
Anyone here got any idea how to change this?  It's driving me nuts!
Google has so far been fruitless. 
 


jj

John Thayer Jensen, System Administrator Computing Service, School of
Business University of Auckland

Room 256, 15 Wynyard Street

voice: +64 9 373-7599 ext 87543
FAX: +64 9 373-7696
mobile: +64 21 049-7702
quickdial: 60001

http://staff.business.auckland.ac.nz/~j.jensen 


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: app to look/view/inspect http traffic...

2004-06-09 Thread joe
You are describing a network sniffer aka packet sniffer...

You should probably check out Ethereal. 

www.ethereal.com

 
  joe


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
bruce
Sent: Wednesday, June 09, 2004 1:38 PM
To: 'General Red Hat Linux discussion list';
[EMAIL PROTECTED]
Subject: app to look/view/inspect http traffic...

hi...

i'm trying to figure out what's going on with a site from my browser... does
anybody have/recommend a good "open source" app to see/review the http
traffic going back/forth between my box and the site's server...

my issue is that i can use a browser and i get the html/response within the
browser. when i try to emulate what the browser is doing, using
libwww/mechanize/etc... i get something different. in fact, when i try toto
insert what i believe to be the url/query into a browser url address, i get
a different response...

so i'm looking to actually try to see the http trafffic that goes back/forth
between my browser and the server to track down what's really being sent...

i'd prefer something that's quick/easy to setup and run, that produces a
reasonable output!!!

thanks...

-bruce


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Any Suggestions

2004-05-20 Thread Joe Youngquist
wxPerl is also a solid option.  If your only developing for Windows, then
win32::GUI is an option too - though in my past experience, wxPerl is the
better of the GUI options out there (not to create a flame - just mho).


- Original Message - 
From: "Wong, Danny H." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 20, 2004 1:59 PM
Subject: Any Suggestions


> Hi All,
> Here is what I am trying to do. I have a perl script that checks
> for a users input. If the user enters the wrong value, I want to pop up
> a input/text dialog for the user to enter the right information. Any
> suggestions on what to use? Is tk the only option?
>
> Thanks
> Danny Wong
> SCM Engineer
> PowerTV Inc.,
> "We turn again to the unending struggle for the common good of all
> Americans and for those multitudes around the world who look to us for
> leadership in the cause of freedom." Al Gore
>
>
>
> - - - - - - - Appended by PowerTV, Inc. - - - - - - -
> This e-mail and any attachments may contain information that is
confidential, proprietary, privileged or otherwise protected by law. The
information is solely intended for the named addressee (or a person
responsible for delivering it to the addressee). If you are not the intended
recipient of this message, you are not authorized to read, print, retain,
copy or disseminate this message or any part of it. If you have received
this e-mail in error, please notify the sender immediately by return e-mail
and delete it from your computer.
>
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: MySQL/Perl

2004-04-09 Thread Joe Youngquist
from the DBI docs:

the connect string is:
$dbh = DBI->connect($data_source, $username, $auth, \%attr);

where data_source = "DBI:mysql:NameOfDatabase:HostNameOrIP",
where username = "allowable username" (try root first, root should always
have permissions to databases, so the removes a possible user permission
issue),
where auth = "users_password" (default mysql install on Window's the "root"
user password is blank ... very secure!)

Assuming your database is on the computer your running the test scripts from
try:

use DBI;
my $dbh = DBI->connect('DBI:mysql:mysql:dbremer', 'root', '')
 or die "\nI could not connect to the
database\n$DBI::errstr";
$dbh->disconnect;
exit(0);
--
if your Perl.exe is still crashing, try removing DBI and DBD::Mysql and
reinstalling them.



- Original Message -
From: "Dirk Bremer (NISC)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 09, 2004 1:11 PM
Subject: Re: MySQL/Perl


> > 
> > >
> > > I then installed DBD::mysql via PPM. I'm running Perl 5.6.1
> > > build 633 on a
> > > Win 2k box, the same box that is hosting MySql. I have a small script:
> > >
> > > use diagnostics;
> > > use strict;
> > > use warnings;
> > >
> > > # Declare modules.
> > > use FindBin qw($Bin);
> > > use lib $Bin;
> > >
> > > use DBI;
> > >
> > > my $dbh =
> > > DBI->connect('DBI:mysql:database=ftp_transfers;host=dbremer;po
> > > rt=3306');
> > > unless (defined $dbh) {print("database connection failed\n")}
> >
> > Maybe it succeeded :-) Do you have any code following like
> >
> > print "Successful connection\n";
>
>
> Maybe I didn't make my self clear: it is not possible to get a successful
> connection message as Perl itself is aborting, not the script per se. I am
> positive that Perl is aborting on the connect line.
>
> Dirk Bremer - Systems Programmer II - ESS/AMS  - NISC St. Peters
> USA Central Time Zone
> 636-922-9158 ext. 8652 fax 636-447-4471
>
> [EMAIL PROTECTED]
> www.nisc.cc
>
>
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Regular expression to test for numeric values

2004-04-01 Thread Dial Joe

How about this (direct from "The Perl Cookbook"[1])  ??


warn "has nondigits"if /\D/;
warn "not a natural number" unless /^\d+$/; # rejects -3
warn "not an integer"   unless /^-?\d+$/;   # rejects +3
warn "not an integer"   unless /^[+-]?\d+$/;
warn "not a decimal number" unless /^-?\d+\.?\d*$/; # rejects .2
warn "not a decimal number" unless /^-?(?:\d+(?:\.\d*)?|\.\d+)$/;
warn "not a C float"
   unless /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/;

The cookbook is the first place I look for this kind of stuff.
HTH,
Joe Dial

[1] 
"Perl Cookbook 
Tips and Tricks for Perl Programmers"
By Tom Christiansen, Nathan Torkington
1st Edition August 1998 
www.oreilly.com 
ISBN: 1-56592-243-3

Current Version is:
"Perl Cookbook, 2nd Edition"
By Tom Christiansen, Nathan Torkington
2nd Edition August 2003 
ISBN: 0-596-00313-7
964 pages, $49.95 US, $77.95 CA, £35.50 UK 

-Original Message-
From: Motter, Jeffrey D [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 01, 2004 1:40 PM
To: Perl-Win32-Users
Subject: Regular expression to test for numeric values


I've read the FAQ's on this, but they don't seem to answer the question.

I have a variable that could contain any value( alpha, alpha-numeric, or
numeric). If the value is NOT numeric, I need to change the variables' value
to "0"( as in zero ).

Examples:
$txtype="2.314";   # is numeric, so keep the value
$txtype="-2.314";  # is numeric, so keep the value
$txtype="7";   # is numeric, so keep the value
$txtype="-7";  # is numeric, so keep the value
$txtype="2.31.4";  # is not numeric, so change the value to 0
$txtype="7-7"; # is not numeric, so change the value to 0
$txtype="UNKNOWN"; # is not numeric, so change the value to 0
$txtype="7+E09";   # is not numeric( even though it really is ), so change
the value to 0


My guess is that I need a regex that will match on any character that is:
not 0-9 
or 
more than one "." 
or 
more than one "-" 
or if "-" is not the first character of the string

Any ideas? Is it possible to do without using additional modules?

Thanks!

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Unusual Tk question.

2004-02-06 Thread Joe Youngquist
Not to create a flame war on the best GUI tool kit to use, but are you stuck
to using only Tk?

If not, then take a look at wxPerl (http://wxperl.sourceforge.net/) you can
tie output to a log window pretty easily...




- Original Message -
From: "Beckett Richard-qswi266" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 06, 2004 10:27 AM
Subject: RE: Unusual Tk question.


> Ah! Got it, thanks to all those who helped.
>
> I'd just got into the habit of withdrawing the main window straight after
> creating it, for exactly the reason that I don't want to do that this time
> (if you see what I mean!).
>
> Thanks again, I'll take the 2x4 to myself ;-)
>
> R.
>
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] Behalf Of
> > Beckett Richard-qswi266
> > Sent: 06 February 2004 12:38
> > To: [EMAIL PROTECTED]
> > Subject: Unusual Tk question.
> >
> >
> > Guys,
> >
> > I find myself in a slightly tricky, and possibly unusual situation.
> >
> > I have been handed a GUI, written in Delhpi. I have a button
> > that collects
> > some parameters, then fires off my perl script.
> >
> > Now, I want to use Tk and open up a window with a Text widget
> > in it that
> > reports the progress of the script.
> >
> > Unfortunately, I don't know how to do this, so that the
> > script creates the
> > window and widget, displays it, then gets on with it's 'work'.
> >
> > The only ways I know always end up with a GUI that sits there
> > and waits for
> > the user to click on a button before it will do anything.
> >
> > Does my question make sense?
> >
> > Can anyone help me out, or can't it be done?
> >
> > Thanks.
> >
> > R.
> > ___
> > Perl-Win32-Users mailing list
> > [EMAIL PROTECTED]
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> >
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: DBI Question

2004-01-30 Thread Joe Youngquist
What I think your looking for are the column names in order (the hash method
returns the column names in a seemingly random order)

So what you want to use is:

my $sth = $dbh->prepare("SELECT col1, col2, col3 FROM table1 WHERE 1");
$sth->execute();
my $arrayref = $sth->{NAME};

foreach my $colName (@$arrayref) {
print "\nColumn Name: $colName";}
}

while(my @data = $sth->fetchrow_array()) {
...
...
}

$sth->finish;

hope this helps,

- Original Message -
From: "Mark Harris" <[EMAIL PROTECTED]>
To: "'ashish srivastava'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Friday, January 30, 2004 9:34 AM
Subject: RE: DBI Question


> Hi Ashish,
>
> If you get the results using a hash reference rather than just an array of
> values then you can:
> (not tested...)
>
> my $row = $stmt->fetchrow_hashref(); # returns a reference to a hash
indexed
> by column name
>
> foreach my $column (keys %{$row}) {
>
>   print "$column: " . $results->{$column} . "\n";
>
> }
>
> will print "columnname: value" for each field returned for a given row.
>
> Mark
>
> -Original Message-
> From: ashish srivastava [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 30, 2004 1:48 PM
> To: [EMAIL PROTECTED]
> Subject: DBI Question
>
> Hi
> Is it possible to get the names of the columns which a user has selected?
I
> mean suppose a user writes a query as :
> select ename,deptno,sal from emp;
> then can we print the column name(ENAME,DEPTNO,SAL) ?
> Thanks
> Ashish
>
>
>
>
>
>
>
>
>
> Easiest Money Transfer to India. Send Money To 6000 Indian Towns.
> This message contains confidential and potentially legally privileged
> information solely for its intended recipients and others may not
> distribute, copy or use it. If you have received this communication in
> error, please tell us by return email and delete it, and any copies of it.
>
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


SIG Help - "Terminating on signal SIGALARM(14)"

2004-01-27 Thread Joe Youngquist



Hello all,
 
This is my first time into trying to deal with 
SIGALARMS, mostly due to the fact that this is the first time I'm getting 
applications dieing out with a message :
 
"Terminating on signal SIGALARM(14)"
 
I did a dump of what is held in the %SIG and 14 is 
undef.
 
I'm not sure what is causing the alarm to fire, 
it's not happening under the same conditions.  Another words, I cannot do 
x, y and z and always cause SIGALARM(14) to fire.
 
I tried to trap the signal, but didn't seem to 
handle it at all...
 
$SIG{14} = 'SigHandler14'; # also tried $SIG{'14'} 
no luck there either
sub SigHandler14 {    
local($sig) = @_;    print "\nCaught 
SIG$sig.";    exit(1);}
 
trying to use:
$SIG{'14'} or $SIG{14} = 'IGNORE'; 
 
tells me that "No such signal: SIG14" 
 
if I place this above where I: use strict; no 
problems, but if I place it below, I get complaints about $SIG not being 
defined...how do I use strict and still have access to %SIG?
 
I've read the man pages but not sure how to proceed 
if no such signal, but yet I'm terminating on it under differing 
situations.
 
I'm on a Win XP Pro OS, Perl 
5.8.0 (multi-thread) Build 806 by ActiveState.
 
TIA
 
JY


Re: parsing text

2003-12-10 Thread Joe Youngquist
Hello Lee,

My first attempt was to  use a regular expression, but there are no
guaranties on the header format...
The real bugger is sometimes the column headers will not have any spaces
between them, though this is rare, it is something I'll need to keep an eye
on and change manually - I'm not that great of a programmer to tell me
script to "make a judgment call on that there column chief". :)
My hope right now is just to make something that works with my data 99% of
the time and something that will work as close to 100% of the time as long
at the column headers have a space between them.  Once I do, this would be
the first time I'd have the joy of contributing to the Perl community.

JY
- Original Message -
From: "Lee Goddard" <[EMAIL PROTECTED]>
To: "Joe Youngquist" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, December 10, 2003 5:30 AM
Subject: RE: parsing text



Nice idea: I'm surprised it's not been done before
(I didn't look on CPAN ...)

Just a thought, fwiw: if you are sure there will be
no spaces in your "leaders" - the bit between the
row name and the data (...) - and if you can be sure
that each column consists of data without white space
then you could surely use a regular expression to
get at the data?

You $text string does have a row (number 6) with
a space in the leader: but maybe you get around
that by requiring a column to have white space on
either side...?

Just a thought.
lee

-Original Message-
From: Joe Youngquist [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 09, 2003 9:58 PM
To: [EMAIL PROTECTED]
Subject: parsing text


Hello list,

I've been trying to figure out a generalized method of parsing space
formatted text to outout into html tables.  The data is verly likely written
out using Perl Reports and Pictures, has anyone come up with a general
method?

Here's a few examplesof the text that I'd format to html tables:

NOTE: Best to use Courier New font to keep the formatting


|-OVERALL STATISTICS--|
TOTALS   O-REB D-REB TOTAL   PF  FOA   TO  A/TO Hi Pts
---
Lowe, Kenneth... 01515   15   0   14   11   1.3 26
Teague, David... 616229   094   2.2 19
Booker, Chris...1321348   0   10   10   1.0 20
Buckley, Melvin. 51722   11   0   108   1.2 20
McKnight, Brandon... 11112   15   1   18   15   1.2 13
Buscher, Brett.. 1 910   15   099   1.0 10
Kartelo, Ivan...221941   14   027   0.3 12
Kiefer, Matt 91221   14   049   0.4  7
Parkinson, Austin... 3 5 84   0   207   2.9  8
Nwankwo, Ije 2 2 42   022   1.0  2
Carroll, Matt... 1 3 46   002   0.0  2
Ford, Andrew 0 1 12   001   0.0  0
Garrity, Kevin.. 0 1 10   000   0.0  0
Hartley, Chris.. 1 0 10   001   0.0  0
Total...72   143   215  115   1   98   86   1.1 78
Opponents...72   130   202  131   -   62  103   0.6 68

   TEAM STATISTICS PUR  OPP
   
   SCORING...  431  352
 Points per game. 71.8 58.7
 Scoring margin..+13.2-
   FIELD GOALS-ATT...  142-328  134-336
 Field goal pct.. .433 .399
   3 POINT FG-ATT   36-10225-99
 3-point FG pct.. .353 .253
 3-pt FG made per game...  6.0  4.2
   FREE THROWS-ATT...  111-14759-99
 Free throw pct.. .755 .596
   REBOUNDS..  215  202
 Rebounds per game... 35.8 33.7
 Rebounding margin... +2.2-
   ASSISTS...   98   62
 Assists per game 16.3 10.3
   TURNOVERS.   86  103
 Turnovers per game.. 14.3 17.2
 Turnover margin. +2.8-
 Assist/turnover ratio...  1.1  0.6
   STEALS   44   31
 Steals per game.  7.3  5.2
   BLOCKS   23   23
 Blocks per game.  3.8  3.8
   WINNING STREAK6-
   

Re: parsing text

2003-12-10 Thread Joe Youngquist
Thank you $Bill,

I'll have to digest your code to see if there is something I can integrate
into the solution.
The problem in using a hash to hold the column start positions is that those
columns shift based on how much "stat" is placed in the column.
For example, the PF column once the total reaches the hundreds, the column
will expand wider, pushing the other columns to the right.
But there is some promise here, if I compromise on being completely
generalized in the parsing.  By "generalized" I mean that I supply the
parser with no strings to try and match.  This way I can use the same parser
for any kind of text that is in this kind of format.

Thanks again, for the time you spent on this and I think that there is some,
well in fact, most of the code after the defining of the section starts and
the column starts, do a much better job at pulling out the data than what I
had thought of.

JY

- Original Message -
From: "$Bill Luebkert" <[EMAIL PROTECTED]>
To: "Joe Youngquist" <[EMAIL PROTECTED]>
Sent: Wednesday, December 10, 2003 7:35 AM
Subject: Re: parsing text


> Joe Youngquist wrote:
> > Hello list,
> >
> > I've been trying to figure out a generalized method of parsing space
> > formatted text to outout into html tables.  The data is verly likely
> > written out using Perl Reports and Pictures, has anyone come up with
> > a general method?
>
> Here's a slightly different approach breaking the text into 3 sections
> and lines in that section and fields in each line (didn't get to the
> HTML part yet) :
>
> my $text = < |-OVERALL
STATISTICS--|
> TOTALS   O-REB D-REB TOTAL   PF  FOA   TO  A/TO Hi Pts
> --
-
> Lowe, Kenneth... 01515   15   0   14   11   1.3 26
> Teague, David... 616229   094   2.2 19
> Booker, Chris...1321348   0   10   10   1.0 20
> Buckley, Melvin. 51722   11   0   108   1.2 20
> McKnight, Brandon... 11112   15   1   18   15   1.2 13
> Buscher, Brett.. 1 910   15   099   1.0 10
> Kartelo, Ivan...221941   14   027   0.3 12
> Kiefer, Matt 91221   14   049   0.4  7
> Parkinson, Austin... 3 5 84   0   207   2.9  8
> Nwankwo, Ije 2 2 42   022   1.0  2
> Carroll, Matt... 1 3 46   002   0.0  2
> Ford, Andrew 0 1 12   001   0.0  0
> Garrity, Kevin.. 0 1 10   000   0.0  0
> Hartley, Chris.. 1 0 10   001   0.0  0
> Total...72   143   215  115   1   98   86   1.1 78
> Opponents...72   130   202  131   -   62  103   0.6 68
>
>TEAM STATISTICS PUR  OPP
>
>SCORING...  431  352
>  Points per game. 71.8 58.7
>  Scoring margin..+13.2-
>FIELD GOALS-ATT...  142-328  134-336
>  Field goal pct.. .433 .399
>3 POINT FG-ATT   36-10225-99
>  3-point FG pct.. .353 .253
>  3-pt FG made per game...  6.0  4.2
>FREE THROWS-ATT...  111-14759-99
>  Free throw pct.. .755 .596
>REBOUNDS..  215  202
>  Rebounds per game... 35.8 33.7
>  Rebounding margin... +2.2-
>ASSISTS...   98   62
>  Assists per game 16.3 10.3
>TURNOVERS.   86  103
>  Turnovers per game.. 14.3 17.2
>  Turnover margin. +2.8-
>  Assist/turnover ratio...  1.1  0.6
>STEALS   44   31
>  Steals per game.  7.3  5.2
>BLOCKS   23   23
>  Blocks per game.  3.8  3.8
>WINNING STREAK6-
>  Home win streak.3-
>ATTENDANCE3311823435
>  Home games-Avg/Game.

parsing text

2003-12-09 Thread Joe Youngquist
t because "down" the table
  
 there are no other spaces)10-14:  spaces15-17:  
text18-19:  spaces20-22:  text23-26:  
spaces27-31:  text
 
Line two:0-31:   spaces (by the logic that dashes are counted 
like a space)
 
Line three:0-4 text5-14    
spaces15-17:  text18-19:  spaces20-22:  
text23-28:  spaces29-31:  text
 
Line four:0-9:    text10-14:  
spaces15-17:  text18-19:  spaces20-22:  
text23-28:  spaces29-31:  text
 
From this I can tell the program for each line in the table:from 0 to 9 
grab the text, from 15 to 17 grab the text,from 20 to 22 grab the 
text,from 27 to 31 grab the text,
 
I would end up with (after ignoring line two and stripping leading and 
trailing space)   BY 
PERIOD  1st  
2nd  
Total    
Team  203  
228  
431    
Opponents  164  
188  
352 
 
 
I dunno, just tossing this out the list for the hopes for a fresh 
perspective to the problem.  Below is some code I'm trying to tell the 
program how to spot spaces down the table.
 
Thanks in advanced for your time in reading all this.
 
Joe 
Y.---Code:---
 
 
my $text = 
"    
|-OVERALL 
STATISTICS--|TOTALS   
O-REB D-REB TOTAL   PF  FO    A   
TO  A/TO Hi Pts 
--- 
0    15    15   15   
0   14   11   1.3 
26 6    
16    22    9   0    
9    4   2.2 
19    13    
21    34    8   0   
10   10   1.0 
20 5    
17    22   11   0   
10    8   1.2 
20 1    
11    12   15   1   18   
15   1.2 
13.. ..    1 
9    10   15   0    
9    9   1.0 
10    22    
19    41   14   0    
2    7   0.3 
12 9    
12    21   14   0    
4    9   0.4  
7 3 
5 8    4   0   
20    7   2.9  
8 2 
2 4    2   0    
2    2   1.0  
2 1 
3 4    6   0    
0    2   0.0  
2 0 
1 1    2   0    
0    1   0.0  
0 0 
1 1    0   0    
0    0   0.0  
0 1 
0 1    0   0    
0    1   0.0  
0Total...    72   143   
215  115   1   98   86   
1.1 78Opponents...    
72   130   202  131   -   62  
103   0.6 68";
 
my @lines = split(/\n/,$text);
 
###   Scan across the line and for each column run down 
the rows checking for a space or - exists## if there is a space, then it's 
likely that there is a pattern for seporating the data in the 
columns.  if the previous column has spaces or -'s and the 
current column has numbers, letters, pipes or decimals, ## then the current 
column is the beggining of a new cell.#my $lineCount = @lines;print 
"\nNumber of Lines: $lineCount";
 
 
 
###   Build a matrix of characters for the data, where we can 
find row x col values.##my $x = 0;my $MaxCols = 0;print 
"\nBuilding Matrix";foreach my $line (@lines) {    my 
@data = "" $line);    my $y = 0;    
foreach my $char (@data) {    
$Matrix[$x][$y] = "$char";    
$y++;    }    $MaxCols = $y if($y >= 
$MaxCols);    $x++;}
 
my %Cells;my $lineLoopCount = 0;for(my $x = 0; $x < $lineCount; 
$x++) {    for(my $y = 0; $y < $MaxCols; $y++) 
{    next if not defined 
$Matrix[$x][$y];    #next 
if($Cells{$y} eq ' ');    for(my $z = 
0; $z < $lineCount; $z++) 
{    #print 
"\nTesting Col: 
$y";    
if($Matrix[$z][$y] eq ' ' or $Matrix[$z][$y] eq '-' or $Matrix[$z][$y] eq '|') 
{    
#print "\n\tSpace Found at 
[$z][$y]";    
$space = 
1;    } else 
{    
 $space = 
0;    
}    
}    if($space) 
{    
$Cells{$y} = "|";    } else 
{    
$Cells{$y} = " ";    
}    }}
 
print "\n";foreach my $key (keys %Cells) {    print 
"$Cells{$key}";}print "\n";
 
exit(0); 
 


Help installing Iconv >1.1

2003-11-10 Thread Frazier, Joe Jr
Ok, first, let me say I have no experience with C++, so I need simplistic steps to 
take.  I am using ActivePerl 626 on Windows 2000.  I also have the .Net framework 
installed (not sure of the version).

Here is what I get when trying to install via CPAN shell  "install Text::Iconv":
. Downloading stuff cut out .

Text-Iconv-1.2/
Text-Iconv-1.2/README
Text-Iconv-1.2/Makefile.PL
Text-Iconv-1.2/Changes
Text-Iconv-1.2/t/
Text-Iconv-1.2/t/01_charsets.t
Text-Iconv-1.2/t/00_load.t
Text-Iconv-1.2/Iconv.xs
Text-Iconv-1.2/MANIFEST
Text-Iconv-1.2/Iconv.pm
Text-Iconv-1.2/typemap
Removing previously used \.cpan\build\Text-Iconv-1.2

  CPAN.pm: Going to build M/MP/MPIOTR/Text-Iconv-1.2.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Text::Iconv

Microsoft (R) Program Maintenance Utility   Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

cp Iconv.pm blib\lib\Text\Iconv.pm
AutoSplitting blib\lib\Text\Iconv.pm (blib\lib\auto\Text\Iconv)
D:\Perl\bin\Perl.exe -ID:\Perl\lib -ID:\Perl\lib D:\Perl\lib\ExtUtils/xsubpp  
-typemap D:\Perl\lib\ExtUtils\typemap -typem
ap typemap Iconv.xs > Iconv.xsc && D:\Perl\bin\Perl.exe -ID:\Perl\lib -ID:\Perl\lib 
-MExtUtils::Command -e mv Iconv.xsc Iconv.c
cl -c  -nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT 
-DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_S
YS -DPERL_MSVCRT_READFIX -O1 -MD -DNDEBUG-DVERSION=\"1.2\"  -DXS_VERSION=\"1.2\"  
-ID:\Perl\lib\CORE  Iconv.c
cl : Command line warning D4029 : optimization is not available in the standard 
edition compiler
Iconv.c
"Running Mkbootstrap for Text::Iconv ()"
D:\Perl\bin\Perl.exe -ID:\Perl\lib -ID:\Perl\lib -MExtUtils::Command -e chmod 
644 Iconv.bs
D:\Perl\bin\Perl.exe "-ID:\Perl\lib" "-ID:\Perl\lib" -MExtUtils::Mksymlists  
-e "Mksymlists('NAME' => 'Text::Iconv', 'DLBA
SE' => 'Iconv', 'DL_FUNCS' => {  }, 'FUNCLIST' => [], 'IMPORTS' => {  }, 'DL_VARS' => 
[]);"
link -out:blib\arch\auto\Text\Iconv\Iconv.dll -dll -nologo -nodefaultlib 
-release  -libpath:"D:\Perl\lib\CORE"  -machine:x
86 Iconv.obj   D:\Perl\lib\CORE\perl56.lib oldnames.lib kernel32.lib user32.lib 
gdi32.lib winspool.lib  comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib wsock32.lib mpr.lib 
winmm.lib  version.lib odbc32.lib odbccp32.lib msvcr
t.lib -def:Iconv.def
   Creating library blib\arch\auto\Text\Iconv\Iconv.lib and object 
blib\arch\auto\Text\Iconv\Iconv.exp
Iconv.obj : error LNK2019: unresolved external symbol __imp__libiconv referenced in 
function _do_conv
Iconv.obj : error LNK2019: unresolved external symbol __imp__libiconv_open referenced 
in function _XS_Text__Iconv_new
Iconv.obj : error LNK2019: unresolved external symbol __imp__libiconv_close referenced 
in function _XS_Text__Iconv_DESTROY
blib\arch\auto\Text\Iconv\Iconv.dll : fatal error LNK1120: 3 unresolved externals
NMAKE : fatal error U1077: 'C:\WINNT\system32\cmd.exe' : return code '0x460'
Stop.
  D:\Perl\bin\nmake.EXE  -- NOT OK
Running make test
  Can't test without successful make
Running make install
  make had returned bad status, install seems impossible


I have also downloaded libiconv-1.9.1 and attempted to follow the directions there 
,but I get simular errors with unresolved external symbols and have no idea how to fix.

Thanks for any help, or if some already has this built into a binary and can package 
to a PPM, that would be great too.

Joe

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Threads In Perl?

2003-10-23 Thread Joe Youngquist
> I was wondering if there is any Thread support in Perl?
Yes, Perl 5.8
> If there is any info on this topic, links would be appreciated.
Try here: http://aspn.activestate.com/ASPN/docs/ActivePerl/lib/threads.html



- Original Message -
From: "Scott Purcell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 23, 2003 3:09 PM
Subject: Threads In Perl?


>
> I was wondering if there is any Thread support in Perl? I would like to
have my application run, and while the end-user is working in the GUI, I
would like to have a background thread, or process keeping track of certain
files that may be altered while the user is in the app.
>
> If there is any info on this topic, links would be appreciated.
>
> Thanks,
> Scott
>
>
>
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: newline...be gone

2003-10-08 Thread Joe Youngquist
your 'newline' character might be chr(13)

so a chop might do better for you or

my $newline = chr(13);

$line =~ s/$newline//;

...



HTH

JY
- Original Message - 
From: "David Byrne" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 08, 2003 3:08 PM
Subject: newline...be gone


> Greetings,
> 
> I have a question that probably easy to many...
> 
> How can I get rid of the newline at the end of $line
> (which transfers to $remainder after splitting)?
> 
> foreach $filename (@filelist) {  
> open(INPUT,"$filename");
> foreach $line () {
>   chomp($line);
>   my ($gene,$remainder) = split(/\t/,$line,2);
>   chomp ($remainder);
>   $genedex{$gene} .= "$remainder\t";
> }
> }
> 
>  
> I've tried substituting, chomping, but the newline
> remains.  It's gotta be something obvious...
>  
> Thank you very much,
> David
> 
> __
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Automate data download from internet

2003-09-24 Thread Joe Youngquist
The LWP docs have an example of using Usernames and Passwords


- Original Message -
From: "Jonathan Epstein" <[EMAIL PROTECTED]>
To: "Noushad Dawood" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, September 24, 2003 8:12 AM
Subject: Re: Automate data download from internet


> I do something similar to fetch and parse some web pages for local real
estate sales, and then run them weekly using the Windows "at" command.  The
basic idea is to fetch pages using LWP::Simple, and then parse them using
HTML::TokeParser.  As you can see below, at one point I was using
HTML::Parser instead, but with less success.
>
> Since you have multiple links to traverse, your code will probably call
HTML::TokeParser several times.  In my example, I only have a single link to
follow.
>
> Sorry, this example doesn't address the username+password issues.
>
> HTH,
>
> Jonathan
>
> -
>
> use LWP::Simple;
> use HTML::Parser;
> use HTML::TokeParser;
>
> $toke = 1;
> $washpost = "http://www.washingtonpost.com";;
> $outdir = "c:/personal/realestate/";
>
> $content =  get ($washpost .
"/wp-dyn/realestate/homesales?language=html");
>
> if (defined $content) {
>   if ( $toke) {
> $p = HTML::TokeParser->new(\$content);
> while (my $token = $p->get_tag("a")) { # look at every hyperlink on
the page
>   my $url = $token->[1]{href} || "-";
>   my $text = $p->get_trimmed_text("/a");
>   if ( $text =~ /^Montgomery Home Sales$/i) {
>   print "$url\t$text\n";
>   $_ = $url; # make output filename usable
>   s#.*/##;
>   getstore($washpost . $url, $outdir . $_);
>   }
> }
>   } else {
> $p = HTML::Parser->new(api_version => 3,
>handlers => { text => [EMAIL PROTECTED], "event,text"],
>  comment => [EMAIL PROTECTED],
"event,text"],
>});
> $p->parse($content);
> print @array;
>   }
> }
>
> At 03:26 p.m. 9/24/2003 +0400, Noushad Dawood wrote:
> >Friends...not sure whether this is the right forum to discuss this
problem.
> >I'm sure you Gurus will have some tips...here is the problem.
> >
> >I got a web site access with my own user id and password. Using this I
can
> >download some data in csv format. The download page is opened after going
> >through many links from other pages. I do this every day. Now I wanna
> >automate this process. What is the best way to do this? Can i use some
> >script to connect to the page and get my data? Any tips appreciated.
Thanks
> >in advance.
> >
> >Regards,
> >
> >/nd
>
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Need code testing on 95/98

2003-08-21 Thread Joe Camel
I have some code that needs testing on 95/98. I don't
have that software, so I am hoping someone on this
list can lend me a helping hand. Here's the code:

#! perl.exe

print "Hello world" unless !defined $ENV{PROMPT}
or (defined $ENV{CMDLINE} and $ENV{CMDLINE} eq 'WIN');

__END__

Please run this code from the command-line (ie, the
DOS prompt). Does it print "Hello World"? What OS are
you using? Thanks for the help. 


  




my $console = -t STDIN ? 1 : 0;
 



__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: CPAN Module UNIX Windows newline character

2003-08-18 Thread Joe Camel
The CPAN module is your friend. :) It will download
and install the modules for you. Either use PPM or
CPAN. Using CPAN is as simple as using PPM. Here is
the CPAN documentation:

http://search.cpan.org/author/JHI/perl-5.8.0/lib/CPAN.pm

Of course, you could also do it your way. But you are
taking the hard road. I used PPM to install
Term::ReadKey. As I mentioned before on this list,
sometimes you must substitute the double colons for
hyphens in the argument list to PPM. I don't know why.
Anyway, this worked for me & others: 

PPM install Term-ReadKey

--- "Michael D. Smith" <[EMAIL PROTECTED]>
wrote:
> 
> Then someone should talk to someone about this page
> 
>
http://search.cpan.org/author/JHI/perl-5.8.0/pod/perlmodinstall.pod
> 
> 
> I didn't think what it says there was right anyway.
> It says put the file in 
> C:\perl\lib. I think Win32::Foo should go in
> lib\Win32\Foo.pm
> 
> And that Term::Readkey I was trying to install
> should go in 
> C:\perl\lib\term\Readkey.pm
> 
> AT least that's the way it looks like the others are
> ordered. Of course, 
> that don't mean a whole lot, the Win32::API
> installed itself totally 
> different from the others. It's in
> C:\Perl\MSWin32-x86-multi-thread-5.8 and 
> is still a tar.gz format
> 
> but that Don't mean I have to like this -- this --
> oddness :)
> 
> ms
> 
> 
> 
> At 07:01 PM 8/17/03, you wrote:
> >You should use the CPAN.pm module to install
> modules
> >on CPAN. The CPAN module is a core Perl module, so
> you
> >already have it. I suggest you read the CPAN.pm
> >documentation to get started. CPAN.pm is similar to
> >PPM.
> >
> >Apparently, you downloaded the package via the CPAN
> >website. The CPAN.pm module will properly install
> the
> >package for you. It makes things much simpler. :)
> >
> >--- "Michael D. Smith" <[EMAIL PROTECTED]>
> >wrote:
> > >
> > > I just made first attempt at downloading a
> module
> > > from CPAN. When I opened
> > > it with Notepad, it had little back boxes
> instead of
> > > newlines. I think this
> > > is the difference between UNIX and Windows
> newline
> > > character.
> > >
> > > Anyway, I opened it with MS WORD 2000, saved it
> as a
> > > text file, renamed it
> > > PM and now it seems to have proper Windows
> newlines.
> > >
> > > Question is: Did this affect it in any other
> way?
> > > Would leaving it the way
> > > was have affected it's operation on AS PERL?
> > >
> > > I don't see how it could, the current
> ActiveState PM
> > > files all have Windows
> > > newlines, but my not seeing how it could, has
> > > created previous disasters:)
> > >
> > > Please advise.
> > >
> > > ms
> > >
> > > ___
> > > Perl-Win32-Users mailing list
> > > [EMAIL PROTECTED]
> > > To unsubscribe:
> >http://listserv.ActiveState.com/mailman/mysubs
> >
> >
> >__
> >Do you Yahoo!?
> >Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> >http://sitebuilder.yahoo.com
> 
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe:
http://listserv.ActiveState.com/mailman/mysubs


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: pound sign trouble

2003-07-08 Thread Frazier, Joe Jr

> Message: 19
> From: "Sisyphus" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Subject: Re: pound sign trouble
> Date: Tue, 8 Jul 2003 16:55:46 +1000
> 
> 
> - Original Message -
> From: "Peter Guzis" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, July 08, 2003 11:30 AM
> Subject: RE: pound sign trouble
> 
> 
> > My Windows 2000 box exhibits the same behavior.  I believe 
> you are running
> into an ancient limitation of the DOS shell.  DOS and its 
> descendents have
> never been particularly good at handling extended characters. 
>  Back in the
> day, if you tried to print a text file containing those 
> characters to a
> printer it was not what one would expect.
> >
> > perl -e "print ord(someextendedcharacter);" will yield 
> wildly inaccurate
> results.  However, if you place the same statement in a perl 
> script file and
> run it, everything works as intended.
> >
> >
> 
> It seems to be always a matter of converting between 
> cp850(DOS) and cp1252
> (Windows) codesets - which can be done with Text::Iconv or 
> the Encode module
> (perl 5.8 only).
> 
> The annoying thing is that it's difficult to anticipate when such
> conversions are going to be necessary.
> 
> I would have expected that
> perl -e "print ord('£');"
> would produce '156', in which case no such conversion would be needed.
> 
> I expected that becauses if I run the following script and 
> enter the £
> symbol at the prompt, it prints 156.
> 
> my $sym = ;
> chomp($sym);
> print ord($sym);
> 
> I am no longer surprised when my expectations are
> incorrect :-)
> 
> Cheers,
> Rob
> 


What Rob said...  Basically, when IBM(or ?) created the extended characterset, they 
reserved 127-161 as non usable characters (there a "few" exceptions).  Then, of 
course, Mircosoft ignored said standard and put in some "special" characters into 
those Decimal bytes places in the windows-1252 codepage.  Such characters as the "left 
qoute", "right quote", florin, elipse(looks like 3 periods, but is a single 
character), etc.

Note that this is NOT the same as Latin-1, Latin-2, or any other "Latin-x" ISO 
encoding.  All of the "Latin" ISO encodings properly follow this standard of not using 
these reserved characters.  This is something which is a hugh headache when using XML 
since XML parsers "assume" (in theory, we will "eventually" get there) that all passed 
data is encoded as utf-8.  If you try to parse a file containing either one of the 
"Latin-x" or windows-1252 characters in which the XML encoding has not been declared, 
then the parser will croak (this is what is is supposed to do by the way for any 
newbies).  This is to encorage users to start saving all their data in utf-8 
format(encoding) in the first place.  The basic thing is, most OS's do not support 
utf-8 directly in their shells at this point(correct me if I am wrong on this), and 
this is the problem you are seeing with the double character "glyph" junk which makes 
up a single character when read.

Hope that makes everything clear as mud for ya'll.

Joe
























___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Need "good" sockets, preferably multi-threaded, client and server skeleton code

2003-07-04 Thread Joe Flowers
Will someone please send me some good, fundamentally sound (and memory
leakless) client and server skeleton socket code that is preferably
multi-threaded (but I'd really like a good fork example too) and that is
preferably as cross-platform as possible?

Many many thanks!

Joe

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: testing e-mail validity without sending an e-mail

2003-06-23 Thread Frazier, Joe Jr

> Date: Fri, 20 Jun 2003 09:12:43 -0700
> From: viktoras <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: testing e-mail validity without sending an e-mail
> 
> Hi all,
> 
> It may sound funny but this is how I wanted to protect my 
> mailbox from 
> spamming. We are going to have several forms on-line that 
> send messages 
> directly to our inboxes (user feedback, etc...). The thing I 
> wanted to 
> do with smtp is to avoid sending an odd message to my  inbox (I have 
> enough of spam in my own trash folders from "ordinary" spammers)  or 
> mailboxes of my coleagues untill the reply address of a sender is 
> completely verified.
> O.K., I will stick with ordinary syntax check and MX lookup. If this 
> fails, then probably sending a message and interpretting 
> bounces seems 
> to be the only possibility left. But it already looks like a 
> small-scale 
> spamming.
> 
> Thanks.
> Viktoras


Questions:
1) You expect to get all email addresses from a "POSTED" web page which then emails 
you mail box?
2) You want to filter those emails which were NOT "POSTED"?


If both of the above are true, what are you using to send the email?  Is there just a 
link to your mail box on the web page or do you have a true form with email on the 
server backend?

If the answer is that you have a form which sends the posted data via email from the 
server side, then the (possible, depending on what you are using to send the email ) 
is to add a custom header to the email sent via the server and write a wrapper script 
which connects every x minutes/hours/etc and checks for the custom header.  If it is 
not there, spike the email since it is spam...  Of course, this cannot validate that 
the user entered a valid email address on the form, but that is the best you can do.

Let us know if this is what you are looking for.

Joe
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


win32::api & CoCreateInstance

2003-06-14 Thread Joe Camel
I am having trouble figuring out the input parameter
list for the CoCreateInstance function. I am a Unix
guru who is new to Windows programming. This is what I
garnered from msdn:

STDAPI CoCreateInstance(
  REFCLSID rclsid, 
  LPUNKNOWN pUnkOuter, 
  DWORD dwClsContext, 
  REFIID riid, 
  LPVOID* ppv
); 

But this is greek to me, even with the further
explanation provided by Microsoft at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcedcom/html/cerefCoCreateInstance.asp

How would I represent the input parameter list with
the win32::api module? I looked at the win32::api
docs, which were helpful, but I am still not sure that
I am doing things right. Here is my code:

use Win32::API;
$CoCreateInstance = new Win32::API('ole32',
'CoCreateInstance', 'SPNSP', 'I');
if(not defined $CoCreateInstance) {
die "Can't import API CoCreateInstance: $!\n";
}

As you can see, 'SPNSP' is what I came up with. It is
an intelligent guess on my part. Am I right? How can I
learn more about these parameters? Thanks for any help.

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: counting files with a certain extension

2003-04-04 Thread Joe Youngquist
opendir(DIR, "path_to_/logon/input/") or die "\nCannot open Dir to
read.\nError: $!";
my @contents = readdir DIR;
closedir(DIR);

my @log_files = grep (/\.log$/) @contents;

foreach (@log_files) {
rename("path_to_/login/inputs/$_", "path_to_/logon_logs/$_");
print "Moved: path_to_/login/inputs/$_\nTo: path_to_/logon_logs/$_\n\n";
##
#   Note: please read the doc's on rename.  This is just a sample on one way
of doing something.
#  I'd suggest taking a look at file::copy if rename won't work well for
your situation.
##
}

you can make this into a subroutine really easy, so you can use the code for
all kinds of things where you need to move file types...btw, usually your OS
also has a tool for this.

sub MoveFiles {
my ($srsDir, $fileType, $dstDir, $bShowMovement) = @_;

opendir(DIR, $stsDir) or die "\nCannot open $srsDir to read.\nError: $!";
my @contents = readdir DIR;
closedir(DIR);

my @log_files = grep (/$fileType$/) @contents;

foreach (@log_files) {
rename("$srsDir/$_", "$dstDir/$_");
print "Moved: $srsDir/$_\nTo: $dstDir/$_\n\n" if($bShowMovement);
##
#   Note: please read the doc's on rename.  This is just a sample on one way
of doing something.
#  I'd suggest taking a look at file::copy if rename won't work well for
your situation.
##
}

}

Then you can call it:


MoveFiles("/path/to/folder/", ".html", "/path/to/put/files/", 0);  #Don't
show movement print statements.
MoveFiles("/path/to/folder/", ".html", "/path/to/put/files/", 1);  #Show
movement print statements.


hth,
JY
- Original Message -
From: "rverven007" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Thursday, April 03, 2003 4:42 PM
Subject: counting files with a certain extension


> I have the following directory structure
>
> /logon/
> /logon/input
> /logon/logs
>
> in the directory input I got a lot of file and directories.
> I need to count the amount of files and directories in the directory
> /logon/input/ and move all files with the extension .log to the
/logon/logs/
> directory
>
> Can anyone assist me in setting up this perl script?
>
> many thanks, Ron
>
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Win32::Clipboard and Unicode

2003-03-28 Thread Carmel, Joe
Title: Win32::Clipboard and Unicode





My goal is to obtain the contents of the clipboard that contains Unicode characters (e.g., latin small O with macron U+014D) as Unicode characters.  I'm trying to use the Clip->GetAs method with some success (but it's not fully operational per the documentation as well).  Here's a small program to show the point.


use Win32::Clipboard;
$CLIP = Win32::Clipboard();
print "Clipboard contains: ", $CLIP->GetAs(13)."\n";



Let's say you have the single character "ō" on the clipboard.
Then the results are: Clipboard contains: M (0x4D 0X01)


If the clipboard contain a single character "a",
Then the results are: Clipboard contains: a 


This behavior is good!!


But, if multiple characters are on the clipboard, the function returns either the first or second characters only.
For example: If the clipboard contains abc
Then the results are: Clipboard contains: a 


And, strangely, if the clipboard contain ōne
The results are: Clipboard contains: Mn (0x4d 0x01 followed by the letter n).


Is there a solution or a solution coming for this issue?  This seems like a fundamental issue that needs to be solved in order to move Unicode text around in Windows using Perl.  Thanks,

BTW, using something like the following converts the o-macron to a regular o character, but works with an arbitrary number of characters.

tie $CC, 'Win32::Clipboard';
print "CC=".$CC."\n";


Thanks for commenting on this,


Joe 
**
Joe Carmel
Chief, Legislative Computer Systems
Office of the Clerk
US House of Representatives
2401 Rayburn House Office Building
Washington, DC 20515
202-225-1182 Fax: 202-225-6826
**





RE: question about grep

2003-02-13 Thread Dial Joe

I'm gonna de-lurk for this one.
If you look at Peter's example, you will note that grep applies a block-or-something 
to a list and returns a list.
You are applying it to the file name, not the contents.  Perl grep doesn't read files.
If this wasn't the win32 perl list, I would just advise that you really want the 
shell's grep 
[ like $lines = `grep "^Status" $project_file` to get the Status line(s) from one file 
]

Strictly within perl, you would need to open the file and snarf in its contents  to 
grep.
Maybe it would look like this (off the cuff, if errors, please point them out, to add 
value for readers):

 open (IFILE, "<$project_file" ) or die "useful message here:$!";
 @lines = grep /^Status/, ;
 close (IFILE);
 #  At this point, @lines has all the lines from $project_file that start with Status.
 #  If these files are HUGE, it might be better to roll your own match loop with while 
() {...}

HTH,
Joe Dial


-Original Message-
From: Hawley, Eric [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, February 13, 2003 1:49 PM
To: 'Peter Guzis'; Perl-Win32 (E-mail)
Subject: RE: question about grep


I tried what you did suggested and it only pulled out the word Status, here
is the code below;

#location contains the path for the report to be stored
$report_location = $location;
$report_location =~ s/\//\\/;
$report_location = "$report_location" . "\\Reports";
unless( -e $report_location) ){
  mkdir( $report_location ) or die "died creating Report Directory";
}
  
#open Report HTML file
open( FILE, "> $report_location\\$year_$month_$date_Report.htm" ) or die
"Dead creating Report";
#print intial html to report file
print FILE
"\n\n$year_$month_$date_report\n\n\n
";
  
#file paths include paths to the files, that Status should be greped from
#ex) C:\\Test.htm
foreach $project_file ( @file_paths ){
  #grep Status line from $project_file 
  @status_line = grep /^Status/, $project_file;
}
print FILE "\n\n";
close(FILE);


Hope this can point to any failures.

Thanks
Eric

--

-Original Message-
From: Peter Guzis [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 13, 2003 1:33 PM
To: Perl-Win32 (E-mail)
Subject: RE: question about grep


@matches = grep /^Status/, @data;

If this doesn't do it you might consider posting some sample data.

Peter Guzis
Web Administrator, Sr.
ENCAD, Inc.
- A Kodak Company
email: [EMAIL PROTECTED]
www.encad.com 

-Original Message-
From: Hawley, Eric [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 13, 2003 10:23 AM
To: Perl-Win32 (E-mail)
Subject: question about grep


I got a question concerning grep.  I would like to use it to pull out all
full lines of text, that starts with the word "Status", from a list of
files.  I am not really too experienced with using Metacharacters and
Metasymbols and do not know how to go about doing this with grep.  Can
someone help me out with this?

Thanks in advanced
Eric
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Install SSL support for Windows?

2003-02-13 Thread Frazier, Joe Jr
> -Original Message-
> From: Randy Kobes [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 13, 2003 9:16 AM
> To: Frazier, Joe Jr
> Cc: [EMAIL PROTECTED]
> Subject: Re: Install SSL support for Windows?
> 
> 
> On Thu, 13 Feb 2003, Frazier, Joe Jr wrote:
> 
> > What da heck do I have to do to get SSL to work with LWP?  I
> > installed Crypt::SSLeay and Net_SSLeay.pm from PPM.  I then
> > found a binary for openssl9.6g and copyed into my path ( I was
> > getting an error stating that it could not find ssleay32.dll,
> > so I renamed libssl32.dll to ssleay32.dll per the install
> > directions.)
> > 
> > Now, when I run the simple perl -MLWP::Simple -e
> > "getprint('https://my.peopleclick.com')", I get a windows
> > message box stating that "The ordinal 3212 could not be located
> > in the dynamic link library libeay32.dll" and LWP STILL says
> > "501 Protocol scheme 'https' is not supported
> > https://my.peopleclick.com>".
> 
> If the Crypt::SSLeay ppm package you got was from our
> repository (http://theoryx5.uwinnipeg.ca/ppms/ or
> http://theoryx5.uwinnipeg.ca/ppmpackages/), the needed
> libeay32.dll and ssleay32.dll libs are available under
> ftp://theoryx5.uwinnipeg.ca/pub/other/.
> 
> -- 
> best regards,
> randy kobes
> 

Thanks Randy, that worked.  I guess my guess my biggest gripe is Windows has enough of 
its own quirks, why can't windows users easily find the binaries they need to use free 
software modules.  (ie, if a module requires a dll, either include it or tell people 
how to get it.).

Anyway, thanks again Randy.  This is the second (or third) time you have directly 
helped me and I really appreciate everything you are doing on the site for hosting 
ppms(and up to date at that) that Activestate cannot or will not.



Joe
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Win32::OLE with Active directory question

2003-01-06 Thread Joe Richards
This is completely a non-perl response and a non-adsi response which is
where the issue is for this question but once I saw the recommendations of
ADSIEdit and LDP I had to put in a command line tool recommendation
especially since it is one I wrote. :op  Check out adfind which you can get
on the free win32 tools page of www.joeware.net; I actually script around it
with Perl on a nearly daily basis. It does command line LDAP Searches
against AD and since it uses LDAP instead of ADSI I am able to easily get
all attributes for an object. It will decode several of the main attributes
that are binary (Octet Strings) such as SID's, GUID's, etc.

You can also/alternatively look at ldapsearch from the iPlanet SDK which has
a little trouble with AD sometimes and you can also look at search.vbs which
is in the support tools of Windows 2000 but again that uses ADSI and you
need to specify specific attributes to return.

The answer to your question is the answer to the question "How do you
enumerate all attributes for an instantiated object with an ADSI LDAP
query?" and I don't think I have ever seen that but it definitely doesn't
mean it isn't possible or doesn't exist. I know you can query the Schema and
find out all properties that are possible but in most implementations you
will find tens if not hundreds of attributes that aren't used on a majority
of the objects.

  joe

--
- Original Message -
From: "Sean Johnson" <[EMAIL PROTECTED]>
To: "Norris, Joseph" <[EMAIL PROTECTED]>; "Perl Win32 Users (E-mail)"
<[EMAIL PROTECTED]>
Sent: Monday, January 06, 2003 8:34 AM
Subject: RE: Win32::OLE with Active directory question


You might want to look at the object through ADSIEdit and LDP ... I've
used both many times when I'm trying to figure out what attributes are
available, etc.

Sean

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Encryption question

2002-12-27 Thread Frazier, Joe Jr
Anyone have any simple sample code for encryption and decryption?  I am not sure I get 
it.  I have tried using Crypt::CBC =>blowfish (amoung other encryption routines, but 
am unable to decrypt the result given the same key).  I just am not sure if I am doing 
it wrong or what.

Basically, I need to encrypt a string, store it in a file or the registry, read with 
another process at some other time and decrypt it.  


I really dont care what type of encryption package (given it installs on Win32), 
itjust needs to be something stronger then Mime::Base64 or some simular easy to break 
encryption or obfuscation.

Help!

Joe 
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: String Parse

2002-12-26 Thread Frazier, Joe Jr

> And the third, the worse one, it's parsing input received, 
> and it's like
> this:
> 
>   while($content =~ m| class=\"list-item-odd\"> class=\"list-item-title\">(.*?)([\w\W]*?) valign=\"top\" class=\"list-item-odd\">(.*?)([\w\W]*?) valign=\"top\" 
> class=\"list-item-odd\">(.*?)([\w\W]*?) valign=\"top\" class=\"list-item-odd\">(.*?)|igmo) {
> 
> 
> But the value, every EVEN time, which it's therefore missing 
> (I'm assuming)
> looks like this:
> 
>   while($content =~ m| class=\"list-item\"> class=\"list-item-title\">(.*?)([\w\W]*?) valign=\"top\" class=\"list-item\">(.*?)([\w\W]*?) valign=\"top\" class=\"list-item\">(.*?)([\w\W]*?) valign=\"top\" class=\"list-item\">(.*?)|igmo) {
> 
> 
> What could the line look like if it was only looking for 
> list-item in the line
> with everything else, no matter if its a line with 
> list-item-odd or not?
> 
> Thank you so very much!  I've been working on these 
> modifications and working
> on them, but I need sleep badly, so I'm giving up and flat 
> out asking for
> help in solving it.  Thank you, I appreciate your time.
> 
> Merry Christmas,
> 
> Steve


Steve, since I am not quite sure what you want to do, you may wish to check out 
XML::LibXML.  This module allows parsing of xml|html fragments into an XML Dom 
structure.  You can then perform xpath node lookups based on your criteria and then 
drill down to get the data you need.  IF you want the value of every list item, no 
matter what its parent contains, then using xpath would be a perfect fit, at the cost 
of adding more code and possibly learning a new skillset (all things considered, 
learning to use XML::LibXML is a VERY good thing).  Besides that, if someone changes 
the html in any way (adding a new attribute to the tag for example), then you would 
have to go back and debug your script.  Plus, you would avoid a good deal of possible 
backtraking and backreferences. This may be negated by the size of the html string 
passed since using a DOM increases the in memory size by several times.  

I use XML::LibXML to parse jobpostboards currently to drill down into several layers 
or pages (using LWP) and verify my clients jobs are all posted by compairing data on 
each page to a DB generated list of jobs that should be on the board.  If thing you 
might go that way, get the ppm from the http://theoryx5.uwinnipeg.ca/ppmpackages/ 
repository(there are two repositories now, one for 5.6 and one for 5.8. If Randy or 
anyone else is listening, can you give the correct URL for each?)

Joe
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: OO question

2002-07-30 Thread Joe Schell



> -Original Message-
> From: Behalf Of Nathan Rimmer
>
>
> I'm starting to get into OO programming with Perl and
> have a question.
>
> As I understand it with OO - you create an object and
> then do something to it.
>

The definition of a object is data and behavior that affects that data.

> I have a list of values in an array and I wish to do
> the same "something" to all of them.
>
> Do I need to create an object for each value in the
> array and then do something to all of them ?
>
> Or can I create 1 object and do the "something" to all
> the values from within that 1 object ? (if that makes
> sense !)
>

Either.  It depends on what you are doing.

Are the values in the array truly objects?  It could be that you object is a
container (an intelligent array.)  Or it could be that your object has a
list of data which it needs to do its job.  A container will often contain
other objects.

If the data will never be exposed outside the object then it is probably
just data.  But you might make the data items objects simply for
convienence.

If the data would be exposed, then it is more likely that should be an
object.  Or that your 'container' object isn't really an object.  That is
one way to really tell if an object is an object, whether the data, rather
than the behavior, is needed outside the object (this is often a matter of
granularity, too much or too little.)

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Install fine - CGIs won't run

2002-07-24 Thread Joe Richards

By default .cgi is not associated to perl. You need to make that association
in IIS.

--
- Original Message -
From: "Robert Helms" <[EMAIL PROTECTED]>
To: "Perl_Users" <[EMAIL PROTECTED]>
Sent: Tuesday, July 23, 2002 9:15 PM
Subject: Install fine - CGIs won't run


> Hello Group,
>
> I have installed Perl5.6.1 on my new Windows 2000 Server. The
> installation seems to have been fine. The example.pl works.   Perl
> Scripts have pearl icon.
>
> The purpose of this installation is to run some CGI perl scripts on my
> website. And they won't run.
>
> I have double checked the IIS configuration.I have double checked all
> my settings against an NT machine running Perl and the same
> scripts.Still they won't run.
>
> I made a virtual directory in the domain/website folder for Perl.
Triple
> checked everything. Still they won't run.I'll bet some of you have
> been here before.
>
> Am I missing something? What is it that I haven't done? Any
> clues?Hints?Leads?
>
> Thanks in advance for your attention and assistance.
>
> Robert Helms
>
>
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Help Accessing A:

2002-07-18 Thread Joe Schell



> -Original Message-
> Behalf Of Sturdevant-Contractor, Robert W
>
> snip2...
> Thanks for the response...ya, it does sound like the file is not being
> closed. However, please look at the first sentence of my original second
> paragraph. Here's the simple code:
>
> open( FILEHANDLE, " $Line1 = ;
> $Line2 = ;
> close( FILEHANDLE );
>
> When placed in a loop, this code produces the Wrong Volume err msg as I
> described. The script acts like buffers are remaining open. Strangely, I
> have some old COBOL legacy code that acts the same way under WinNT virtual
> DOS. I was hoping this is NOT a WinNT issue and there might be a perlish
> fix.
>
> I've probably overlooked something simple, but I'm out of ideas...any help
> is appreciated. tia
>

A simple guess...

Try opening a file on the harddrive after the close.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs




Re: How to list files in directory ? How to substitute space ?

2002-07-04 Thread Joe Richards

1. "dir *.txt" or you can search the web for a win32 copy of ls, they are
out there.

2. here is what I use

$s=shift;
print "[$s]\n";
$s=~s/^\s+(.+?)\s+$/\1/;
print "[$s]\n";


ex:

[Thu 07/04/2002 10:42:03.99]
G:\temp\perl>cleanup "   this is a test files  "
[   this is a test files  ]
[this is a test files]


[Thu 07/04/2002 10:42:27.35]
G:\temp\perl>


  joe


--
- Original Message -
From: lau bella
To: [EMAIL PROTECTED]
Sent: Thursday, July 04, 2002 10:22 AM
Subject: How to list files in directory ? How to substitute space ?


I have two questions:

1. How to list files in a directory in perl ? e.g. in UNIX, use "ls *.txt"
command.

2. For a variable = "   this is a test files  ". How to
substitute space at beginning and end of variable, so that the variable
become = "this is a test files"

thanks !


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Should I use perl?

2002-07-04 Thread Joe Richards

>
> > The main reason that I am looking at reinventing the
> > wheel is that I am having troubles finding a good
> > monitoring package to run on Win2K.  Boy do I wish I
> > had a linux server at work...but they refuse to get me
> > one :-(  Sothat is the moral of the story.
> >
>
> Why don't you just get a copy of RedHat and set your PC up for dual boot?
> Even if you have to buy it yourself, its not that expensive.
> Of course you've probably need to get some co-operation from some
> other folks at work to have it work as a server so you probably should
> check first.
>

Pick up vmware and download a linux dist and create a virtual linux server.
I run dotNet Enterprise, 2K Advanced Server, and RH all from a single XP Pro
Dell 8200 Inspiron Laptop. Just beef up on memory and try to stay away from
disk intensive ops. You definitely should be able to run a low-impact
monitoring system in the background that way if you *must* use Linux.

Just from a development standpoint, vmware is damn near invaluable. The
freedom to not have to reboot to run another OS is... well liberating. :oP

 joe

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: embedding/extending problem

2002-07-02 Thread Joe Schell



> -Original Message-
> Behalf Of Calin Fandango
>
> - Original Message -
> From: "Sisyphus" <[EMAIL PROTECTED]>
>
>
> >
> > - Original Message -
> > From: "Calin Fandango" <[EMAIL PROTECTED]>
> >
>
> I just need to access (from a perl script that uses this module)
> the "a" function which is in the C application and thus it is not
> exported as it would be when building a lib. (Again, the C
> application has embedded in it a perl interpreter which runs
> scripts that use the above module)
>

When a linker needs to link against something then that something must
exist.

So if you explicitly link with method 'a' then you need something for the
linker to link with.

You can dynamically load a method which involves you writing a non-trivial
amount of C/C++ code.  But as far as I know you can only do that with dll
libraries.  Basically you dynamically load the library, search for the
exposed methods and retrieve an address for it.  Then cast it and call it.
But this only works for dlls.

However, just because a method exists in code does not mean that something
external can call it.  An obvious example of this is C++ methods which are
actually inlined during the compile process.  They would no longer even
exist as functions.  And I believe during the compile process, the compiler
can mark methods as 'external' or 'internal'.  And you can't link with a
'internal' method.  And except for doing a lot of assembly language
spelunking, probably using op code markers, there is going to be no way for
you to call an internal method.


The simple test is to forget perl for now.  Can you write a C program that
allows you to link and call that method?  If you can't then certainly
nothing in perl is going to help you with that problem.  And it simply might
not be possible (economic rather than physically.)

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Question about the old Win32::OBDC

2002-07-02 Thread Joe Schell



> -Original Message-
> Behalf Of David Jourard
>
> A while ago I created an application with Win32::OBDC by roth.
>
> The client asked if I could use a File DSN instead of a System
> DSN on an NT
> server where the client is virtually hosted (not their server).
>
> Not being too familiar with NT boxes and after going over the
> docs and some
> searching it seems that this module only works with System DSNs.
>
> Has anyone been able to do this with a File DSN.
>

For me this is a more generic question as I have tried it a number of times
and never gotten it to work.

And since this includes other languages I don't really consider it a perl
issue.

Just to verify I tried it again just now with MS Access and Java. It failed.
I know I have tried this before with java and MS SQL Server.  And I believe
I tried it in the past with C++ and MS SQL Server.  I never tried it with
Oracle so perhaps it is just a failure with MS databases.  Nor have I ever
tried it on a unix box, so it could be a failure with the MS ODBC shell.

However a quick search of the MS Developer Network Library seems to suggest
that it does work in at least some situations.  But there might be
limitations that the library notes that I missed.


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Windows PID

2002-06-18 Thread Joe Schell



> -Original Message-
> Behalf Of Ember Normand
>
> It seems that Active State has not implemented getppid.
> Any hints on how I can get the PID that is in the Windows Task Manager?

The Parent Process Id?  The task manager in windows NT doesn't have that.
And I don't think Win 9x has a pid at all so certainly the parent couldn't
have one.  I am not even sure if windows has the concept of a parent. Which
version of windows are you using?

I suspect that if there was a way to do that, then it would be done.

On Win NT $$ returns the process id of the current process.  And that does
show up in the task manager.  I think it returns something in Win 9x but I
think it is meaningless.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Re: From Vladimirs

2002-06-13 Thread Joe Schell


> -Original Message-
> Behalf Of Chris Anderson
> 
> 
> Here is Vladimir's reply...
> 
> And yes, he has tried forward slashes, versus backward slashes
> to no avail.

Here is a guess (using the escape character for the NT shell.)

"rsh 213.165.192.242 -l intercable sh accounting ^>a.log"


> 
> Original Message ---
> I starting script 
> 
> #1
> 
> Win32::Process::Create($ProcessObj,
>'c:\\windows\\system32\\rsh.exe',
>"rsh 213.165.192.242 -l intercable sh accounting >a.log",
>0,
>NORMAL_PRIORITY_CLASS,
>'c:\\test');
>$ProcessObj->Wait(2000);
>  
> and get message 
> 
> Line has invalid autocommand "sh accounting >a.log"
> 

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Sharing new Perl Modules

2002-06-13 Thread Joe Schell



> -Original Message-
> Behalf Of Morgan, Steve H.
>
> Does anyone know what the process is to submit new perl modules to Active
> State?

Just as a guess, with the exception of the modules specifically maintained
by ActiveState employees, everything else comes from CPAN (www.cpan.org).
Actually the modules from the employees go there as well, but the order is
reversed (they show up in ActiveState first then show up in CPAN.)

Once there then you can request that ActiveState puts it in their build list
(ppm repository.)  Not sure what that entails, but I believe part of it
involves running the 'tests' part of the standard module and verifying that
it works.  Of course there is probably some subjective evaluation as to
whether it is worth their time.


> Once they are submitted, what is the process for keeping them up
> to date and
> posting the documentation?
>

Via CPAN.  And then requesting that the ppm be updated.

> Is there a way to install my perl library's documentation into active
> state's web documentation during the install process?
>

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Premature end of script headers

2002-05-23 Thread Joe Gillespie

I'm trying to get Soupermail working on WINNT 4, SP6, Apache 2.0.35
(WIn32), with PERL 5.6.1, 631. The configuration file says everything is
OK, but I'm getting 500 errors: Premature end of script headers. I have
installed the necessary libnet, and SMTP and MIME-Lite are in the
cgi-bin where soupermail.pl lives. Anyone run into this and can help?
Other perl scripts run OK, and I can send mail with Perl (using
sendmail.pl) successfully. Thanks - Joe

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Secure platforms DO matter!

2002-05-03 Thread Joe Schell


> -Original Message-
> Behalf Of Aaron Trevena
>
>
> > Presuming of course that the server is set up to be secure.
> All of those
> > OSes can have large gaping holes in their security caused both by
> > admin user action and inaction.
>
> If you were to chose a server for your bank to use would you
> prefer it had 5
> to 10 vulnerabilities a year of which 1 or 2 were remote exploits or would
> you rather it has 30 to 50 of which 15 to 20 were remote exploits ?

I don't know about you, but I don't personally know the people who run the
systems at my bank.  So I can't judge their experiene.

And it doesn't really matter if there is some odd/obscure exploit in the
OS/server when there is telnet with anonymous access open to the internet.

A survey several years ago found that 30% of the banks in the US had no
security policy.  And the banking industry had the highest rate of
industries that had strict security in place.

>
> Then would you rather they ran software on top which opened up 1 or 2 more
> holes or would you rather they ran stuff that opened 100s of holes ?
>
> Less vulnerabilities means less downtime, less maintainence and less
> mistakes. Also I think you'll find that some of the BSD UNIX have had 0
> remote exploits, and only 2 or 3 local exploits in the past few years.
>
> You can't expect administrators to cover up for every hole,
> especially when
> the holes aren't disclosed for months at a time, worse still you can't go
> patching production servers every other week - production servers
> by nature
> should have no downtime - Microsoft patches mean rebooting and repatching
> your 'production' servers every few weeks.

Not really my point.  My point is that the system is only secure as the
people who run it.  It is my understanding that most vulnerabilities these
days are not caused by bugs in the systems but rather lack of
knowledge/control of the adminstrators running the systems.

>
> Also the easier it is to secure a server - the more likely it is to be so.
> Would you rather have a production server that requires registry
> tweaks and
> 3 days of patching to be secure or a server that is secure out-of-the-box
> (OpenBSD, TrustedLinux, AS/400) or can be totally secured during
> installation (bastile, debian, suse, even redhat).
>

Yes, but that doesn't help much if I can walk in off the street and find the
root password for internal systems posted prominately on each display, or
even better a complete list of all of them posted on a wall.

Consider this as an example, are the printers at your location secure?  And
I did say "printers".  Most high end printers are complete computers
including telnet clients.  They have total access to the system.  And since
many admin (and certainly not other personel) don't consider them as such
they are almost never locked down.

Want to bet that your bank has a high end printer?

Another example, I have seen figures that suggest that internal users cause
as much as 10 times the damage that external users do.  Banks do (at least
the one I worked for) a FBI check of all employees.  I suspect it is simply
mandated by law.  Does your company?

> So I'll repeat it - Windows is not suitable for production servers.
> Regardless of how good your sysadmins are, it is better to start
> with a more
> secure foundation than to use an insecure platform and hope you
> can plaster
> the cracks and patch it quicker than it is hacked.
>

Locking down a single system does not make a company secure.

You choose:
-Company A that has a complete security policy internal as well as external.
And does monthly internal audits and quarterly external audits using
rotating security firms each time.  New admins are trained and mentored for
at least 2 weeks to a month before being allowed to go live.  Part of the
admins group duty is to daily monitor log usage and search the internet
actively for reports of new exploits for all of the companies systems.  This
company runs windows and IIS.

-Company B runs their web servers on unix.  And sometimes the admins know
how to administer those systems correctly and sometimes not. The vast
majority of their time is spent setting up new users, fixing existing users
and trying to figure out what happened to the internet connection.  About
the only time they notice anything is wrong with the web server is when
something goes horribly wrong.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Stress Test Theory?

2002-05-02 Thread Joe Schell



> -Original Message-
> Behalf Of Walter Torres
>
> Has Apache solved the horrible security issues when on Windows?
>
> If not, they recommend to NEVER use Apache on a production machine because
> of the security issues that they have with Windows.
>

Who is 'they'?  I can't find anything that suggests that Apache is
particularily more vulnerable on windows.  At least not with the most recent
version.  And although that fixed a security problem on windows it was only
vulnerable if running bat and cmd files.  And I don't know about anyone
else, but I am not going to write OS script files that run directly from web
pages when perl is around anyways.  I haven't ever actually seen a web site
that does that.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: where can I find a mod_perl windows binaries for installation?

2002-05-02 Thread Joe Schell


> -Original Message-
> Behalf Of Ted Zeng
>
> Thanks.
> I got the file now and install it to a folder.
>
> Now my problem is I already have my Apache server running for a long time
> and I don't want to replace it with this one. My perl also has many other
> modules
> installed already.
> I just want to install mod_perl module.
>

Just an impression I have, but I think that can be problematic.  Basically
mod_perl needs to be built in the same environment that Apache is.  And
changes do occur.  So I wouldn't try that unless I could find a binary from
the same source that provided the Apache binary, and with matching build
dates.

And I wouldn't be sure that any installed modules would be automatically
available to it.  It would probably require some messing around to get that
to happen (perhaps just configuration changes.)

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Large files > 2GB

2002-04-30 Thread Joe Schell



> -Original Message-
> Behalf Of Jae Danner
>
>
> I'm new to perl and I have some questions about using it to
> manipulate large files. I'm working a file that is 5,323,771,971
> bytes in size and has a record length of 353 (including CRLF). If
> I run this script against the file the script ends prematurely:
>

What version of perl are you using?

> open (FILE, "test.dat") or die("Can't open file\n");
> idx = 0;
> while() {
>   idx++;
> }
> print "records: ".idx."\n";
> close(FILE);
>
> The script above terminates and reports 15,077,180 records. The
> file however contains 15,081,507 records. I suspect that this
> file possibly contains a ^Z which triggers the early termination.
> I haven't yet tried the binmode() function, but I have
> succussfully read the entire file using sysread in the while
> statement: " while (sysread FILE, $line, 353) ".
> My concern is with data corruption. Even if I can read each
> line/record of data from a file of this size is there a danger
> that the data could become corrupt?

Are you concerned with sysread or perl in general?

Percentage wise there is probably less chance that perl will corrupt your
file than with writing you own code in C.  However there are no guarantees.
But if it does at least you don't have to blame yourself.

> What are the safe practices
> for manipulating files of this size? Or should I trash the whole
> idea and go back to C. Thanks.
>

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



perl-win32-users@listserv.activestate.com

2002-04-14 Thread Joe Schell



> -Original Message-
> Behalf Of Pankaj Agarwal
>
> Hi All,
>
> I am using following code block
>
> if($data =~ /,(\w{1,}\s{0,}){1,}\n/){
> print $&;
> }
>
> now if $data is ", a and b" the pattern matches but if
> it is ",a & b" it doesn't how can I avoid the special
> meaning of &
>

Not sure what you mean by the "special meaning of &" but the following works

if($data =~ /,((\&|\w+)\s*)+\n/)

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: DBI, DBD::ODBC y MSQLServer 7

2002-04-11 Thread Joe Schell



> -Original Message-
> Behalf Of [EMAIL PROTECTED]
>
>
> I'm using DBI and DBD::ODBC module for get conected to a data base
> MSQLServer 7
>
> my $DSN = 'driver={SQL Server};Server=Eventos;
> database=Administrador;uid=Administrator;pwd=;';
> my $dbh = DBI->connect("dbi:ODBC:$DSN") or die "$DBI::errstr\n";
>
>

Just a guess but in your posting there is a space after "Eventos;".  If that
is in your code then remove it.

> Server's name is: Eventos
> database's name is: Administrador
> User Id is: Administrator or sa
> PWD is '' (a space or nothing);
>
> I´m getting this wrong.
>
> Software error:
> [Microsoft][ODBC Driver Manager] Invalid string or buffer length
> (SQL-S1090)(DBD: db_login/SQLConnect err=-1)
> 
>

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: DBI and DSN problems

2002-03-12 Thread Joe Schell



> -Original Message-
> Behalf Of Brad Smith
>
> I am having chronic trouble with getting the following code to
> run.  Perhaps someone
> can explain what is wrong with it:
>
> $dsn="$last_name[0]_$first_name[0]";
> my $dbh = DBI->connect('dbi:ODBC:$dsn') || die DBI::errstr;
>

Single quotes (in the connect) do not do variable interpolation.  You need
double quotes.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: How do i unsubscribe this list

2002-02-27 Thread Joe Schell


> -Original Message-
> Behalf Of Thomas R Wyant_III
> 
> 
> This is one of those times when I think this mailing list 
> needs a FAQ. I actually started one not too long ago, but 
> most of the entries were "read the documentation," so I 
> desisted. The following is from that document:
>

Or one could just look at the bottom of every posting.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



  1   2   >