OLE

2001-05-23 Thread Alex Lee

HI: 

I usually use:
my $FileName =
$ExcelObject->Application->GetOpenFilename;

So that I can get a pretty "browser" console to find a
file in windows.  The only problem is that I have to
assume that the user have an Excel application on
their computer.  

My question:  Does anyone know of any default com
object I can use to accomplish this task in windows. 
Maybe a standard program such as notepad would be
nice, or even windows file manager. 

Thanks in advance!

Alex Lee

=
**
* END OF MESSAGE *

__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: IIS 5 metabase

2001-05-23 Thread Paul Rogers [CE]

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of
Raymond Forbes
Sent: Wednesday, May 23, 2001 7:32 PM

Has anybody tried writing a perl script to modify the IIS 5 metabase?
Has a module been written for this? 

Why not just use ADSI?  IIS includes a number of admin scripts (VB and
JS) that can be fairly easily converted to perl (via Win32::OLE), or
simply called from your fav perl script.

P ---

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: IIS 5 metabase

2001-05-23 Thread Floyd Russell

Well I have the beginnings of a perl module to do almost everything you need
to do. I've been trying to find people to help me on it. Let me know if you
would like to take a peak at it. That goes for the this list as well.
Granted this was written for IIS 4.0, but the metabase works the same way.
Floyd Russell

P.S. I would love to know if there is any information on how to access SSL
keys in the metabase.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Raymond
Forbes
Sent: Wednesday, May 23, 2001 6:32 PM
To: [EMAIL PROTECTED]
Subject: IIS 5 metabase


Hello,
Has anybody tried writing a perl script to modify the IIS 5 metabase?  Has a
module been written for this?
Thanks!
Raymond Forbes
Security Systems Engineer
MSN/.net
Microsoft Corp.

 iis.pm


IIS 5 metabase

2001-05-23 Thread Raymond Forbes
Title: IIS 5 metabase






Hello,


Has anybody tried writing a perl script to modify the IIS 5 metabase?  Has a module been written for this?


Thanks!


Raymond Forbes

Security Systems Engineer

MSN/.net 

Microsoft Corp.





RE: parse .msg files

2001-05-23 Thread Jones, Leigh

I've worked with these files (".eml") , but only from one particular release
of the Outlook e-mail client and only when receiving files from one
particular sender, so rules that worked for me might not work for all ".eml"
files.  I processed the files with a tiny program written in C language code
at the time, so I can't instantly give you all of the info for perl.  I
threw away everything until the first string containing "Received:" was
encountered (using strstr).  I kept everything from the first "Received:"
string (inclusive) until a long group of 15 spaces or more was encountered.
This first block of text was will be the message header.  I would have
stripped off the group of spaces but tat wasn't important to my application
at the time.  I skipped to the end of that first long group of 15 or more
spaces, then continued on -- this time throwing away everything until I came
to another group of 15 or more spaces.  Throwing away every space in the
long string of spaces, I then kept everything until I encountered the string
"SMTP:".  I then stopped and threw away the remainder of the ".eml"
file.  Now, this method will fail, of course, if a message is processed that
contains the string "SMTP:" within the message body.  But it worked
consistently for me using the kind of messages I was trying to translate.
All of this would be very easily in perl, except that there are bytes with
bit 7 set.  Perhaps the first step should be to strip off all of the bit
7's.

> -Original Message-
> From: Peter Eisengrein [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, May 23, 2001 13:18
> To:   Perl-Win32-Users Mailing List (E-mail)
> Subject:  parse .msg files
> 
> Anyone know how to parse .msg files, those annoying little pseudo-text
> files
> created by Outlook? I have a bunch that I'd rather not have to open and
> "save as" .txt if I can help it.
> 
> binmode doesn't seem quite right. If I knew what $/ is set to in these
> files
> I think I'd be fine.
> 
> Thanks,
> Pete
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Creating new LWP

2001-05-23 Thread Charles Pelkey

If I was off-base on this one, I apologize...

I have always seen it as "Content-Type:" with capital C and T...
I have never seen it all lowercase.

---
Charles E. Pelkey
C.P. Designs: http://cpdesigns.homeip.net/ [EMAIL PROTECTED]
Personal Site: http://cpelkey.homeip.net/ [EMAIL PROTECTED]



___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Win32::API - how to handle a binary stream

2001-05-23 Thread $Bill Luebkert

Mike Kangas wrote:
> 
> I have a c++ dll that takes a string and turns it into a binary string. I
> have C++ put the data into a file and that works fine. But, I can't get
> Win32::API to receive the whole binary string. Perl gets a little bit of the
> string but not much. Not sure why it's dyin'
> 
> ###
> 
> open(FILE, "test.xml");
>@file = ;
> close(FILE);
> $xml = join "", @file;
> 
> use Win32::API;
> $API = new Win32::API('FirstDll', 'decryptString', [P], P);
> $encryptedString = $API->Call($xml);
> 
> 
> 
> Anyone?

You can't return a large value from a Call.  You can add another 
parameter and pass a pointer to a Perl vrbl and then have the C routine 
store the data there and use unpack to access the data in the Perl 
vrbl.  Make sure you initialize the vrbl to the max size before the Call.
Have the sub return 1 for good and 0 for bad. Change [P] to [P, P] to 
add the extra arg.

my $encryptedString = "\000" x $MAX_SIZE;
my $ret = $API->Call($xml, $encryptedString);
if ($ret) {
# good return from call
} else {
# bad return
}

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   http://www.todbe.com/
  / ) /--<  o // //  Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/_<_http://www.freeyellow.com/members/dbecoll/
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



parse .msg files

2001-05-23 Thread Peter Eisengrein

Anyone know how to parse .msg files, those annoying little pseudo-text files
created by Outlook? I have a bunch that I'd rather not have to open and
"save as" .txt if I can help it.

binmode doesn't seem quite right. If I knew what $/ is set to in these files
I think I'd be fine.

Thanks,
Pete
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: thread/fork on Win98

2001-05-23 Thread Edward G. Orton


- Original Message -
From: "Adam Frielink" <[EMAIL PROTECTED]>
To: "Perl Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, May 23, 2001 2:07 PM
Subject: thread/fork on Win98


> After reading through the archives, I have become fully confused.  I
> understand that Thread is not functional in Build 623.  But is fork?  I am
> using this script from the Active Perl Developer's Guide.
> ##
> print "Starting the Parent\n";
>
> unless($pid = fork) {
>   sleep 2;
> for (1 .. 20) {
>print "Child, Count $_\n";
>sleep 1;
> }
> exit 0;
> }
> for (1..15) {
>   print "Parent, Count $_\n";
>   sleep 1;
> }
>
> waitpid($pid,0);
> ##
>
> I don't get the expected output.  I get all the parent information first,
> then the child.  They should be intertwined (as they are when I run this
on
> my Unix box).  Could someone clarify the issue for me?  Does fork() work
on
> Win98 (or 95, my company is a little behind the times on some PCs) and if
> so, why doesn't my AS build 623 not work properly.  Will I need to compile
> my own (not a preferable choice)?
>
> Adam Frielink
Try putting the following lines of code at the top of the script. The
problem is that output is buffered, and isn't flushing out in the order you
expect. By setting auto flush, it should come out to what you want or
expect.

use FileHandle;
STDOUT->FileHandle::autoflush(1);
STDERR->FileHandle::autoflush(1);

ego
Edward G. Orton, GWN Consultants Inc.
Office: 613-860-3186, Home: 613-764-3186, Fax: 613-764-1721
email: [EMAIL PROTECTED]

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



thread/fork on Win98

2001-05-23 Thread Adam Frielink

After reading through the archives, I have become fully confused.  I
understand that Thread is not functional in Build 623.  But is fork?  I am
using this script from the Active Perl Developer's Guide.
##
print "Starting the Parent\n";

unless($pid = fork) {
  sleep 2;
for (1 .. 20) {
   print "Child, Count $_\n";
   sleep 1;
}
exit 0;
}
for (1..15) {
  print "Parent, Count $_\n";
  sleep 1;
}

waitpid($pid,0);
##

I don't get the expected output.  I get all the parent information first,
then the child.  They should be intertwined (as they are when I run this on
my Unix box).  Could someone clarify the issue for me?  Does fork() work on
Win98 (or 95, my company is a little behind the times on some PCs) and if
so, why doesn't my AS build 623 not work properly.  Will I need to compile
my own (not a preferable choice)?

Adam Frielink

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: urgent help required

2001-05-23 Thread Edward G. Orton


- Original Message -
From: "Vishal Madan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 14, 2001 10:11 AM
Subject: urgent help required


> Hi,
>I am new to world of perl programming. I got a perl programme from
> client. when i made some small change to it and tried to compile it, it
gave
> a error " element not found at line ... in parser.pm".  i tried all the
> possible things but compile error is still there.
> any help is highly appericiated
> Regards
> Vishal

A lot more information is required to assist you. How about a small snippet
of the script where it's failing to give us an idea of what's going on.

ego
Edward G. Orton, GWN Consultants Inc.
Office: 613-860-3186, Home: 613-764-3186, Fax: 613-764-1721
email: [EMAIL PROTECTED]

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: Perl/Tk problem

2001-05-23 Thread Dunnigan,Jack [Edm]

use ROText;

instead

Jack

