HTML::TreeBuilder

2002-10-23 Thread Torbjørn Lindahl
Hi, my problem:

I am parsing a html page looking for table-tags.

The Treebuilder has a look_down function:

$tree-look_down(_tag,table);#lists all tables in the html

$tree-look_down(_tag,table,
width,170);#lists all tables in the html with width 170

However, how can I list all tables that have no attributes? Ie somehow
listing tag attributes and checking that the @list == 0?

Regards,
Torbjørn Lindahl

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



Re: Gui rip off.

2002-10-23 Thread Sean Ahern
At 09:32 23/10/2002 +0100, Beckett Richard-qswi266 
[EMAIL PROTECTED] wrote:
Guys,

I want to be able to have a GUI front end on my script, but I'm finding it
all a bit complicated.

I think that the best way to learn this stuff is to start with a script
that's not too complicated, and see how things have been done by a man who
can ;-)

Does anyone have, or can point me to a script that has a GUI front end that
I can pull apart and play with?

Thanks.


You could try building the GUI in Spectix, a front end for Perl/Tk.  It can 
output Perl code that can be easily pasted into your scripts.

http://starship.python.net/crew/mike/src/Spectix/Spectix.html


---
Sean Ahern,
Computing Support Officer,
School of Television and Imaging,
Duncan of Jordanstone College,
13 Perth Rd, Dundee, DD1 4HT.
Tel : 0044(0)1382-345372
-

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


Re: Gui rip off.

2002-10-23 Thread Johan Lindstrom
At 09:32 2002-10-23 +0100, Beckett Richard-qswi266 wrote:

Does anyone have, or can point me to a script that has a GUI front end that
I can pull apart and play with?


If you want to use Win32::GUI as the GUI toolkit, this is a useful repost 
from the win32-gui-users list:

-

In the source distriution (at SourceForge) there are a few indispensible 
sample scripts.

Other programs you can study:

http://www.perlmonks.org/index.pl?node_id=18472
A PerlMonks chat client

http://www.disobey.com/amphetadesk/
http://sourceforge.net/projects/amphetadesk/
A news aggregator

ftp://ftp.wh.whoi.edu/pub/gb109.zip
A GUI designer

http://www.bahnhof.se/~johanl/perl/Oasis/
A POD/code browser

http://www.bahnhof.se/~johanl/perl/Loft/
A GUI designer

-

The last program, The GUI Loft, also contains *gasp* demo scripts :)


/J

 --  --- -- --  --  -- -  - -
Johan LindströmSourcerer @ Boss Casinos [EMAIL PROTECTED]

Latest bookmark: Why Functional Programming Matters
http://www.md.chalmers.se/~rjmh/Papers/whyfp.html
dmoz (1 of 3): .../Computers/Programming/Languages/Multiparadigm/ 18


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


RE: Logging in

2002-10-23 Thread Stovall, Adrian M.
Without knowing whether there is data in $password, it's hard to say
what the problem is.  Your error message seems to point to the line
comparing $data and $password, so the best test would be to print out
these two values before that line.

print \$password=$password\n;
print \$data=$data\n;

Then you'll know which one is empty.


-Original Message-
From: Issa Mbodji [mailto:issambodji;yahoo.com] 
Sent: Tuesday, October 22, 2002 5:22 PM
To: Stovall, Adrian M.
Subject: RE: Logging in


Hello Adrian: 
Here is my code: 
use DBI;
use DBD::ODBC;
use warnings;
use strict;
use CGI qw(:standard); 
my $data;
my $user;
my $password; 
$user = param (username);
$password = param (password); 
my $dbh = DBI-connect(dbi:ODBC:Registration9, , ,
{RaiseError=1}); 
my $sql = SELECT Password FROM Users WHERE UserName = ? ; 
my $sth = $dbh-prepare($sql); 
$sth-execute($user); 
$data = $sth-fetch; 
if ($data eq $password) { 
print (Something) } 
else { print (Something else) } 
and here is the error message I am getting: 
use of an uninitialized value eq 
Thanks for any help you can provide 
Mame Mbodji 
 Stovall, Adrian M. [EMAIL PROTECTED] wrote: 
That is an extremely broad question.  Why don't you post the code for
your log-in page for starters...it's hard to help without knowing what's
going on.  Saying that you've tried everything, is like me telling a
mechanic I looked all over, but I couldn;t find anything wrong with the
enginewe need to look under the hood :)
-Original Message-
From: Issa Mbodji [mailto:issambodji;yahoo.com] 
Sent: Monday, October 21, 2002 8:37 PM
To: [EMAIL PROTECTED]
Subject: Logging in


Hello:
Does anyone understand how to authenticate a user from an Access
database with 2 fields (username and password). The user is logging from
an HTML form with 2 fields (username and password). I tried everything
and it does not seem to work.
Is there anything I need to do with the Apache server I am running?
Any suggestion will be greatly appreciated.


Mame Issa Mbodji 
3201 Weeping Willow Ct # 33 
Silver Spring, MD , 20906 
Tel. (301) 603-0847 
e-mail: [EMAIL PROTECTED] 




Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site


Mame Issa Mbodji 
3201 Weeping Willow Ct # 33 
Silver Spring, MD , 20906 
Tel. (301) 603-0847 
e-mail: [EMAIL PROTECTED]




Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Gui rip off.

2002-10-23 Thread Gould, Kevin
If you look under your Activestate install, there's an 

Eg/tk directory.  Run Widget.bat

I think you'll find it has more than ample to keep you busy.

-Original Message-
From: Beckett Richard-qswi266 [mailto:Richard.Beckett;motorola.com] 
Sent: Wednesday, October 23, 2002 3:33 AM
To: Perl Users
Subject: Gui rip off.

Guys,

I want to be able to have a GUI front end on my script, but I'm finding
it
all a bit complicated.

I think that the best way to learn this stuff is to start with a script
that's not too complicated, and see how things have been done by a man
who
can ;-)

Does anyone have, or can point me to a script that has a GUI front end
that
I can pull apart and play with?

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 IDE..

2002-10-23 Thread Stephen Gray
Is there a favourite Perl IDE for Win 95... or are there too many to have a
defined winner ??

I'm just getting into Perl, so I just need the basics...  also, code will
only be executed on Windows.  Interested in exploring how perl interacts
with the  o/s and ole.

Thanks.

sg.

Stephen Gray
Web Application Support
Computer Sciences Corporation (CSC)
Nortel Networks Account


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



RE: Can't access from Command Line

2002-10-23 Thread Stovall, Adrian M.
How about The First Annual Improvisational Perl Contest...

-Original Message-
From: Tillman, James [mailto:JamesTillman;fdle.state.fl.us] 
Sent: Wednesday, October 23, 2002 6:06 AM
To: perl-win32-users
Subject: RE: Can't access from Command Line


Actually, I think this would be an extemporaneous Perl contest.  Of course, real 
such contests would have to be held live, perhaps on IRC?
;-)

jpt

 -Original Message-
 From: Stovall, Adrian M. [mailto:Adrian.Stovall;durez.com]
 Sent: Tuesday, October 22, 2002 5:29 PM
 To: perl-win32-users
 Subject: RE: Can't access from Command Line
 
 
 This is starting to sound an awful lot like a mildly
 obfuscated Perl contest...
 
 -Original Message-
 From: Thomas R Wyant_III [mailto:Thomas.R.Wyant-III;usa.dupont.com]
 Sent: Tuesday, October 22, 2002 4:18 PM
 To: perl-win32-users
 Subject: RE: Can't access from Command Line
 
 
 
 Burak -
 
 Unless, of course, the user opened DATA first! :-)
 
 Perverse example:
 
 C:\perl
 print Hello, sailor!\n;
 __END__
 Hello, sailor!
 
 C:\perl
 while (DATA) {print Data $_}
 __END__
 The bustard's a genial fowl
 Data The bustard's a genial fowl
 with minimal reason to growl.
 Data with minimal reason to growl.
 He escapes what would be
 Data He escapes what would be
 Illegitimacy
 Data Illegitimacy
 By means of a fortunate vowel.
 Data By means of a fortunate vowel.
 ^Z
 
 C:\
 
 Tom Wyant
 
 
 
 
 Burak Gürsoy [EMAIL PROTECTED]@listserv.ActiveState.com
 on 10/22/2002 02:56:08 PM
 
 Sent by:[EMAIL PROTECTED]
 
 
 To:perl-win32-users [EMAIL PROTECTED]
 cc:
 Subject:RE: Can't access from Command Line
 
 
 btw, if you write __END__; and enter, perl will exit :)
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:perl-win32-users-admin;listserv.ActiveState.com]On
 Behalf Of Tillman, James
 Sent: Tuesday, October 22, 2002 7:27 PM
 To: perl-win32-users
 Subject: RE: Can't access from Command Line
 
 
 When I go to the command prompt, I type
 
 C:\perl
 
 and the computer just sits there.
 
  Sounds normal to me...you didn't tell perl to do anything.
 
 
 How fitting.  The perl executible is as lazy as the
 programmers who love it so much!
 
 ;-)
 
 jpt
 ___
 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
 
 
 
 
 
 This communication is for use by the intended recipient and contains
 information that may be privileged, confidential or 
 copyrighted under applicable law.  If you are not the 
 intended recipient, you are hereby formally notified that any 
 use, copying or distribution of this e-mail, in whole or in 
 part, is strictly prohibited.  Please notify the sender by 
 return e-mail and delete this e-mail from your system.  
 Unless explicitly and conspicuously designated as E-Contract 
 Intended, this e-mail does not constitute a contract offer, 
 a contract amendment, or an acceptance of a contract offer.  
 This e-mail does not constitute a consent to the use of 
 sender's contact information for direct marketing purposes or 
 for transfers of data to third parties.
 
  Francais Deutsch Italiano  Espanol  Portugues  Japanese
 Chinese  Korean
 
 http://www.DuPont.com/corp/email_disclaimer.html
 
 
 ___
 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



