[OT] Problem with Winzip

2005-01-14 Thread Sisyphus
Hi,
Sorry about this.
I downloaded PDL-2.4.1.tar.gz from CPAN. It contains a (binary) file 
called 'm51.fits', among other things.

When I open the .tar.gz file in Winzip, the size of 'm51.fits' is being 
correctly stated as 593,280 bytes (actual size of file). But when Winzip 
extracts that file, the file grows to 594,617 bytes (actual size of 
file) - and is consequently not yielding the data that it should.

I also have, on the same, box, 'gzip' and 'tar'. If I use these tools, 
then the file *does* get extracted correctly.

I've used Winzip pretty extensively for a number of years - and never 
before come across such a problem. It has always in the past produced 
identical results to 'gzip' and 'tar'.

At one stage I took a look at m51.fits in notepad - and notepad acquired 
some sort of association with the '.fits' extension. I thought that 
might have been the cause of the problem, so I tried to find a way of 
having the '.fits' extension return to its original unknown status - but 
couldn't find a way of doing that.
'assoc FITS=' and 'ftype FITS=' simply tells me that FITS is not a known 
type (though file properties reveals that m51.fits is a file of type 
FITS). I did manage to change the association from notepad to a few 
other things (eg winrar, imaging) - but the file still gets initially 
reported as being 593,280 bytes ... and extracted to 594,617 bytes. I 
don't know if that association can be the cause of the problem - in any 
case I would be grateful if someone could tell me how to remove that 
'notepad' association (as opposed to how to change it to something else).

Any ideas as to what's screwing things up ?
In the meantime, I'll take a closer look at the differences between the 
2 versions of 'm51.fits' that I'm getting.

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


RE: Sleep()

2005-01-14 Thread Jack D.
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Chris
> Sent: January 14, 2005 2:28 PM
> To: perl-win32-users
> Subject: Sleep()
> 
> Is there a way make Perl sleep for less than a full second?
> 
> I'm using v5.8 on win2k.

How come no one has mentioned select? Is it platform dependent? It works on
XP Home..

 select(undef, undef, undef, 0.1); #100ms

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


Re: LWP::Simple could not retrieve issue

2005-01-14 Thread $Bill Luebkert
Hsu, David wrote:

> Hi,
> I am having is the following error when I try to execute the script via
> a web browser.  It seem to parse fine from the command line.
> Could not retrieve http://www.infoworld.com/rss/news.xml at
> c:\inetpub\wwwroot\rss\rss2html.pl line 38
> 
> I tried with several different rss feed sites, all with the same
> problem. Following is the partial code.  This is from rss2html.pl that
> was included with XML-RSS module.
> 
> Any ideas?
> Thanks,
> David
> 
> # INCLUDES
> use strict;
> #use CGI qw(:standard);
> use XML::RSS;
> use LWP::Simple;
> 
> # Declare variables
> my $content;
> my $file;
> 
> # MAIN
> # check for command-line argument
> #die "Usage: rss2html.pl ( | )\n" unless @ARGV == 1;
> 
> # get the command-line argument
> my $arg = "http://www.infoworld.com/rss/news.xml";;
> 
> # create new instance of XML::RSS
> my $rss = new XML::RSS;
> 
> #argument is a URL
> if ($arg=~ /http:/i) {
> $content = get($arg);
> die "Could not retrieve $arg" unless $content;### line 38
> # parse the RSS content
> $rss->parse($content);
> 
> # argument is a file
> } else {
> $file = $arg;
> die "File \"$file\" does't exist.\n" unless -e $file;
> # parse the RSS file
> $rss->parsefile($file);
> }
> 
> # print the HTML channel
> &print_html($rss);

Seems ok to me except last line (not sure what the print_html is going
to do) - here's my version that works as far as retrieving :

use strict;
use XML::RSS;
use LWP::Simple;

# die "Usage: rss2html.pl ( | )\n" unless @ARGV == 1;
my $arg = $ARGV[0] || "http://www.infoworld.com/rss/news.xml";;

my $rss = new XML::RSS; # create new XML::RSS object

if ($arg=~ /^http:/i) { # argument is URL
my $content = get ($arg) or die "get $arg: $! ($^E)";
$rss->parse($content);  # parse the RSS content
} else {# argument is a file
my $file = $arg;
die "File \"$file\" does't exist.\n" unless -e $file;
$rss->parsefile($file); # parse the RSS file
}

# print the HTML channel
# print_html ($rss);
print $rss->as_string;  # I just printed the data out to verify