-Original Message-
From: Edwards, Mark (CXO) [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 23, 2001 10:07 AM
To: Perl-Win32-Users (E-mail)
Subject: Perl/Tk problem


I have a script that displays text in a Text widget.  I want to be able to
highlight a portion of the text, Ctrl-C and Ctrl-V it to another window.
That's easy, works fine. Unfortunately, the text in the Text widget can also
be altered.  If I use -state=>"disabled", then it can't be changed but I
also can't highlight it.  Is there some other property like -edit=>"no"?

Mark Edwards
ITO Support Specialist V
FutureSourcingSM
> COMPAQ Global Services
Phone: (719) 592-5363 
Fax: (719)592-5870
Pager: (719) 279-2702
Email: [EMAIL PROTECTED]

Compaq Computer Corp.
301 Rockrimmon Blvd. South
Mail Stop: CXO01-3-N13
Colorado Springs, CO 80919-2398


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: Perl/Tk problem

2001-05-23 Thread Edwards, Mark (CXO)

Well that was easy.  Thanks.

-Original Message-
From: Dunnigan,Jack [Edm] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 23, 2001 10:27 AM
To: Edwards, Mark (CXO); Perl-Win32-Users (E-mail)
Subject: RE: Perl/Tk problem


use ROText;

instead

Jack

-Original Message-
From: Edwards, Mark (CXO) [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 23, 2001 10:07 AM
To: Perl-Win32-Users (E-mail)
Subject: Perl/Tk problem


I have a script that displays text in a Text widget.  I want to be able to
highlight a portion of the text, Ctrl-C and Ctrl-V it to another window.
That's easy, works fine. Unfortunately, the text in the Text widget can also
be altered.  If I use -state=>"disabled", then it can't be changed but I
also can't highlight it.  Is there some other property like -edit=>"no"?

Mark Edwards
ITO Support Specialist V
FutureSourcingSM
> COMPAQ Global Services
Phone: (719) 592-5363 
Fax: (719)592-5870
Pager: (719) 279-2702
Email: [EMAIL PROTECTED]

Compaq Computer Corp.
301 Rockrimmon Blvd. South
Mail Stop: CXO01-3-N13
Colorado Springs, CO 80919-2398


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Perl/Tk problem

2001-05-23 Thread Edwards, Mark (CXO)

I have a script that displays text in a Text widget.  I want to be able to
highlight a portion of the text, Ctrl-C and Ctrl-V it to another window.
That's easy, works fine. Unfortunately, the text in the Text widget can also
be altered.  If I use -state=>"disabled", then it can't be changed but I
also can't highlight it.  Is there some other property like -edit=>"no"?

Mark Edwards
ITO Support Specialist V
FutureSourcingSM
> COMPAQ Global Services
Phone: (719) 592-5363 
Fax: (719)592-5870
Pager: (719) 279-2702
Email: [EMAIL PROTECTED]

Compaq Computer Corp.
301 Rockrimmon Blvd. South
Mail Stop: CXO01-3-N13
Colorado Springs, CO 80919-2398


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Win32::API - how to handle a binary stream

2001-05-23 Thread Mike Kangas

I have a c++ dll that takes a string and turns it into a binary string. I
have C++ put the data into a file and that works fine. But, I can't get
Win32::API to receive the whole binary string. Perl gets a little bit of the
string but not much. Not sure why it's dyin'

###

open(FILE, "test.xml");
   @file = ;
close(FILE);
$xml = join "", @file;

use Win32::API;
$API = new Win32::API('FirstDll', 'decryptString', [P], P);
$encryptedString = $API->Call($xml);



Anyone?

thanks
mike kangas

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Code references

2001-05-23 Thread Philip Newton

Lee Goddard wrote:
> From: Philip Newton [mailto:[EMAIL PROTECTED]]
> 
> > Symbolic references are ick. Avoid. They often indicate a 
> > problem in your design.
> 
> Not my design - Sean Burke's MIDI::* packages, specifically
> &MIDI::Simple::synch.

I don't see where MIDI::Simple::synch requires symbolic references. It says
that it wants a list of coderefs. The example given is

synch(\&count, \&lalala);

No symrefs.

See also my reply to your other reply (about the names of the subs).

Cheers,
Philip
-- 
Philip Newton <[EMAIL PROTECTED]>
All opinions are my own, not my employer's.
If you're not part of the solution, you're part of the precipitate.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Win32::OLE and DAO

2001-05-23 Thread Stewart, Ian

Howdy Folks,

I'm struggling to access DAO from Perl, using Jan Dubois' Win32::OLE.  I
have successful developed scripts that use OLE to talk to MS Word, MS Excel
and Lotus Notes, so I'ld like to think I'm not entirely clueless, but this
one is kickin' my behind.

I have the following test script:

#!C:\Perl\bin\perl.exe -w

use strict;
use Win32::OLE;

my $engine = Win32::OLE->GetActiveObject('DAO.DBEngine.36') 
or Win32::OLE->new('DAO.DBEngine.36');
if (defined $engine)
  {
print "Connection established\n";
  }
else
  {
die "error connecting to DBEngine: ", Win32::OLE->LastError;
  }


Based on what I've read in the archives, this should work, but the output I
get is:

error connecting to DBEngine: 0 at temp.pl line 14.


Anybody care to shed some light on this?


Thanx,
Ian
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Code references

2001-05-23 Thread Philip Newton

Lee Goddard wrote:
> From: Philip Newton [mailto:[EMAIL PROTECTED]]
> > Rubinow, Larry wrote:
> > > Finally, a legitimate case for symbolic references?
> >
> > I doubt it. Having names like this for subroutines sounds 
> > strange enough; they're not very descriptive.
> 
> Did you really want the full name of my subs?  Why?  Would it 
> help you solve the problem?

If they contained dissimilar names, you'd have to do something like

   for (\&this, \&that, \&the_other) { ... }

while with similar names you could use symrefs -- but then that might be
because the subs have poorly chosen names.

> I find that when discussing private issues in public, I get 
> the best results if I abstract.

But only if the abstraction is structurally identical to the real code, or
people might point you in directions you don't need to go.

> > And if they are realy intimately connected in a series, 
> > consider storing references to the sub in an array or a
> > hash, rather than giving them such funny names.
> 
> They were, as it happens, but it was not necessary to post 
> that, was it?

Yes, it was. If they're in an array, you don't need to use funky symref.

Erm, come to talk about it, if the sub references are in an array already,
you already have a list. If, for example, @dostuff contains three code refs,
you could just pass @dostuff to MIDI::Simple::synch and it should be fine.

Cheers,
Philip
-- 
Philip Newton <[EMAIL PROTECTED]>
All opinions are my own, not my employer's.
If you're not part of the solution, you're part of the precipitate.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: Code references

2001-05-23 Thread Lee Goddard

From: Philip Newton [mailto:[EMAIL PROTECTED]]

> Lee Goddard wrote:
> > I have defined sub a1, sub a2, and sub a3.
> > I need to push to an array references to these.
> > Is there a way I can do this programmatically?
> >
> > Sortalike...
> >
> >  for (1..3){
> > push @myarray, \&a$_;
> >  }
> >
> > ...but correct?
>
> for my $ref (\&a1, \&a2, \&a3) {
> push @myarray, $ref;
> }
>
> Symbolic references are ick. Avoid. They often indicate a problem in your
> design.

Not my design - Sean Burke's MIDI::* packages, specifically
&MIDI::Simple::synch.

I've just rewritten it, as it happens ;)

lee

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: Code references

2001-05-23 Thread Lee Goddard

From: Philip Newton [mailto:[EMAIL PROTECTED]]
> Rubinow, Larry wrote:
> > Finally, a legitimate case for symbolic references?
>
> I doubt it. Having names like this for subroutines sounds strange enough;
> they're not very descriptive.

Did you really want the full name of my subs?  Why?  Would it help you solve
the problem?

I find that when discussing private issues in public, I get the best results
if I abstract.

> And if they are realy intimately connected in a series, consider storing
> references to the sub in an array or a hash, rather than giving them such
> funny names.

They were, as it happens, but it was not necessary to post that, was it?

> That's what Perl has data structures for, to save people using $formfield1
> through $formfield15.

Really?

Now I'm wasting everyone's time too. Sorry folks.

lee

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Code references

2001-05-23 Thread Philip Newton

Lee Goddard wrote:
> I have defined sub a1, sub a2, and sub a3.
> I need to push to an array references to these.
> Is there a way I can do this programmatically?
> 
> Sortalike...
> 
>  for (1..3){
> push @myarray, \&a$_;
>  } 
> 
> ...but correct?

for my $ref (\&a1, \&a2, \&a3) {
push @myarray, $ref;
}

Symbolic references are ick. Avoid. They often indicate a problem in your
design.

Cheers,
Philip
-- 
Philip Newton <[EMAIL PROTECTED]>
All opinions are my own, not my employer's.
If you're not part of the solution, you're part of the precipitate.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Best way to determine that an item exists at URL?

2001-05-23 Thread Philip Newton

Allen Jones wrote:
> I'm trying to find the fastest way to determine if an item exists at a
> specific URL.
[snip]
> How about the LWP:Simple 'head' function?  Does it have to read the
> entire item to determine the content type?

I'd imagine that it uses an HTTP "HEAD" request. This should retrieve only
the HTTP headers from the server (though if you have a badly written CGI
script that doesn't check $ENV{REQUEST_TYPE}, you might get all the contents
shoved over the connection anyway).

The HTTP headers might include a "Content-Type: " header.

> Or does anyone know of another fast way to read a URL and 
> determine that the URL does exist

HEAD is probably fastest.

> and what media type it is?

Well, you might just get "application/octet-stream" if the server doesn't
know about the media type; if you want to find out whether that represents a
TIFF image or an AVI, you'll probably have to read at least part of the
document with a GET request and figure it out from the contents.

Cheers,
Philip
-- 
Philip Newton <[EMAIL PROTECTED]>
All opinions are my own, not my employer's.
If you're not part of the solution, you're part of the precipitate.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Code references

2001-05-23 Thread Philip Newton

Rubinow, Larry wrote:
> Finally, a legitimate case for symbolic references?

I doubt it. Having names like this for subroutines sounds strange enough;
they're not very descriptive.

And if they are realy intimately connected in a series, consider storing
references to the sub in an array or a hash, rather than giving them such
funny names.

That's what Perl has data structures for, to save people using $formfield1
through $formfield15.

Cheers,
Philip
-- 
Philip Newton <[EMAIL PROTECTED]>
All opinions are my own, not my employer's.
If you're not part of the solution, you're part of the precipitate.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: append to the top of a file

2001-05-23 Thread Philip Newton

McCue, Gia wrote:
> open (FILE,"$file");

Always check your opens.

> ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$c
> time,$blksize, $blocks) = stat FILE;

If all you're interested in is the size, then

$size = -s FILE;

is a lot quicker to type.

And if you want to read a file backwards line-by-line, the
File::ReadBackwards module has already invented that wheel for you. It does
its own seeking and buffering and handling of incomplete lines.

> while ()
>   {

I'm not sure what this is for. It looks as if you want to read in the file
line-by-line, but in fact your seek and read inside the "loop", and exit
after the first iteration. It looks as if you can just delete the loop.

>   if  ($size > 1000) # set the the number of bytes to 
> read from the bottom
>   { $size = 1000 }
> 
>   $seek_size = "-" . $size;  #set seek size to negative 
> for the seek function. Start from the end and count back 

$size is a number, isn't it? So treat it like a number, not like a string.

$seek_size = -$size;

>   seek (FILE, $seek_size, 2);

Icky magic number. Better:

use Fcntl qw(:seek);
# ... later
seek (FILE, $seek_size, SEEK_END);

>   read FILE, $var, $size, 0;

You can leave off OFFSET if it's zero. Less confusing IMO, since the default
case for all places I've used read uses an offset of zero.

>   print "$var";

Unnecessary double quotes around $var.

Cheers,
Philip
-- 
Philip Newton <[EMAIL PROTECTED]>
All opinions are my own, not my employer's.
If you're not part of the solution, you're part of the precipitate.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Subject: Problem transferring DB_File from Win32 to Unix

2001-05-23 Thread Steve Keith



Eric,
 
The Berkeley DB format is not the same from 
platform to platform.
When I ran into this problem, I needed to dump each 
record 
(using Data::Dumper, and use eval) to enter it into 
the new database.
 
There may be other ways, but this quick and dirty 
way solved the problem for me.
 
Steve Keith
 
 
#--- I'm not sure 
if this is the right list for this but here's my problem. I've 
produced a BerkeleyDB from a csv one on a Win32 machine using DBI 
and DB_File. The Win32 machine is running Windows Professional but I'm 
usingthe FAT32 filing system as I'm double booting with Windows 98. 
I can open theDB OK on the same Win32 machine, and it's exactly as 
it should be. However I need to open the DB on a Unix server that's 
running Caldera 1.3. When I try a tie to the DB on the Unix box I get 
an Invalid Argument error. I've produced a small program to create 
a simple BerkeleyDB and then toread it, using the same ties as I've 
used in my earlier two programs. When I run this on the Unix server it 
works perfectly. The version of Perl I'm usingon the Win32 machine 
is 5.6.1 while the Unix machine is running 5.006. My DB_File is version 
1.73 whereas the Unix one is 1.76. The 2 lines I'm using to tie 
are: tie (my %dbavail, 
'DB_File', $dbfile, O_RDWR|O_CREAT, 
0666, 
$DB_BTREE); $X = tie 
%dbavail, "DB_File", $dbfile, O_RDONLY, 0666, $DB_BTREE; Can anyone 
suggest why I'm having this problem? Eric Robertson#---