Deleting Shares/Folders Off A Remote Machine

2002-10-23 Thread Barlow, Neil
Hi all,

I have been given roughly 150 shares that are located on different servers
that must be totally removed
 
1) The share must be removed from the system 
2) I have to get the size of the folder/Share
3) I have to delete the folder and all its contents

I am using Win32::Lanman to get the details of the share and to remove the
share, but I am unsure how to go about getting the size of the folder (Have
tried -s with no luck) and how to remove the folder from the remote machine.
I am using Win32::Lanman to get the physical address of the folder on the
remote machine.  Can anyone point me in the right direction.

Another problem I have found is that I cant get LanMan to report if the
share exists, so I am using the code:

if (-d $line)
{
 .
}

Where $line would equal server\\share, but this appears only to work
when I hard code in the share details, instead of using a variable. I have
checked and $line is successfully being set.

Your input is very much appreciated.


Neil Barlow

Network Analyst
Global Infrastructure SRS
Ireland Computing
Intel Ireland 

Phone: +353-1-6066889 Or #6889 
iNet: 8-606-6889
Loc: IR5-1-C4
Email: [EMAIL PROTECTED] 


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



RE: Can't access from Command Line

2002-10-23 Thread Tillman, James
 -Original Message-
 From: Stovall, Adrian M. [mailto:Adrian.Stovall;durez.com]
 Sent: Wednesday, October 23, 2002 9:51 AM
 To: perl-win32-users
 Subject: RE: Can't access from Command Line
 
 
 How about The First Annual Improvisational Perl Contest...

Announcer Welcome to the First Annual Improvisational Perl Contest.
Contestants will be given a series of things to with Perl, with 60 seconds
in which to create the code that achieves it.  Points are given for
completeness, terseness, obfuscation, one-liners, and, failing all else,
style.  

Announcer If your code works, but our panel of judges is unable to explain
how it works within a 5 minute time limit, you get an extra 5 points.

Announcer One side note, if the script manages to print out python sucks!
perl rules! without using the print statement or its variants, and still
manages to achieve the goal, an extra 5 points will be awarded.

Announcer Ladies and Gentlemen, start your interpreters!

:-)

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



Re: Perl IDE..

2002-10-23 Thread David Kaufman
Stephen Gray [EMAIL PROTECTED] wrote:
 Is there a favourite Perl IDE for Win 95... or are there too many to have a
 defined winner ??
 
 I'm just getting into Perl, so I just need the basics...  also, code will
 only be executed on Windows.  Interested in exploring how perl interacts
 with the  o/s and ole.
 
 Thanks.

ActiveState Komodo is great: http://activestate.com/Products/Komodo/

...not free, mind you.  but great.  

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



RE: Perl IDE..

2002-10-23 Thread FARRINGTON, RYAN
Title: RE: Perl IDE..





Komodo 1.1 is free!!! =) I'll see if I can find my download of it and then I'll send out a link to where u can download it =)

-Original Message-
From: David Kaufman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 23, 2002 9:17 AM
To: [EMAIL PROTECTED]; Stephen Gray
Subject: Re: Perl IDE..



Stephen Gray [EMAIL PROTECTED] wrote:
 Is there a favourite Perl IDE for Win 95... or are there too many to have a
 defined winner ??
 
 I'm just getting into Perl, so I just need the basics... also, code will
 only be executed on Windows. Interested in exploring how perl interacts
 with the o/s and ole.
 
 Thanks.


ActiveState Komodo is great: http://activestate.com/Products/Komodo/


...not free, mind you. but great. 


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





Re: Perl IDE..

2002-10-23 Thread Joao Vieira da Cunha
I've been using the OpenPerl IDE from SourceForge. It's not Komodo, but if 
you're just getting into perl, it's a good first step.

http://open-perl-ide.sourceforge.net/

Joao

MIT / Sloan

At 10:16 23/10/2002 -0400, you wrote:
Stephen Gray [EMAIL PROTECTED] wrote:
 Is there a favourite Perl IDE for Win 95... or are there too many to have a
 defined winner ??

 I'm just getting into Perl, so I just need the basics...  also, code will
 only be executed on Windows.  Interested in exploring how perl interacts
 with the  o/s and ole.

 Thanks.

ActiveState Komodo is great: http://activestate.com/Products/Komodo/

...not free, mind you.  but great.

-dave
___
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: Perl IDE..

2002-10-23 Thread FARRINGTON, RYAN
Title: RE: Perl IDE..





I also found that PrimalScript is a good Perl editor =)


-Original Message-
From: Joao Vieira da Cunha [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 23, 2002 9:23 AM
To: [EMAIL PROTECTED]
Subject: Re: Perl IDE..



I've been using the OpenPerl IDE from SourceForge. It's not Komodo, but if 
you're just getting into perl, it's a good first step.


http://open-perl-ide.sourceforge.net/


Joao


MIT / Sloan


At 10:16 23/10/2002 -0400, you wrote:
Stephen Gray [EMAIL PROTECTED] wrote:
 Is there a favourite Perl IDE for Win 95... or are there too many to have a
 defined winner ??

 I'm just getting into Perl, so I just need the basics... also, code will
 only be executed on Windows. Interested in exploring how perl interacts
 with the o/s and ole.

 Thanks.


ActiveState Komodo is great: http://activestate.com/Products/Komodo/


...not free, mind you. but great.


-dave
___
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: Perl IDE..

2002-10-23 Thread Joao Vieira da Cunha

You can download Komodo 1.1 from
http://downloads.activestate.com/Komodo/Windows/1.1/

Click on the Komodo-1.1.2-23917.msi


I haven't checked to see if it's free or not

Cheers

Joao

MIT / SLoan



Authenticated user retrieval when running under IIS Anonymous user

2002-10-23 Thread Gould, Kevin








I have a boggle.



IIS 5/Perl cgi script



I have:

- Created a virtual directory which points back to the IIS
server via UNC (this triggers the running process to allow network operations
off the server as a side effect)

- NTFS Secured the directory to a select list of users

- Enabled anonymous access on the directory and set it to be
an administrative user as the anonymous account (a calculated risk)



This lets me perform administrative tasks against remote machines
from the cgi without doing impersonation which would
require me to store the password in some form in a local file. My question is this:



When I issue a Win32::AdminMisc::GetLogonName,
or Win32::LoginName it reports the anonymous user. I would like to figure out if there is a
way to ferret out the username of the person running the script (ie, the one who was able to gain access via NTFS
permissions). If anyone has any
alternate suggestions for running privileged tasks which wouldnt require
me storing a password and manually impersonating, Im open to education.





Kevin Gould

Sr. Technical Specialist, Server
Administration and Management 

Gentiva Health Services - Overland Park, KS

913-814-2369 - [EMAIL PROTECTED]














Re: Perl IDE..

2002-10-23 Thread michael higgins
David Kaufman wrote:

Stephen Gray [EMAIL PROTECTED] wrote:


Is there a favourite Perl IDE for Win 95... or are there too many to have a
defined winner ??

I'm just getting into Perl, so I just need the basics...  also, code will
only be executed on Windows.  Interested in exploring how perl interacts
with the  o/s and ole.

Thanks.



ActiveState Komodo is great: http://activestate.com/Products/Komodo/

...not free, mind you.  but great.  

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

I have to say -- my experience as a newbie wasn't enhanced by Komodo, no 
disrespect to the designers, just my luck. In short, I found it's a lot 
of overhead on a weak system like mine ('98 on a 266 w/ 128 ram...) and 
the install corrupted itself easily. So I find that my developemnt 
environment is Open Perl IDE (http://open-perl-ide.sourceforge.net/) and 
NoteTabLight (http://www.notetab.com). Both are free.

(One caveat: I don't recommend using the view by tool-tips feature in 
OPIDE if you're creating large in memory data structures [ -- a 
guaranteed crash, on my system, but you have the option to not use it].)


Good luck!
--
Michael Higgins

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


Re: HTML::TreeBuilder

2002-10-23 Thread Dougal Campbell
On Wed, 23 Oct 2002, [ISO-8859-1] Torbjørn Lindahl wrote:

 Hi, my problem:

 I am parsing a html page looking for table-tags.

 The Treebuilder has a look_down function:

 $tree-look_down(_tag,table);#lists all tables in the html

 $tree-look_down(_tag,table,
   width,170);#lists all tables in the html with width 170

 However, how can I list all tables that have no attributes? Ie somehow
 listing tag attributes and checking that the @list == 0?

There is a method of HTML::Element called all_external_attr_names(). You
should be able to check each returned table element, and if
all_external_attr_names() returns an empty list, then there were no
attributes specified for that table.

  @tables = $tree-look_down(_tag,table); # Get all tables

  foreach $table (@tables) {
@attrs = $table-all_external_attr_names();
$attr_count = scalar @attrs;
print Found a table with $attr_count attributes specified.\n;

print \t$foo\n while ($foo = shift @attrs);
  }

-- 
Ernest MacDougal Campbell III, MCP+I, MCSE [EMAIL PROTECTED]
http://dougal.gunters.org/ http://spam.gunters.org/
  Web Design  Development:  http://www.mentalcollective.com/
   This message is guaranteed to be 100% eror frea!

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



when localtime isn't?

2002-10-23 Thread shurst





Ok, localtime() has always done what I expected in the past, but on my
win2k machine(and 3 others I have tested), it doesn't.

Under win2k this

print TZ = $ENV{TZ}\n;
@time = localtime();
print @time\n;
print Local:  . scalar localtime() . \n;
print   GMT:  . scalar gmtime() . \n;

says this:

TZ = MST-7MDT
48 46 22 23 9 102 3 295 1
Local: Wed Oct 23 22:46:48 2002
  GMT: Wed Oct 23 14:46:48 2002


So, the GMT is correct -- it's 8:46am MST == GMT - 7 hours + 1 for DST, but
localtime is returning GMT + 8 hours.  My NT machine set to the same
timezone correctly reports the same GMT and the correct localtime.  So, the
question is, what do I have configured wrong? (surely localtime is not
broken!)

Steve


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



Re: when localtime isn't?

2002-10-23 Thread Dirk Bremer \(NISC\)
I ran your code here in CDT:

58 52 10 23 9 102 3 295 1
Local: Wed Oct 23 10:52:58 2002
  GMT: Wed Oct 23 15:52:58 2002

CDT = GMT - 6. MDT = GMT - 7. CST = GMT - 5. MST = GMT - 6. It looks to me
that the culprit is gmtime, it is not taking into account the daylight
savings time offset.

Dirk Bremer - Systems Programmer II - ESS/AMS  - NISC St. Peters
636-922-9158 ext. 8652 fax 636-447-4471

[EMAIL PROTECTED]
www.nisc.cc
- Original Message -
From: [EMAIL PROTECTED]
To: perl-win32-users [EMAIL PROTECTED]
Sent: Wednesday, October 23, 2002 10:24
Subject: when localtime isn't?







 Ok, localtime() has always done what I expected in the past, but on my
 win2k machine(and 3 others I have tested), it doesn't.

 Under win2k this

 print TZ = $ENV{TZ}\n;
 @time = localtime();
 print @time\n;
 print Local:  . scalar localtime() . \n;
 print   GMT:  . scalar gmtime() . \n;

 says this:

 TZ = MST-7MDT
 48 46 22 23 9 102 3 295 1
 Local: Wed Oct 23 22:46:48 2002
   GMT: Wed Oct 23 14:46:48 2002


 So, the GMT is correct -- it's 8:46am MST == GMT - 7 hours + 1 for DST,
but
 localtime is returning GMT + 8 hours.  My NT machine set to the same
 timezone correctly reports the same GMT and the correct localtime.  So,
the
 question is, what do I have configured wrong? (surely localtime is not
 broken!)

 Steve


 ___
 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: what is this expr doing exactly?

2002-10-23 Thread Reddy Kankanala
Stacy   Bill
Thanks for your help. 

Reddy

-Original Message-
From: Stacy Doss [mailto:SDoss;hifn.com]
Sent: Wednesday, October 23, 2002 12:46 AM
To: '$Bill Luebkert'; Reddy Kankanala
Cc: [EMAIL PROTECTED]
Subject: RE: what is this expr doing exactly?


Actually not a typo-

Subs a path prefix in $curren with $self-{'Dir'}
Thus

$currn = '/usr/local/bin/perl';
$self-{'Dir'} = '/home/joe';
$currn =~ s+.*/([^/]*)+$self-{'Dir'}/$1+ if defined($self-{'Dir'});
# results in 
$currn == /home/joe/perl

Here's what's happening;
$currn =~ # I'll assume you know what this does
s # Substitution
+ # Start substitution delimiter (A very bad one, but one
non-the-less)
.*/([^/]*)# Match portion of delimeter, 
  # greedly matches lots o'characters 
  #   followed by a / 
  #   followed by anything thats not a / and remembering it
($1)
  #   til-end-o-string
+ # Substitution delimiter (A very bad one, but one
non-the-less)
  # Above match *should* match all of string (or none of it
if it dosen't contain a /)
$self-{'Dir'}/$1 # Substitues value of $self-{'Dir'} plus literal / plus
saved portion of match ($1)
  # This should replace the entire string
+ # End substitution delimiter (A very bad one, but one
non-the-less)