__END__

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[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
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Sleep()

2005-01-14 Thread Peter Eisengrein
You might also check out these fine modules:

Win32
Time::HiRes


> -Original Message-
> From: Allen, Matthew [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 14, 2005 4:36 PM
> To: Chris; perl-win32-users
> Subject: RE: Sleep()
> 
> 
> sleep EXPR 
> sleep 
> Causes the script to sleep for EXPR seconds, or forever if no 
> EXPR. May
> be interrupted by sending the process a SIGALRM. Returns the number of
> seconds actually slept. You probably cannot mix alarm() and sleep()
> calls, because sleep() is often implemented using alarm(). 
> On some older systems, it may sleep up to a full second less than what
> you requested, depending on how it counts seconds. Most modern systems
> always sleep the full amount. 
> 
> For delays of finer granularity than one second, you may use Perl's
> syscall() interface to access setitimer(2) if your system supports it,
> or else see select() below. 
> 
> See also the POSIX module's sigpause() function. 
>  
> 
> 
> Matthew Allen
> [EMAIL PROTECTED]
> Infrastructure Support - Denver
> Office - 720-876-3870
> Cell - 303-638-9870
> 
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of
> Chris
> Sent: Friday, January 14, 2005 2:28 PM
> To: perl-win32-users
> Subject: Sleep()
> 
> Is there a way make Perl sleep for less than a full second?
> 
> I'm using v5.8 on win2k.
> 
> - Chris
> 
> ___
> 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
> 
> 
> 
> __
> Message transport security by GatewayDefender.com
> 4:40:38 PM ET - 1/14/2005
> 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: selectrow_array question

2005-01-14 Thread John Deighan
At 12:02 PM 1/14/2005, Chris wrote:
$dbh->disconnect;
See: http://search.cpan.org/~timb/DBI-1.46/DBI.pm
Unfortunately, I don't want to disconnect from the database. I just want to 
make sure that no further resources are tied up by the statement handle.

-Original Message-
> In the following code (where I create the statement handle myself, because
> I want the option of using prepare_cached()), is the call to finish()
> correct, redundant, bad, safe? I definitely only want the results from a
> single row, even in cases where $sql may contain a statement that would
> normally return multiple rows, so I don't want to leave a cursor open or
> other unnecessary resources allocated.
>   my $sth = $cache ? $dbh->prepare_cached($sql)
 : $dbh->prepare($sql);
>   @data = $dbh->selectrow_array($sth, undef, @$lData);
>   $sth->finish();

___
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: Sleep()

2005-01-14 Thread $Bill Luebkert
Chris wrote:

> Is there a way make Perl sleep for less than a full second?
> 
> I'm using v5.8 on win2k.

A couple - Time::HiRes::usleep and Win32::Sleep

use strict;
use Time::HiRes qw(usleep);

my $usecs = 3_750_000;

for (1 .. 5) {
print "sleeping 1\n";
usleep ($usecs);
# or
print "sleeping 2\n";
Win32::Sleep($usecs / 1000);
}

__END__

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[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
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Sleep()

2005-01-14 Thread Jan Dubois
On Fri, 14 Jan 2005, Chris wrote:
> Is there a way make Perl sleep for less than a full second?
>
> I'm using v5.8 on win2k.

Win32::Sleep($time);

$time is specified in milliseconds.  Win32::Sleep() is part of
core Perl on Windows and always available.

Cheers,
-Jan


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


RE: Sleep()

2005-01-14 Thread Peter Guzis
use strict;
use Time::HiRes 'sleep';

sleep .5;

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Chris
Sent: Friday, January 14, 2005 1:28 PM
To: perl-win32-users
Subject: Sleep()


Is there a way make Perl sleep for less than a full second?

I'm using v5.8 on win2k.

- Chris

___
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: Sleep()

2005-01-14 Thread Lyle Kopnicky
Chris wrote:
Is there a way make Perl sleep for less than a full second?
I'm using v5.8 on win2k.
- Chris
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
 

Just use a fractional value, e.g. sleep(.5).  That may not be the 
official behavior, but it worked for me, using v5.8 on NT 4.

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


RE: Sleep()

2005-01-14 Thread Allen, Matthew
sleep EXPR 
sleep 
Causes the script to sleep for EXPR seconds, or forever if no EXPR. May
be interrupted by sending the process a SIGALRM. Returns the number of
seconds actually slept. You probably cannot mix alarm() and sleep()
calls, because sleep() is often implemented using alarm(). 
On some older systems, it may sleep up to a full second less than what
you requested, depending on how it counts seconds. Most modern systems
always sleep the full amount. 

For delays of finer granularity than one second, you may use Perl's
syscall() interface to access setitimer(2) if your system supports it,
or else see select() below. 

See also the POSIX module's sigpause() function. 
 


Matthew Allen
[EMAIL PROTECTED]
Infrastructure Support - Denver
Office - 720-876-3870
Cell - 303-638-9870


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Chris
Sent: Friday, January 14, 2005 2:28 PM
To: perl-win32-users
Subject: Sleep()

Is there a way make Perl sleep for less than a full second?

I'm using v5.8 on win2k.

- Chris

___
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


Sleep()

2005-01-14 Thread Chris
Is there a way make Perl sleep for less than a full second?

I'm using v5.8 on win2k.

- Chris

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


LWP::Simple could not retrieve issue

2005-01-14 Thread Hsu, David
Hi,
I am having is the following error when I try to execute the script via
a web browser.  It seem to parse fine from the command line.
Could not retrieve http://www.infoworld.com/rss/news.xml at
c:\inetpub\wwwroot\rss\rss2html.pl line 38

I tried with several different rss feed sites, all with the same
problem. Following is the partial code.  This is from rss2html.pl that
was included with XML-RSS module.

Any ideas?
Thanks,
David

# INCLUDES
use strict;
#use CGI qw(:standard);
use XML::RSS;
use LWP::Simple;

# Declare variables
my $content;
my $file;

# MAIN
# check for command-line argument
#die "Usage: rss2html.pl ( | )\n" unless @ARGV == 1;

# get the command-line argument
my $arg = "http://www.infoworld.com/rss/news.xml";;

# create new instance of XML::RSS
my $rss = new XML::RSS;

#argument is a URL
if ($arg=~ /http:/i) {
$content = get($arg);
die "Could not retrieve $arg" unless $content;  ### line 38
# parse the RSS content
$rss->parse($content);

# argument is a file
} else {
$file = $arg;
die "File \"$file\" does't exist.\n" unless -e $file;
# parse the RSS file
$rss->parsefile($file);
}

# print the HTML channel
&print_html($rss);
.
.
.

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


Re: Discrepancy on time reported by system and localtime

2005-01-14 Thread M. Smith
At 07:55 PM 1/13/2005, you wrote:
Allegakoen, Justin Devanandan wrote:
> ---8<
> ^Z on windoze
> ---8<
> ^D or ^Z I still have to hit enter after it. Unless theres a subtle
> difference that I'm missing.
True - you do have to hit CR (unlike UNIX's ^D).
> Anyway, just to reiterate my point, because James sent me a reply
> offline as well:-
> c:\perl\Programs>perl
> system "cmd /C date /t";
> system "cmd /C time /t";
> print scalar localtime, "\n";
> print scalar gmtime, "\n";
> ^Z
> Fri 01/14/2005
> 07:21 AM
> Thu Jan 13 23:21:57 2005
> Thu Jan 13 23:21:57 2005
>
> c:\perl\Programs>
>
> ---8<
> +8 *is* PT.  Do you have your TZ environment vrbl set by any chance ?
Sorry on the +8 discrecpency (should have been -8 for PT).
> ---8<
> Good trigger point, for some reason I have this set:-
> T1=1051664422
> T2=1051680622
> TAR=C:\Program Files\WinZip\WINZIP32.EXE ^.TAR
> TAZ=C:\Program Files\WinZip\WINZIP32.EXE ^.TAZ
> TEMP=C:\DOCUME~1\GRP_PD~1.GAR\LOCALS~1\Temp
> TGZ=C:\Program Files\WinZip\WINZIP32.EXE ^.TGZ
> TMP=C:\DOCUME~1\GRP_PD~1.GAR\LOCALS~1\Temp
> Type=1;16


> TZ=C:\Program Files\WinZip\WINZIP32.EXE ^.TZ
Just a guess -- judging from the rest of it -- this was probably supposed 
to be GZ

But setting the file extensions that Winzip opens from within Winzip would 
seem to be the best way to do that.

> I'll have a word with the bloke that set the machine up after I shoot
> him (this problem has offset other tasks as well).
If we were shot for typos -- or for incomplete testing, which is why the 
typo went unnoticed 'til now -- there wouldn't be to many of us left.

ms


>
> T1 and T2 look dodgy because they are epochs, the troubling thing is I
> didn't set them. Anyway I deleted the TZ environment variable and now I
> get what I expect:-
> c:\perl\Programs>perl
> system "cmd /C date /t";
> system "cmd /C time /t";
> print scalar localtime, "\n";
> print scalar gmtime, "\n";
> ^D
> Fri 01/14/2005
> 07:31 AM
> Fri Jan 14 07:31:15 2005
> Thu Jan 13 23:31:15 2005
>
> c:\perl\Programs>
>
> I'll have a word with the bloke that set the machine up after I shoot
> him (this problem has offset other tasks as well).
I set my TZ to 'PST8PDT' for Pacific coast - not sure what you would
use at +0800 for abbreviations, but I would guess it would depend on
country - probably SST or WST.  maybe something like: 'SST-8SDT'
--
  ,-/-  __  _  _ $Bill LuebkertMailto:[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
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: EggExp Question

2005-01-14 Thread Gardner, Sam
Title: RE: EggExp Question





See below, from perlre:


So, your regex would be


$phone_book_entry=~m/^Smith.+(?!John)/;


(?!pattern)


A zero-width negative look-ahead assertion. For example /foo(?!bar)/ matches any occurrence of ``foo'' that isn't followed by ``bar''. Note however that look-ahead and look-behind are NOT the same thing. You cannot use this for look-behind. 

If you are looking for a ``bar'' that isn't preceded by a ``foo'', /(?!foo)bar/ will not do what you want. That's because the (?!foo) is just saying that the next thing cannot be ``foo''--and it's not, it's a ``bar'', so ``foobar'' will match. You would have to do something like /(?!foo)...bar/ for that. We say ``like'' because there's the case of your ``bar'' not having three characters before it. You could cover that this way: /(?:(?!foo)...|^.{0,2})bar/. Sometimes it's still easier just to say:

    if (/bar/ && $` !~ /foo$/)


Sam Gardner


GTO Application Development


Keefe, Bruyette & Woods, Inc.


212-887-6753






-Original Message-
From: Edwards, Mark (CXO) [mailto:[EMAIL PROTECTED]] 
Sent: Friday, January 14, 2005 12:16 PM
To: Perl-Win32-Users@listserv.ActiveState.com
Subject: EggExp Question



Is there a regular _expression_ to indicate a string you're looking for and one you're not looking for? 


Example: You want to find all the Smiths in a list but not Smith, John. So if you read each record from the list, the pseudo code would be something like:

$phone_book_entry=~m/^Smith.+?not(John)/



$phone_book_entry=~m/^Smith, [^J][^o][^h][^n]/ works but can be cumbersome for long strings. Also if you don't know that ", " is always between the last and first name (Smith Jr., John) and use .*?, it breaks.

Is there a real re that will do this?


Thanks


 
Mark Edwards 
HP Services 
Technical Solutions Group   
     Hewlett-Packard Company
    
CXO01-3/N13 
301 Rockrimmon Blvd. South  
Colorado Springs, CO 80919-2398     
Voice: (719) 592-5363       
Email: [EMAIL PROTECTED]      


___
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


EggExp Question

2005-01-14 Thread Edwards, Mark (CXO)
Is there a regular expression to indicate a string you're looking for
and one you're not looking for? 

Example: You want to find all the Smiths in a list but not Smith, John.
So if you read each record from the list, the pseudo code would be
something like:

$phone_book_entry=~m/^Smith.+?not(John)/


$phone_book_entry=~m/^Smith, [^J][^o][^h][^n]/ works but can be
cumbersome for long strings. Also if you don't know that ", " is always
between the last and first name (Smith Jr., John) and use .*?, it
breaks.

Is there a real re that will do this?

Thanks

 
Mark Edwards 
HP Services 
Technical Solutions Group   
 Hewlett-Packard Company

CXO01-3/N13 
301 Rockrimmon Blvd. South  
Colorado Springs, CO 80919-2398 
Voice: (719) 592-5363   
Email: [EMAIL PROTECTED]  

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


RE: selectrow_array question

2005-01-14 Thread Chris
$dbh->disconnect;

See: http://search.cpan.org/~timb/DBI-1.46/DBI.pm



-Original Message-

> In the following code (where I create the statement handle myself, because

> I want the option of using prepare_cached()), is the call to finish() 
> correct, redundant, bad, safe? I definitely only want the results from a 
> single row, even in cases where $sql may contain a statement that would 
> normally return multiple rows, so I don't want to leave a cursor open or 
> other unnecessary resources allocated.

>   my $sth = $cache ? $dbh->prepare_cached($sql)
 : $dbh->prepare($sql);
>   @data = $dbh->selectrow_array($sth, undef, @$lData);
>   $sth->finish();



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


selectrow_array question

2005-01-14 Thread John Deighan
In the following code (where I create the statement handle myself, because 
I want the option of using prepare_cached()), is the call to finish() 
correct, redundant, bad, safe? I definitely only want the results from a 
single row, even in cases where $sql may contain a statement that would 
normally return multiple rows, so I don't want to leave a cursor open or 
other unnecessary resources allocated.

my $sth = $cache ? $dbh->prepare_cached($sql)
 : $dbh->prepare($sql);
@data = $dbh->selectrow_array($sth, undef, @$lData);
$sth->finish();
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs