[22110] in Perl-Users-Digest
Perl-Users Digest, Issue: 4332 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 2 00:06:39 2003
Date: Wed, 1 Jan 2003 21:05:04 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 1 Jan 2003 Volume: 10 Number: 4332
Today's topics:
CPAN.pm problem, LWP: and Net::FTP: fail SLOWLY <andy-news@schegg.org>
Re: Dealing with split() and quotes <mpapec@yahoo.com>
Re: Dealing with split() and quotes <goldbb2@earthlink.net>
Re: Direct Shared Memory Mapping? <gordan@_NOSPAM_bobich.net>
Re: Direct Shared Memory Mapping? <goldbb2@earthlink.net>
How to compile perl script into .exe file with a module <tancm@pacific.net.sg>
Re: how to load a module depending on 'if' condition ? <bongie@gmx.net>
Re: Literal and numeric declarations- are the same? (Sara)
The diamond operator <member@dbforums.com>
Re: The diamond operator <goldbb2@earthlink.net>
Re: The diamond operator (Tad McClellan)
Re: The diamond operator <member@dbforums.com>
Re: whats the syntax to get a scalar out an array of re <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 01 Jan 2003 23:43:03 GMT
From: Andy Schwartz <andy-news@schegg.org>
Subject: CPAN.pm problem, LWP: and Net::FTP: fail SLOWLY
Message-Id: <3E137CF9.2030802@schegg.org>
I've been using CPAN.pm for a short while. It's performance is SLOW
because the fetch methods LWP: and Net::FTP: are failing, and do so only
after 2-3 minutes of delay. /usr/bin/ncftpget does succeed, but is only
tried after the above methods fail against all configured mirror sites.
Two questions:
1) Where might I begin to figure out why LWP: and Net::FTP: are failing?
2) In lieu of 1, how can I skip the first two methods?
I have tried installing the latest LWP::UserAgent. Also, I am running
Perl 5.8, so I should have very recent versions of LWP and Net::FTP I
believe.
Thanks.
Andy
------------------------------
Date: Thu, 02 Jan 2003 00:31:39 +0100
From: Matija Papec <mpapec@yahoo.com>
Subject: Re: Dealing with split() and quotes
Message-Id: <34t61v8gdug0s6s1tmjf17n39bqn701mmj@4ax.com>
X-Ftn-To: Max Power
Mike@Kordik.net (Max Power) wrote:
>I have a comma delimted file that I need to parse. I need to do
>somethign with each element in between commas however there are a few
>strings that have commas in them. For example:
>
>1, high, "text1, text2", some_more_text
>
>I need the "text1, text 2" string to count as one element. When I use
>split and split on a comma I get two elements. Now all strings have
>commas in them though. How do I get PERL to treat text in between
>quotes as one element even thought it might have the delimiter in it?
$line = '1, high, "text1, text2", some_more_text';
for (split(/"/, $line)) {
push @fields, ++$i%2 ? split(/, /) : $_
# same thing with if statement
# if (++$i%2) { push @fields, split(/, /) } else { push @fields, $_ }
}
First you split the line using " and then split 0,2nd,4th.. element with
', ' pushing results into @fields.
--
Matija
------------------------------
Date: Wed, 01 Jan 2003 19:12:25 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Dealing with split() and quotes
Message-Id: <3E1383E8.A83C56B2@earthlink.net>
Matija Papec wrote:
[snip]
> >1, high, "text1, text2", some_more_text
> >
> >I need the "text1, text 2" string to count as one element. When I use
[snip]
> for (split(/"/, $line)) {
> push @fields, ++$i%2 ? split(/, /) : $_
What happens if $line is something like
1, high, "This string contains a \" quote", some_more_text
Or:
this, list, contains, an, unbalanced, ", quote mark.
--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);
------------------------------
Date: Thu, 02 Jan 2003 01:10:27 +0000
From: Gordan <gordan@_NOSPAM_bobich.net>
Subject: Re: Direct Shared Memory Mapping?
Message-Id: <8kMQ9.197$Su4.40067@newsfep1-win.server.ntli.net>
Benjamin Goldberg wrote:
> [snip]
[using pipes]
> For efficiency, you would be better off matching them against your
> search pattern before considering wether or not to put them into the
> queue.
Yup, I already do that _before_ they are inserted.
>> >> Also checking and setting $Hash{"Key"}.
>> >
>> > Does the set of keys that %Hash has ever change?
>>
>> It would change constantly, as the main use I have is for checking
>> whether a page has already been retrieved, i.e.
>>
>> unless ($Visited{$URL})
>> {
>> Retrieve($URL);
>> $Visited{$URL} = 1;
>> }
>
> Instead of trying to share a hash, consider having *one* process keep a
> hash of urls -- use a pair of pipes to communicate with it.
[code example snipped]
Funnily enough, that is very much along the lines of what I was thinking
about when I mentioned the approach of using a separate thread/process to
do this in the previous post.
>> > Are the values of %Hash fixed length, or variable length?
>>
>> Almost always variable length. :-(
>
> From what you said before, the *values* are fixed length ("this url was
> processed/not processed"), though the keys are variable length.
Sorry, yes, you are right. That is what I meant. The key is variable, but
the value is always fixed (1 or 0 or doesn't exist).
> [snip]
>> For the uniqueness hash, as I mentioned above, there is unlikely to be
>> all that much overhead in sharing it.
>
> Err, actually, for a hash for which keys are being added and removed,
> then there's significantly a *higher* overhead for sharing it, than
> there is for a shared array. But if IPC is used instead, as I show
> above, and as you say below, then there's little/no overhead.
Of course it will... Sorry, it was late (or rather early) yeterday when I
wrote that. :^)
> [snip]
>> I follow. I think the pack template be Z, rather than N, seen as URLs
>> are strings, rather than just network addresses.
>
> Err, the thing which was packed with N was the *lengths* of the urls.
> The urls themselves were merely printed as is.
>
> Actually, doing:
> print pack("N", length($url)), $url;
> Is rather a lot like doing:
> print pack("N/a*", $url);
> But I think there's less data copying with the former than the latter.
Yup, I get it. I misread the code. It didn't click immediately that you used
the [length][URL] format. For some reason I thought you used null
terminated string sequences. My mistake.
>> But yes, I understand what You mean. It is certainly more efficient
>> than mucking around with the shared memory.
>
> Well, a hashred memory thing, if done really cleverly, and in XS, could
> be made fairly efficient, but it would be *very* complicated. Using
> pipes is far simpler.
That's why I was trying very hard to avoid doing it in XS.
>> > All perfectly ordinary stuff done here. The only slightly unusual
>> > things are the locking, which can be replaced with *any* kind of
>> > locking (semaphores, if you want), and using -s on the pipe (which
>> > doesn't work on some systems).
>>
>> Yup, could just set up flags in shared memory for both if all else
>> fails, seen as it's only a few bytes that are needed for signalling.
>
> Ack, no -- setting flags in shared memory wouldn't work, unless you have
> an atomic test-and-set operation. Shared memory does not, by itself,
> provide synchronization.
I meant using the standard Lock->Check->Change->Unlock procedure.
> You can use flock for synchornization, or semaphores, or even a pipe
> dedicated to the task (reading a byte from the dedicated pipe acquires
> the lock, writing a byte to that pipe releases the lock), or any number
> of other things. But you can't use shared memory alone.
I never thought about using shared memory without locking... Sorry if this
was implied. I was talking about using a small array mapped into a 4KB
segment, and using locking when the status needs changing.
>> But I don't really see that as a problem, and I like the flock()
>> approach on pipes. Is there a limit on the amount of data that can sit
>> in a pipe waiting for reading, other than the amount of memory on the
>> system?
>
> Sadly, yes, there is a limit to the amount of data which you can have in
> a pipe unread. Trying to write more than this will cause the writing
> process/thread to become blocked until data is read from the reading end
> of the pipe.
That is a big problem. The default pipe size in Linux equal to PAGE_SIZE
(4KB). For efficient operation, I would need up to several MB.
> The solution to this is to have a dedicated process to act as the queue;
> one pipe would be used to send extracted urls to this process to be
> pushed on to the queue, and another to request a url to be dequeued.
>
> This dedicated process could be combined with the one for doing the
> uniqness checks.
[code snipped]
That sounds like a fairly elegant solution. One potential issue though. If
an entry in the pipe is longer than 4KB, what happens? If the sender
process starts writing and blocks, what happens when the reader process
tries to flock the pipe before reading? While URLs are going to be shorter
than the pipe size, this is likely to become an issue where the content of
a whole page is pushed into a pipe for indexing.
Worker Process:
flock ($DBIndexPipe, LOCK_EX);
print $DB_Index_Pipe pack("Z", $PageContent);
flock($DBIndexPipe, LOCK_UN);
But if length(pack("Z", $PageContent)) > 4096, this will block until the
pipe is read. Except it cannot be read until the lock is released.
>> Or is this a ulimit() issue?
>
> It's a limit compiled into your Operating System's kernel, and not
> changable except by recompiling your OS.
And there doesn't appear to be an obvious single place where this needs to
be changed. The PIPE_SIZE seems to be tied to the size of the inode, so I
suspect some fairly extensive patching of the kernel would be required for
this to work without breaking the file system access... :-(
[snip]
> If you're saving the *entire* contents of each page in your SQL
> database, then you might consider giving each crawler thread it's own
> SQL database connection, and skip having a dedicated process for that
> task. After all, a database connection *already* is a pipe (or socket,
> or something) to a dedicated process; there's no reason to slow things
> down by having an extra layer of IO.
Yes, this is how I did it initially - by having a separate DB connection for
each thread. However, DBI would very frequently (but inconsistently) crash
the program. The program seemed vastly reduced if only one thread ever had
an open DB connection (but it still occasionally crashes out). This is why
I came up with the design of a separate DB handling thread in the first
place. Now, of course, if I'm using processes instead of threads, I can go
back to the old design of each process keeping it's own DB connection open.
I guess that this removes the problem of pipe size limitations, because URLs
are shorter than 4KB (or if they are not, something is badly wrong), and
the page data never needs to be piped. Having a separate process that
maintains the queue and the uniqueness hash also removes just about all
pipe size issues on that front.
I'll still need a small array in shared memory for status checking across
all processes. If all threads are waiting for a URL, then the queue is
empty and nothing is going to re-fill it, therefore, the task is complete.
But this is not a problem, as it only needs to be an array of N integers,
where N is the number of threads. I suppose I can live with copying that in
and out of shared memory every time a process finds it's time to sleep for
a few seconds while the queue size increases to something above 0. :-)
Thanks a lot.
Gordan
------------------------------
Date: Wed, 01 Jan 2003 21:55:22 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Direct Shared Memory Mapping?
Message-Id: <3E13AA1A.5704B2E6@earthlink.net>
Gordan wrote:
>
> Benjamin Goldberg wrote:
[snip]
> >> I follow. I think the pack template be Z, rather than N, seen as
> >> URLs are strings, rather than just network addresses.
> >
> > Err, the thing which was packed with N was the *lengths* of the
> > urls. The urls themselves were merely printed as is.
> >
> > Actually, doing:
> > print pack("N", length($url)), $url;
> > Is rather a lot like doing:
> > print pack("N/a*", $url);
> > But I think there's less data copying with the former than the
> > latter.
>
> Yup, I get it. I misread the code. It didn't click immediately that
> you used the [length][URL] format. For some reason I thought you used
> null terminated string sequences. My mistake.
Whenever I'm dealing with a situation where multiple processes read from
or write to a pipe, I use [length of str][str], rather than a [char]
terminated string. This is especially important if it's possible that
more than one process needs to read from the handle -- by prefixing the
string with it's length, I can simply read *exactly* as many bytes as
are necessary; If, instead, I used null (or newline, or space)
terminated strings, then there might, in some situations, be a chance
that I would read too much, and recieve a piece of data that 'belonged'
to some other process (one could avoid the chance of reading too much by
only sysread()ing one single byte at a time, but that's really
innefficient.)
> >> But yes, I understand what You mean. It is certainly more efficient
> >> than mucking around with the shared memory.
> >
> > Well, a hashred memory thing, if done really cleverly, and in XS,
> > could be made fairly efficient, but it would be *very* complicated.
> > Using pipes is far simpler.
>
> That's why I was trying very hard to avoid doing it in XS.
Oh, it's not because of the XS that it would be complicated -- it would
be that to do it "right", you would need to fully design a shared/mmaped
malloc arena of some sort. And *that* would be complicated.
The XS part itself would be relatively simple -- but necessary, since
you can't efficiently access shared memory from perl.
[snip]
> >> But I don't really see that as a problem, and I like the flock()
> >> approach on pipes. Is there a limit on the amount of data that can
> >> sit in a pipe waiting for reading, other than the amount of memory
> >> on the system?
> >
> > Sadly, yes, there is a limit to the amount of data which you can
> > have in a pipe unread. Trying to write more than this will cause
> > the writing process/thread to become blocked until data is read from
> > the reading end of the pipe.
>
> That is a big problem. The default pipe size in Linux equal to
> PAGE_SIZE (4KB). For efficient operation, I would need up to several
> MB.
If you can guarantee that there *will* be a reader, then you don't have
to worry. It's only when you've got more data going into the pipe than
being pulled out that there's a chance of blocking like this.
> > The solution to this is to have a dedicated process to act as the
> > queue; one pipe would be used to send extracted urls to this process
> > to be pushed on to the queue, and another to request a url to be
> > dequeued.
> >
> > This dedicated process could be combined with the one for doing the
> > uniqness checks.
>
> [code snipped]
>
> That sounds like a fairly elegant solution. One potential issue
> though. If an entry in the pipe is longer than 4KB, what happens?
If there's 4KB in the pipe, and the sender tries to write more, it
blocks until the reader reads.
> If the sender process starts writing and blocks, what happens when the
> reader process tries to flock the pipe before reading?
The reader process doesn't need to flock the pipe -- this is because
there's only one reader.
*If* the reader simply reads, rather than flocking the pipe to wait
until the writer completely finishes writing, then usually, the reader
will be reading at the same time as the writer is writing. Thus, the
pipe never fills up.
> While URLs are going to be shorter than the pipe size, this is likely
> to become an issue where the content of a whole page is pushed into a
> pipe for indexing.
For dealing with the contents of entire documents, it might not be quite
so efficient to use a pipe. Actually, I can't think of any kind of IPC
that would be *really* efficient for passing around BLOBs. This is why
I suggested that each worker process have it's own connection to the SQL
database -- that way, you don't need to send files around in pipes.
> Worker Process:
>
> flock ($DBIndexPipe, LOCK_EX);
> print $DB_Index_Pipe pack("Z", $PageContent);
> flock($DBIndexPipe, LOCK_UN);
>
> But if length(pack("Z", $PageContent)) > 4096, this will block until
> the pipe is read. Except it cannot be read until the lock is released.
Who says it can't be read until the lock is released?
[snip]
> I'll still need a small array in shared memory for status checking
> across all processes. If all threads are waiting for a URL, then the
> queue is empty and nothing is going to re-fill it, therefore, the task
> is complete. But this is not a problem, as it only needs to be an
> array of N integers, where N is the number of threads. I suppose I can
> live with copying that in and out of shared memory every time a
> process finds it's time to sleep for a few seconds while the queue
> size increases to something above 0. :-)
You don't *need* to have statuses -- it should be possible for the queue
process to keep track of how many worker processes are fetching things,
and include that in the response to requests.
--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);
------------------------------
Date: Thu, 2 Jan 2003 07:17:16 +0800
From: "Tan Chong Ming" <tancm@pacific.net.sg>
Subject: How to compile perl script into .exe file with a module
Message-Id: <auvsad$ip6$1@reader01.singnet.com.sg>
Hi !
I do have the Framework Net kid and Perl Development Kid loaded onto my
laptop.
After typing "plc getinfo.pl", a new file was created getinfo.exe.
Problem I have is I got this
error when I start to run (compilation is good).
D:\Perl>getinfo 100.100.100.1 ami ami test
System.ApplicationException: Can't locate type Net.Telnet
at PerlRuntime.Interpreter.GetType(Int32 x, String klass)
at PerlRuntime.Interpreter.ctor(Int32 x, Int32 klass_, Int32 args_,
Int32& e, Int32& rt)System.NullReferenceException: Object reference not set
to an
instance of an object.
I suspect taht my module Net.Telnet is having problem. How could I let
this Net.Telnet put into .exe file? I meant not to have error on this.
Thanks!
------------------------------
Date: Thu, 02 Jan 2003 01:02:17 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: how to load a module depending on 'if' condition ?
Message-Id: <4551328.33VRVOPuB0@nyoga.dubu.de>
Murat Ünalan wrote:
> if ( !$ENV{OSTYPE} eq 'linux' )
> {
Maybe Peter was not clear enough, but *this will not work*.
The negating '!' binds stronger than 'eq', so the line above is
equivalent to
if ( ( !$ENV{OSTYPE} ) eq 'linux' )
If $ENV{OSTYPE} is not evaluating to zero, !$ENV{OSTYPE} will become the
empty string, else it will be '1'. Both possible results will never be
equal to 'linux'.
If you want to negate the comparison, use the low-prio 'not', or compare
using 'ne' or just use "unless (... eq ...)".
Ciao,
Harald
--
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
I think there is a world market for maybe five computers.
-- Thomas Watson, chairman of IBM, 1943
------------------------------
Date: 1 Jan 2003 18:04:57 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: Literal and numeric declarations- are the same?
Message-Id: <776e0325.0301011804.59322f32@posting.google.com>
> It's more like a form of insecurity. Since it is sometimes necessary
> to put a literal in quotes, it may appear safe to put quotes around
> every literal. However, that keeps the compiler from detecting (early)
> when a non-number appears where number was meant, so it's actually
> slightly less safe. It is also, and foremost, distracting and irritating
> to a reader of the program, as you experience.
>
> Anno
Well put Anno, I think you're right, I'll start removing them. As you
say there are certain advantages to not having them there, most
importantly readabiity. In fact I find these same user LOVE quotes! I
find all sorts of cases like:
print "$x";
open F, "$file";
$y = "$x"."catmouse";
I also don't like it when they use "x" instead of 'x', which also
seems like a popular thing to do. I guess for simplicity using "x"
everywhere eliminates having to deal with two types of quotes, but I
like being able to spot "constant" expressions immediately without
having to scan the like for variables. Maybe that's just me.
Cheers,
G x
------------------------------
Date: Wed, 01 Jan 2003 22:35:55 +0000
From: James Tate <member@dbforums.com>
Subject: The diamond operator
Message-Id: <2338113.1041460555@dbforums.com>
Hello,
I have looked through perldoc.com and have read what the have about the
diamond operator. I'm currently reading /Learning Perl/ by O'Reilly
Publshing. I don't really understand their definition of using the
diamond operator. Does anyone have any links or information they can
give me to explain it?
An example they give me is:
> while (defined($line = <>)) {
> chomp($line);
> print "It was $line that I saw!\n";
> }
I don't really understand why the diamond operator is there in the
while loop...
Thank you. :)
--
Posted via http://dbforums.com
------------------------------
Date: Wed, 01 Jan 2003 19:23:14 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: The diamond operator
Message-Id: <3E138672.95D8DE5C@earthlink.net>
James Tate wrote:
>
> Hello,
>
> I have looked through perldoc.com and have read what the have about
> the diamond operator. I'm currently reading /Learning Perl/ by
> O'Reilly Publshing. I don't really understand their definition of
> using the diamond operator. Does anyone have any links or information
> they can give me to explain it?
The diamond operator is the same as the readline() builtin function.
> An example they give me is:
> > while (defined($line = <>)) {
> > chomp($line);
> > print "It was $line that I saw!\n";
> > }
>
> I don't really understand why the diamond operator is there in the
> while loop...
The diamond operator with no argument (that is, <>) is a syntactic
shortcut for <ARGV>. And keeping in mind that <> and readline() are the
same, this means that the above loop is the same as:
while( defined( $line = readline(*ARGV) ) ) {
chomp($line);
print "It was $line that I saw!\n";
}
It may be easier for you to understand this if it were rewritten as:
while( 'true' ) {
$line = readline(*ARGV);
last if not defined($line);
chomp($line);
print "It was $line that I saw!\n";
}
At this point, the meaning of the diamond operator itself should be
clear (especially if you've read perldoc -f readline).
The meaning of ARGV is explained in perldoc perlop, starting below the
text that says, "The null filehandle <> is special"
--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);
------------------------------
Date: Wed, 1 Jan 2003 18:23:13 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: The diamond operator
Message-Id: <slrnb171jh.khk.tadmc@magna.augustmail.com>
James Tate <member@dbforums.com> wrote:
> I have looked through perldoc.com and have read what the have about the
> diamond operator.
The same information regarding that special case of the
input operator is also already on your own hard disk you know.
> I'm currently reading /Learning Perl/ by O'Reilly
> Publshing.
I am familiar with that book. :-)
(but that is not the correct name of the publishing company.)
> I don't really understand their definition of using the
> diamond operator.
It is just a special case of the input operator.
> Does anyone have any links or information they can
> give me to explain it?
That depends on what aspect it is that you don't understand...
> An example they give me is:
>> while (defined($line = <>)) {
>> chomp($line);
>> print "It was $line that I saw!\n";
>> }
>
> I don't really understand why the diamond operator is there in the
> while loop...
It reads the next line of input, so the while loop can process the line.
I doubt that you didn't know that the input operator reads input,
so maybe you meant to ask some other question?
Perhaps you don't understand _where_ it will read the input from?
That depends on the contents of the @ARGV variable, as described
in "The Invocation Arguments" section in the Llama book.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 02 Jan 2003 03:09:55 +0000
From: James Tate <member@dbforums.com>
Subject: Re: The diamond operator
Message-Id: <2338525.1041476995@dbforums.com>
Ah, alright I got it now. Thanks! :-)
--
Posted via http://dbforums.com
------------------------------
Date: Thu, 02 Jan 2003 03:49:04 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: whats the syntax to get a scalar out an array of references.
Message-Id: <3E13B640.7010605@rochester.rr.com>
Darin McBride wrote:
> smasr wrote:
>
>
>>I try to read values out of a Lotus Notes Database. I read in the Lotus
>>
>
> I didn't realise there was a perl interface to LN. Where did you get this?
> I'd be somewhat curious as it could have saved me a lot of trouble at one
> point...
>
>
Lotus Notes for Windoze has an OLE interface. The following code (with
appropriate substitutions for server and database filename) demonstrates
a teensy bit of how to deal with it. Good luck finding docs:
use Win32::OLE;
use Data::Dumper;
$session=Win32::OLE->new('Notes.NotesSession') or die "Oops, $!\n";
print $session->UserName."\n";
$Count = Win32::OLE->EnumAllObjects(sub {
my $Object = shift;
my $Class = Win32::OLE->QueryObjectType($Object);
printf "# Object=%s Class=%s\n", $Object, $Class;
});
$db=$session->GetDatabase('servername','maildatabasename.nsf');
$db->OpenMail;
print "Title=".$db->Title.", Server=".$db->Server."\n";
$coll=$db->AllDocuments;
$count=$coll->Count;
print "Number of documents is $count.\n";
for $i (1..10,$count-9..$count){
$doc=$coll->GetNthDocument($i);
if(!$doc){print "GetNthDocument failed\n";}
$text=$doc->Body;
if(!$text){print "text is null\n";}
print "text:".Dumper($text)."\n";
}
undef $session;
--
Bob Walton
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 4332
***************************************