if defined($self-{'Dir'});  # Only do the above if $self-{'Dir'} is
defined.


Perhaps a better and straight forward way would be...

if (defined($self-{'Dir'})) {
   $currn =~ s:(.*/):$self-{'Dir'}:;
}

or

if (defined($self-{'Dir'})) {
   $currn =~ s/(.*\/)/$self-{'Dir'}/;
}

-Original Message-
From: $Bill Luebkert [mailto:dbe;wgn.net]
Sent: Wednesday, October 23, 2002 12:24 AM
To: Reddy Kankanala
Cc: [EMAIL PROTECTED]
Subject: Re: what is this expr doing exactly?


Reddy Kankanala wrote:
 can some one tell me what is this doing? i found this in Logfile::Rotate
 
 $currn=~ s+.*/([^/]*)+$self-{'Dir'}/$1+if
defined($self-{'Dir'});
Looks like a typo to me.  Take another look and use cut-n-paste and
double check it before posting.

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:dbe;todbe.com
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic
http://www.todbe.com/

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



Re: when localtime isn't?

2002-10-23 Thread Dirk Bremer \(NISC\)
Oops, I think I have it backwards:

CDT = GMT - 5. MDT = GMT - 6. CST = GMT - 6. MST = GMT - 7.

So, today you should be 6 hours earlier than GMT. I wonder if it is a
problem with the way you have your TZ set.

Dirk Bremer - Systems Programmer II - ESS/AMS  - NISC St. Peters
636-922-9158 ext. 8652 fax 636-447-4471

[EMAIL PROTECTED]
www.nisc.cc
- Original Message -
From: Dirk Bremer (NISC) [EMAIL PROTECTED]
To: perl-win32-users [EMAIL PROTECTED]
Sent: Wednesday, October 23, 2002 10:57
Subject: Re: when localtime isn't?


 I ran your code here in CDT:

 58 52 10 23 9 102 3 295 1
 Local: Wed Oct 23 10:52:58 2002
   GMT: Wed Oct 23 15:52:58 2002

 CDT = GMT - 6. MDT = GMT - 7. CST = GMT - 5. MST = GMT - 6. It looks to me
 that the culprit is gmtime, it is not taking into account the daylight
 savings time offset.

 Dirk Bremer - Systems Programmer II - ESS/AMS  - NISC St. Peters
 636-922-9158 ext. 8652 fax 636-447-4471

 [EMAIL PROTECTED]
 www.nisc.cc
 - Original Message -
 From: [EMAIL PROTECTED]
 To: perl-win32-users [EMAIL PROTECTED]
 Sent: Wednesday, October 23, 2002 10:24
 Subject: when localtime isn't?


 
 
 
 
 
  Ok, localtime() has always done what I expected in the past, but on my
  win2k machine(and 3 others I have tested), it doesn't.
 
  Under win2k this
 
  print TZ = $ENV{TZ}\n;
  @time = localtime();
  print @time\n;
  print Local:  . scalar localtime() . \n;
  print   GMT:  . scalar gmtime() . \n;
 
  says this:
 
  TZ = MST-7MDT
  48 46 22 23 9 102 3 295 1
  Local: Wed Oct 23 22:46:48 2002
GMT: Wed Oct 23 14:46:48 2002
 
 
  So, the GMT is correct -- it's 8:46am MST == GMT - 7 hours + 1 for DST,
 but
  localtime is returning GMT + 8 hours.  My NT machine set to the same
  timezone correctly reports the same GMT and the correct localtime.  So,
 the
  question is, what do I have configured wrong? (surely localtime is not
  broken!)
 
  Steve
 
 
  ___
  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: FW: Crypt::CBC w/Crypt-DES (small correction)

2002-10-23 Thread $Bill Luebkert
Toby Stuart wrote:

see corrections below



-Original Message-
From: Toby Stuart [mailto:toby.stuart;figtreesys.com.au]
Sent: Wednesday, October 23, 2002 3:35 PM
To: '[EMAIL PROTECTED]'
Subject: Crypt::CBC w/Crypt-DES


Hi All,

I'm trying to encrypt/decrypt a text file using Crypt::CBC with DES.

The encryption works fine but the decryption seems to yield 
only the first
few bytes of the original text.  I'm sure i'm missing 
something simple.

Any help appreciated.

Example follows:

enc.pl
use strict;
use Crypt::CBC;

my $key = pack H16, 1122334455667788;
my $cipher = new Crypt::CBC ($key, 'IDEA');


my $cipher = new Crypt::CBC ($key, 'DES');




my $in;
open(IN,'e:\some_largish_text_file') || die $!;
print $cipher-encrypt($in) while read(IN,$in,1024);
print $cipher-finish;
close(IN);
/enc.pl



dec.pl
use strict;
use Crypt::CBC;

if (!@ARGV) { die Usage: perl $0 encrypted_file  
decrypted_output_file; }

my $key = pack H16, 1122334455667788;
my $cipher = new Crypt::CBC ($key, 'IDEA');


my $cipher = new Crypt::CBC ($key, 'DES');



my $in;
open(IN,$ARGV[0]) || die $!;
print $cipher-decrypt($in) while read(IN,$in,1024);
print $cipher-finish;
close(IN);
/dec.pl


Try this one:

use strict;
use Crypt::CBC;
use IO::File;

my $key = pack H16, 1122334455667788;
my $cipher = new Crypt::CBC ($key, 'DES');

die Usage: perl $0 file-to-encrypt [encrypted_output_file]\n .
  or:perl $0 -decrypt file-to-decrypt [decrypted_output_file]\n .
  	Second file arg defaults to STDIN for encrypt; STDOUT for decrypt\n\n
  if not @ARGV;

my $decrypt = 0;
for (my $ii = 0; $ii  @ARGV; ) {
	if ($ARGV[$ii] =~ /^--?de/) {
		$decrypt = 1;
		splice @ARGV, $ii, 1;
		next;
	}
	$ii++;
}

my $ifh = new IO::File;
if (@ARGV) {
	$ifh-open($ARGV[0]) or die open $ARGV[0]: $!;
} else {
	$ifh-open(STDIN) or die open $ARGV[0]: $!;
}

my $ofh = new IO::File;
if (@ARGV  1) {
	$ofh-open($ARGV[1]) or die open $ARGV[1]: $!;
} else {
	$ofh-open(STDOUT) or die open $ARGV[1]: $!;
}

my $in;
if ($decrypt) {
	$cipher-start('decrypting');
	print $ofh $cipher-crypt($in) while read $ifh, $in, 1024;
	print $ofh $cipher-finish;
} else {
	$cipher-start('encrypting');
	print $ofh $cipher-crypt($in) while read $ifh, $in, 1024;
	print $ofh $cipher-finish;
}
$ifh-close;
$ofh-close;

__END__


--
  ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
 (_/   /  )// //   DBE Collectibles   Mailto:dbe;todbe.com
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

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



RE: Crypt::CBC w/Crypt-DES (small correction)

2002-10-23 Thread Toby Stuart
problem solved.
thanks
toby

 -Original Message-
 From: Toby Stuart [mailto:toby.stuart;figtreesys.com.au]
 Sent: Wednesday, October 23, 2002 3:41 PM
 To: '[EMAIL PROTECTED]'
 Subject: FW: Crypt::CBC w/Crypt-DES (small correction)
 
 
 see corrections below
 
  -Original Message-
  From: Toby Stuart [mailto:toby.stuart;figtreesys.com.au]
  Sent: Wednesday, October 23, 2002 3:35 PM
  To: '[EMAIL PROTECTED]'
  Subject: Crypt::CBC w/Crypt-DES
  
  
  Hi All,
  
  I'm trying to encrypt/decrypt a text file using Crypt::CBC with DES.
  
  The encryption works fine but the decryption seems to yield 
  only the first
  few bytes of the original text.  I'm sure i'm missing 
  something simple.
  
  Any help appreciated.
  
  Example follows:
  
  enc.pl
  use strict;
  use Crypt::CBC;
  
  my $key = pack H16, 1122334455667788;
  my $cipher = new Crypt::CBC ($key, 'IDEA');
 
 my $cipher = new Crypt::CBC ($key, 'DES');
 
 
  
  my $in;
  open(IN,'e:\some_largish_text_file') || die $!;
  print $cipher-encrypt($in) while read(IN,$in,1024);
  print $cipher-finish;
  close(IN);
  /enc.pl
  
  
  
  dec.pl
  use strict;
  use Crypt::CBC;
  
  if (!@ARGV) { die Usage: perl $0 encrypted_file  
  decrypted_output_file; }
  
  my $key = pack H16, 1122334455667788;
  my $cipher = new Crypt::CBC ($key, 'IDEA');
 
 my $cipher = new Crypt::CBC ($key, 'DES');
 
  
  my $in;
  open(IN,$ARGV[0]) || die $!;
  print $cipher-decrypt($in) while read(IN,$in,1024);
  print $cipher-finish;
  close(IN);
  /dec.pl
  
  ___
  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: FW: Crypt::CBC w/Crypt-DES (small correction)

2002-10-23 Thread Toby Stuart
thanks $Bill, i had to add binmode on $ifh and $ofh (see below) to make it
work


 -Original Message-
 From: $Bill Luebkert [mailto:dbe;wgn.net]
 Sent: Wednesday, October 23, 2002 4:56 PM
 To: Toby Stuart
 Cc: '[EMAIL PROTECTED]'
 Subject: Re: FW: Crypt::CBC w/Crypt-DES (small correction)
 
 
 Toby Stuart wrote:
  see corrections below
  
  
 -Original Message-
 From: Toby Stuart [mailto:toby.stuart;figtreesys.com.au]
 Sent: Wednesday, October 23, 2002 3:35 PM
 To: '[EMAIL PROTECTED]'
 Subject: Crypt::CBC w/Crypt-DES
 
 
 Hi All,
 
 I'm trying to encrypt/decrypt a text file using Crypt::CBC with DES.
 
 The encryption works fine but the decryption seems to yield 
 only the first
 few bytes of the original text.  I'm sure i'm missing 
 something simple.
 
 Any help appreciated.
 
 Example follows:
 
 enc.pl
 use strict;
 use Crypt::CBC;
 
 my $key = pack H16, 1122334455667788;
 my $cipher = new Crypt::CBC ($key, 'IDEA');
  
  
  my $cipher = new Crypt::CBC ($key, 'DES');
  
  
  
 my $in;
 open(IN,'e:\some_largish_text_file') || die $!;
 print $cipher-encrypt($in) while read(IN,$in,1024);
 print $cipher-finish;
 close(IN);
 /enc.pl
 
 
 
 dec.pl
 use strict;
 use Crypt::CBC;
 
 if (!@ARGV) { die Usage: perl $0 encrypted_file  
 decrypted_output_file; }
 
 my $key = pack H16, 1122334455667788;
 my $cipher = new Crypt::CBC ($key, 'IDEA');
  
  
  my $cipher = new Crypt::CBC ($key, 'DES');
  
  
 my $in;
 open(IN,$ARGV[0]) || die $!;
 print $cipher-decrypt($in) while read(IN,$in,1024);
 print $cipher-finish;
 close(IN);
 /dec.pl
 
 Try this one:
 
 use strict;
 use Crypt::CBC;
 use IO::File;
 
 my $key = pack H16, 1122334455667788;
 my $cipher = new Crypt::CBC ($key, 'DES');
 
 die Usage: perl $0 file-to-encrypt [encrypted_output_file]\n .
or:perl $0 -decrypt file-to-decrypt 
 [decrypted_output_file]\n .
  Second file arg defaults to STDIN for encrypt; STDOUT 
 for decrypt\n\n
if not @ARGV;
 
 my $decrypt = 0;
 for (my $ii = 0; $ii  @ARGV; ) {
   if ($ARGV[$ii] =~ /^--?de/) {
   $decrypt = 1;
   splice @ARGV, $ii, 1;
   next;
   }
   $ii++;
 }
 
 my $ifh = new IO::File;
 if (@ARGV) {
   $ifh-open($ARGV[0]) or die open $ARGV[0]: $!;
 } else {
   $ifh-open(STDIN) or die open $ARGV[0]: $!;
 }
 
 my $ofh = new IO::File;
 if (@ARGV  1) {
   $ofh-open($ARGV[1]) or die open $ARGV[1]: $!;
 } else {
   $ofh-open(STDOUT) or die open $ARGV[1]: $!;
 }
 
 my $in;
 if ($decrypt) {
   $cipher-start('decrypting');

binmode($ofh);

   print $ofh $cipher-crypt($in) while read $ifh, $in, 1024;
   print $ofh $cipher-finish;
 } else {
   $cipher-start('encrypting');

binmode($ifh);

   print $ofh $cipher-crypt($in) while read $ifh, $in, 1024;
   print $ofh $cipher-finish;
 }
 $ifh-close;
 $ofh-close;
 
 __END__
 
 
 -- 
,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
   (_/   /  )// //   DBE Collectibles   Mailto:dbe;todbe.com
/ ) /--  o // //  http://dbecoll.tripod.com/ (Free 
 site for Perl)
 -/-' /___/__/_/_ Castle of Medieval Myth  Magic 
http://www.todbe.com/

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



Re: FW: Crypt::CBC w/Crypt-DES (small correction)

2002-10-23 Thread $Bill Luebkert
Toby Stuart wrote:

thanks $Bill, i had to add binmode on $ifh and $ofh (see below) to make it
work






Try this one:

use strict;
use Crypt::CBC;
use IO::File;

my $key = pack H16, 1122334455667788;
my $cipher = new Crypt::CBC ($key, 'DES');

die Usage: perl $0 file-to-encrypt [encrypted_output_file]\n .
  or:perl $0 -decrypt file-to-decrypt 
[decrypted_output_file]\n .
  	Second file arg defaults to STDIN for encrypt; STDOUT 
for decrypt\n\n
  if not @ARGV;

my $decrypt = 0;
for (my $ii = 0; $ii  @ARGV; ) {
	if ($ARGV[$ii] =~ /^--?de/) {
		$decrypt = 1;
		splice @ARGV, $ii, 1;
		next;
	}
	$ii++;
}

my $ifh = new IO::File;
if (@ARGV) {
	$ifh-open($ARGV[0]) or die open $ARGV[0]: $!;
} else {
	$ifh-open(STDIN) or die open $ARGV[0]: $!;
}

my $ofh = new IO::File;
if (@ARGV  1) {
	$ofh-open($ARGV[1]) or die open $ARGV[1]: $!;
} else {
	$ofh-open(STDOUT) or die open $ARGV[1]: $!;
}

I'd do it here instead:

binmode $ifh;
binmode $ofh;



my $in;
if ($decrypt) {
	$cipher-start('decrypting');


	
	binmode($ofh);



	print $ofh $cipher-crypt($in) while read $ifh, $in, 1024;
	print $ofh $cipher-finish;
} else {
	$cipher-start('encrypting');



	binmode($ifh);
	


	print $ofh $cipher-crypt($in) while read $ifh, $in, 1024;
	print $ofh $cipher-finish;
}
$ifh-close;
$ofh-close;

__END__





--
  ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
 (_/   /  )// //   DBE Collectibles   Mailto:dbe;todbe.com
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

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