[17952] in Perl-Users-Digest
Perl-Users Digest, Issue: 112 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 21 18:05:57 2001
Date: Sun, 21 Jan 2001 15:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <980118313-v10-i112@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 21 Jan 2001 Volume: 10 Number: 112
Today's topics:
Re: $ problem (Tad McClellan)
-e file check question tzehua_tung@my-deja.com
A hash of arrays (HELP) <mbenson@mediaone.net>
Re: A hash of arrays (HELP) (Garry Williams)
re: DBI/Oracle why SPACE ? <peter@cgi-shop.dk>
Re: DBI/Oracle why SPACE ? <godzilla@stomp.stomp.tokyo>
Re: DBI/Oracle why SPACE ? (Garry Williams)
Re: DBI/Oracle why SPACE ? <godzilla@stomp.stomp.tokyo>
Re: Don't know how to reference array position from a f mintcake@my-deja.com
Re: Don't know how to reference array position from a f <godzilla@stomp.stomp.tokyo>
Enumeration through objects: <a565a87@my-deja.com>
input_record_separator error <apobull@my-deja.com>
Re: interesting regex? (Tad McClellan)
Re: Internal Server Error- Newbie Question. (David Efflandt)
Re: Internal Server Error- Newbie Question. <aplata@primus.ca>
Re: matching "*"? <j_graumann@hotmail.com>
Re: Perl in C (Mark Jason Dominus)
Re: Posting email from PERL to Outlook (Exchange)??? <a565a87@my-deja.com>
RegEx with Digits <whataman@home.com>
Re: RegEx with Digits (Garry Williams)
Re: RegEx with Digits (Damian James)
Re: Stupid question from a Newbie <mbenson@mediaone.net>
Re: Text::CSV related question <chrisw.NOSPAM@dynamite.com.au>
uploading files <ng@fnmail.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 21 Jan 2001 20:22:37 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: $ problem
Message-Id: <slrn96ma8e.gmu.tadmc@tadmc26.august.net>
jdf@pobox.com <jdf@pobox.com> wrote:
>"MaxyM" <marekpow@yahoo.com> writes:
>
>> Tnx to All!
>
>With the time he saved from not typing 'h', 'a', 'k', and 's', he will
>be able to implement a number of haks, undoubtedly.
Oh.
I thought he was saying that everybody should have that
theatre-quality sound system thingie...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 21 Jan 2001 21:18:14 GMT
From: tzehua_tung@my-deja.com
Subject: -e file check question
Message-Id: <94fjmg$2u0$1@nnrp1.deja.com>
Hi everyone,
I'm pretty new to this language, so please bare with my inexperience
here. I'm working on a Windows 2000 machine using ActivePerl.
Here I'm trying to create a script that basically goes through all the
subdirectories within a directory, and check for a file with a .dsc
extension:
#################################################
opendir(TEST,"/test") || die "no test?: $!";
while ($name = readdir(TEST)) {
if (-d $name) {
if (($name ne ".") && ($name ne "..")) {
print "$name\n";
if (-e </test/$name/*AAA>) {
print "\tAAA file found in $name\n";
}
else {
print "\tcould not find AAA file in $name\n";
}
}
}
}
closedir(TEST);
#################################################
And my directory structure has the following directories:
c:\test
c:\test\t1
c:\test\t2
c:\test\t3
and both the t2 and the t3 directories have a TEST.AAA file inside.
Here is what I get as my output...
t1
could not find AAA file in t1
t2
AAA file found in t2
t3
could not find AAA file in t3
It found the AAA file in t2, but can't find it in t3 for some reason?
Am I doing something wrong here? Please help.
Thanks and have a nice day.
Peter Tung
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sun, 21 Jan 2001 19:34:15 GMT
From: Michael Benson <mbenson@mediaone.net>
Subject: A hash of arrays (HELP)
Message-Id: <3A6B39A2.AC33E8D5@mediaone.net>
Hello,
I am trying to create a hash of arrays but am having the hardest time
making it work. Can anyone see a problem in the below code?
Any help will be greatly appreciated.
-Michael
#! /usr/local/bin/perl
$hash{abc}[0] = "this is line 1";
$hash{abc}[1] = "this is line 2";
$hash{bcd}[0] = "this is another line 1.";
print $hash{abc}[1];
exit(0);
------------------------------
Date: Sun, 21 Jan 2001 19:44:07 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: A hash of arrays (HELP)
Message-Id: <b_Ga6.5497$tg4.23460@eagle.america.net>
On Sun, 21 Jan 2001 19:34:15 GMT, Michael Benson
<mbenson@mediaone.net> wrote:
> I am trying to create a hash of arrays but am having the hardest time
>making it work. Can anyone see a problem in the below code?
^^^^^^^^^^^^^^
What do you mean by that?
>#! /usr/local/bin/perl
>
>$hash{abc}[0] = "this is line 1";
>$hash{abc}[1] = "this is line 2";
>$hash{bcd}[0] = "this is another line 1.";
>
>print $hash{abc}[1];
>
>exit(0);
Other than strictures and warnings not enabled, no. What's the
problem? What did you expect?
--
Garry Williams
------------------------------
Date: Sun, 21 Jan 2001 20:13:18 +0100
From: "Peter" <peter@cgi-shop.dk>
Subject: re: DBI/Oracle why SPACE ?
Message-Id: <94fcen$8jc$1@news.inet.tele.dk>
> PRINTED RESULTS:
> ________________
>
> Print Array Enclosed In Quotes:
>
> a b c
>
> Print Array Not Enclosed In Quotes:
>
> abc
Hi
You are right.... but in this (dbi-)case
if i do this:
while (@row=$sth->fetchrow_array())
{
print "Print Array Enclosed In Quotes:\n\n";
print "@row";
print "\n\nPrint Array Not Enclosed In Quotes:\n\n";
print @row;
}
I get this output (for each row):
Print Array Enclosed In Quotes:
f 1 f 2
Print Array Not Enclosed In Quotes:
f 1 f 2
--
Peter
------------------------------
Date: Sun, 21 Jan 2001 11:39:29 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: DBI/Oracle why SPACE ?
Message-Id: <3A6B3AF1.289203D8@stomp.stomp.tokyo>
Peter wrote:
> > Print Array Enclosed In Quotes:
> > a b c
> > Print Array Not Enclosed In Quotes:
> > abc
> You are right.... but in this (dbi-)case
> if i do this:
(snipped code results)
Logical extrapolation upon what I have
demonstrated will provide an answer.
You are simply looking at results and
not looking at what causes those results.
Godzilla!
--
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class
------------------------------
Date: Sun, 21 Jan 2001 21:03:25 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: DBI/Oracle why SPACE ?
Message-Id: <x8Ia6.5516$tg4.23024@eagle.america.net>
On Sun, 21 Jan 2001 20:13:18 +0100, Peter <peter@cgi-shop.dk> wrote:
>> PRINTED RESULTS:
>> ________________
>>
>> Print Array Enclosed In Quotes:
>>
>> a b c
>>
>> Print Array Not Enclosed In Quotes:
>>
>> abc
>
>You are right.... but in this (dbi-)case
>if i do this:
>
>while (@row=$sth->fetchrow_array())
>{
>print "Print Array Enclosed In Quotes:\n\n";
>print "@row";
>
>print "\n\nPrint Array Not Enclosed In Quotes:\n\n";
>print @row;
>}
>
>I get this output (for each row):
>
>Print Array Enclosed In Quotes:
>
> f 1 f 2
>
>Print Array Not Enclosed In Quotes:
>
> f 1 f 2
Then I conclude that the array contains two elements: `f 1 ' and `f
2'. (I assume the second element doesn't have a trailing unprintable
because it wasn't part of your post.)
Why don't you print each element with some delimiter to convince
yourself you know what's there? Or maybe something like
for (@row) {
printf +("%x " x length), map { ord } split //;
print "\n";
}
See ascii(5).
--
Garry Williams
------------------------------
Date: Sun, 21 Jan 2001 13:34:52 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: DBI/Oracle why SPACE ?
Message-Id: <3A6B55FC.E1A7CFF7@stomp.stomp.tokyo>
Garry Williams wrote:
> Peter wrote:
(significant snippage by various authors)
(Godzilla! wrote:)
> >> PRINTED RESULTS:
> >> Print Array Enclosed In Quotes:
> >> a b c
> >> Print Array Not Enclosed In Quotes:
> >> abc
> >You are right.... but in this (dbi-)case
> >if i do this:
> >while (@row=$sth->fetchrow_array())
> >{
> >print "Print Array Enclosed In Quotes:\n\n";
> >print "@row";
> >print "\n\nPrint Array Not Enclosed In Quotes:\n\n";
> >print @row;
> >}
> >I get this output (for each row):
> >Print Array Enclosed In Quotes:
> > f 1 f 2
> >Print Array Not Enclosed In Quotes:
> > f 1 f 2
> Then I conclude that the array contains two elements:
> `f 1 ' and `f 2'. (I assume the second element doesn't
> have a trailing unprintable because it wasn't part of your post.)
> Why don't you print each element with some delimiter to convince
> yourself you know what's there? Or maybe something like
(snipped)
Appears to be at least three data elements, likely four
with a controlled and clear print as you suggest to him.
Changing his print command from quote enclosure to no
quote enclosure eliminates the print command as the source
of printed spaces; they are data elements.
His initial article holds a self-contained answer:
> 1) When i try this:
> $sth->dump_results();
> I get this:
> '.f.1', '.f.2' '.f.1', '.f.2' '.f.1', '.f.2' '.f.1', '.f.2' 4 rows
> - Why is there dots between all characters ?
> 2) When i try this:
> while (@row=$sth->fetchrow_array())
> {
> print "@row";
> print " ok<br>";
}
> I get this:
> f 1 f 2 ok<br> f 1 f 2 ok<br> f 1 f 2 ok<br> f 1 f 2 ok<br>
> - Why is there space between all characters ?
There is a direct relationship between his printed periods
for his data dump and printed spaces for his print command.
Based on his data dump, it appears each data field holds
four elements:
(space)letter(space)number
This seems certain making a presumption his copy
and paste accurately shows all data elements.
My elimination of spaces introduced by print syntax
logically leads to a presumption his data includes
spaces and they are being printed as should be.
Your suggestion of having him do a clear and "visible"
print of all elements is good. I am sure a lightbulb
will turn on over his head, if not a flashing neon sign.
Godzilla!
------------------------------
Date: Sun, 21 Jan 2001 19:22:09 GMT
From: mintcake@my-deja.com
Subject: Re: Don't know how to reference array position from a foreach loop
Message-Id: <94fcsr$tgl$1@nnrp1.deja.com>
In article <94f6p4$ogs$1@nnrp1.deja.com>,
shiloam@pacbell.net wrote:
> If I have used a foreach loop like so:
>
> foreach $client (@ready) {
>
> ready[?]
>
> }
>
> How do I reference the current position that I am at in the array???
>
> Sorry for the newbie question, but I'm a newbie to perl.
>
> Steve Tilden
If I understand the question right - you can't. The variable $client
will be aliased to each of the array elements in turn (and you can
modify the array itself by modifying $client) but you cannot tell what
the offset in the array is that $client is an alias to at any given
time.
You could of course use a for loop...
for (my $i = 0; $i < @ready; $i++)
{
my $client = $ready[$i];
etc.
}
>
> Sent via Deja.com
> http://www.deja.com/
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sun, 21 Jan 2001 11:31:45 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Don't know how to reference array position from a foreach loop
Message-Id: <3A6B3921.6BFEFEAD@stomp.stomp.tokyo>
shiloam@pacbell.net wrote:
> If I have used a foreach loop like so:
> foreach $client (@ready) {
> ready[?]
> }
> How do I reference the current position that I am at in the array???
Within a foreach loop, each element is referenced
automatically by the foreach function, beginning
with element zero, the first element, and onward.
Keep in mind the first element is referenced as
element zero, not element one.
You don't have to reference an element under many
circumstances; it is referenced automatically. You
only need to include code for whatever is needed.
For other circumstances, you may wish to reference
a specific element by its array position. For my
test code below, second example, I referenced the
second element which is element number one.
There are times you might wish to access an element
individually without a foreach loop, shown by my
last example.
My test code shows only a few of many ways to access
elements of an array; they are very basic. You would
do yourself a service by reading about and learning
about both arrays and foreach loops. They are easy
with which to work, once you research and learn.
Godzilla!
--
TEST SCRIPT:
____________
#!/usr/local/bin/perl
print "Content-type: text/plain\n\n";
@Array = ("old element one", "old element two", "old element three");
print "Accessing Elements Automatically:\n\n";
foreach $element (@Array)
{ print "$element "; }
print "\n\nAccessing Elements By Counter:\n\n";
$counter = 0;
foreach $element (@Array)
{
if ($counter == 1)
{ $element = "new element two"; }
$counter++;
print "$element ";
}
print "\n\nAccessing Elements Individually:\n\n";
print $Array[1];
exit;
PRINTED RESULTS:
________________
Accessing Elements Automatically:
old element one old element two old element three
Accessing Elements By Counter:
old element one new element two old element three
Accessing Elements Individually:
new element two
------------------------------
Date: Sun, 21 Jan 2001 21:10:58 GMT
From: Rob <a565a87@my-deja.com>
Subject: Enumeration through objects:
Message-Id: <94fj8s$2hn$1@nnrp1.deja.com>
With the snip:
foreach $oMailItem(in $oFolder->Items)
{
$nCount += 1;
}
I'm attempting enumeration through a list of MS Outlook objects. In
order to even be able to get this far with this little stunt, I have
the Win32::OLE module.
However, upon arrival at that snip, the interpreter returns this:
Win32::OLE(0.1403): GetOleEnumObject() Not a Win32::OLE::Enum
object at c:/perl/site/5.6.0/lib/Win32/OLE/Lite.pm line 167.
Can't call method "Items" without a package or object referenec at
ExchangeTest.PL line 13.
I don't know how to respond to this. Do I need to install another
module of some sort? Transpose a module that I do have into a
different location within the perl directory? I don't know. The
following is line 167 from the Lite.PM, verbatim:
if (UNIVERSAL::isa($this, 'Win32::OLE')) {
So, what module am I missing if any? I know that the Win32::OLE module
that I installed yesterday works--I know this because I've created
instances of Outlook with it.
The equivalent test CDO code (which anyone here can run off of Excel if
they like) for this is:
Sub CountInboxMail()
Dim oApp, oNameSpace, oFolder, oMailItem As Object
Dim sMessage As String
Dim nCount As Integer
On Error Resume Next
Set oApp = CreateObject("Outlook.Application")
Set oNameSpace = oApp.GetNamespace("MAPI")
Set oFolder = oNameSpace.GetDefaultFolder(6)
For Each oMailItem In oFolder.Items
nCount = nCount + 1
Next oMailItem
MsgBox nCount
Set oFolder = Nothing
Set oNameSpace = Nothing
Set oApp = Nothing
End Sub
It's counterpart in perl would go like this:
use Win32::OLE;
eval {$oApp = Win32::OLE->GetActiveObject('Outlook.Application')};
die "Outlook not installed" if $@;
unless (defined $oApp)
{
$oApp = Win32::OLE->new('Outlook.Application', sub {$_[0]-
>Quit;}) or die "Oops, cannot start Outlook";
}
$oNameSpace = $oApp->GetNamespace("MAPI");
$oFolder = $oNameSpace->GetDefaultFolder(6);
foreach $oMailItem(in $oFolder->Items)
{
$nCount += 1;
}
undef $oFolder;
undef $oNameSpace;
undef $oApp;
I know this is more a perl than a Perl question, but I didn't where
alse to post it. Thank you for any help that you can provide.
-Rob
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sun, 21 Jan 2001 19:38:44 GMT
From: Bill Smith <apobull@my-deja.com>
Subject: input_record_separator error
Message-Id: <94fds4$u4o$1@nnrp1.deja.com>
Perl was recently upgraded here to V5.6 using the version from
www.perl.com. Since that upgrade, I have had several scripts return
the following error:
input_record_separator is not supported on a per-handle basis
at /opt/perl-5.6.0/site_lib/QIP.pl line 110
input_record_separator is not supported on a per-handle basis
at /opt/perl-5.6.0/site_lib/QIP.pl line 112
I have these scripts running via cron. These two lines repeat well
over 100 times in the "Output from cron message".
The code it's complaining about is below.
input_record_separator $fh ": ";
chomp($_ = ReadLine(1, $fh));
input_record_separator $fh "\n";
We consulted with a Perl person here who recommended the following code
instead of what's above:
$/ = ":"; and$/ = "\n"; The first bit of code to replace line 110's
contents and the other part for line 112.
I made this change but still continued to get the error. I've tried
figuring this out but to no avail. Any insight/advice that can be
given would be greatly appreciated. If necessary, I can post the
remaining contents of the offending script.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sun, 21 Jan 2001 20:22:36 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: interesting regex?
Message-Id: <slrn96ma60.gmu.tadmc@tadmc26.august.net>
amit_mathur@my-deja.com <amit_mathur@my-deja.com> wrote:
>Hi Tad, nobull:
Who is Tad and nobull?
Can't be anyone in this thread, or else there would be Message IDs
in the References header indicating which of Tad's and/or nobull's
messages you are referring to.
The only ID in References is the original post, so that is what
amit is following up to. No Tad there. No nobull there.
You should have said "Hi David" instead, he is the only other
person who's post you have made reference to.
Please don't break stuff like that. If you are following up to
an article, then the ID for that article should be in your
References header. That is what the References header is for.
>just being curious...
About what?
I do not see any question in your post.
>the following program seems to work...?!!
Is your question about whether the below works or not?
(yes for the data given, no for the general case)
Is your question about how the below could NOT work with
legal XML (it doesn't work with arbitrary XML you know...)
>#!/hm/amitk/bin/perl -w
>use strict;
>$_ = $test;
No need to copy it to a variable when you already _have_ it
in a variable...
>my @tags = m[<(\w+)>.*</\1>]sg;
my @tags = $test =~ m[<(\w+)>.*</\1>]sg;
That works for the data presented. I can think of several other
legal XML strings that would make it fail though.
(and the original cannot be XML either, you are not allowed to
have multiple "root" elements in XML.
)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 21 Jan 2001 20:26:11 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Internal Server Error- Newbie Question.
Message-Id: <slrn96mhea.a51.efflandt@efflandt.xnet.com>
On Sun, 21 Jan 2001 13:08:53 -0500, Andrew P <aplata@primus.ca> wrote:
> I am running apache server under Red Hat 6.2. At the moment I am receiving
>Error Msg 500: Internal Server
> Error while trying to run a perl script. I know the script works because
>when the Form Action points to another webserver it works fine.
Most likely is that either the shebang line has the wrong path to perl or
your shell thinks it is wrong because the script has been infected by
Windows (not found: perl is really not found: perl^M) because you
neglected to remove the carriage returns. Unix (Linux) just uses a
linefeed.
Since it is YOUR server, what do the apache access_log and error_log say?
But don't answer here if it is not a Perl question. Refer to the *.cgi
newsgroup and their FAQ for CGI questions or the *.www.servers.unix
newsgroup for apache questions after consulting apache docs.
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: Sun, 21 Jan 2001 16:30:19 -0500
From: "Andrew P" <aplata@primus.ca>
Subject: Re: Internal Server Error- Newbie Question.
Message-Id: <iBIa6.226$R15.30221372@news1.tor.primus.ca>
Thanks for responding David,
my error_logs said: premature end of script headers.
>your shell thinks it is wrong because the script has been infected by
Windows (not found: perl is really not found: perl^M) because you
neglected to remove the carriage returns. Unix (Linux) just uses a
linefeed.
Does this have something to do with the fact that I downloaded the script as
a binary file and not a ascii file?
How do I change it to linefeed?
Thanks,
Andrew P
"David Efflandt" <efflandt@xnet.com> wrote in message
news:slrn96mhea.a51.efflandt@efflandt.xnet.com...
> On Sun, 21 Jan 2001 13:08:53 -0500, Andrew P <aplata@primus.ca> wrote:
> > I am running apache server under Red Hat 6.2. At the moment I am
receiving
> >Error Msg 500: Internal Server
> > Error while trying to run a perl script. I know the script works because
> >when the Form Action points to another webserver it works fine.
>
> Most likely is that either the shebang line has the wrong path to perl or
> your shell thinks it is wrong because the script has been infected by
> Windows (not found: perl is really not found: perl^M) because you
> neglected to remove the carriage returns. Unix (Linux) just uses a
> linefeed.
>
> Since it is YOUR server, what do the apache access_log and error_log say?
>
> But don't answer here if it is not a Perl question. Refer to the *.cgi
> newsgroup and their FAQ for CGI questions or the *.www.servers.unix
> newsgroup for apache questions after consulting apache docs.
>
> --
> David Efflandt efflandt@xnet.com http://www.de-srv.com/
> http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
> http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: Sun, 21 Jan 2001 21:39:00 GMT
From: Johannes Graumann <j_graumann@hotmail.com>
Subject: Re: matching "*"?
Message-Id: <94fktk$3t0$1@nnrp1.deja.com>
Thanks for all the comments - those directly addressing my problem as
well as those showing me how to help myself! Exactly the right mixture
for someone new like me - great NG!
Johannes
In article <94d8ta$bug$1@nnrp1.deja.com>,
Johannes Graumann <j_graumann@hotmail.com> wrote:
> Hello,
>
> I'm trying to match a "*" at the end of a line. Since * is a
multiplier,
> something like /*^/ won't work.
>
> Please help the newbee!
>
> Thank you, Johannes
>
> Sent via Deja.com
> http://www.deja.com/
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sun, 21 Jan 2001 21:01:21 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Perl in C
Message-Id: <3a6b4e21.f31$3d5@news.op.net>
Keywords: cometary, continued, pretense, thug
[mailed and posted]
In article <Pine.OSF.4.21.0101202039180.27544-100000@ece.wpi.edu>,
Emrah Diril <ediril@ece.wpi.edu> wrote:
>I want to use some Perl functions that I wrote in C. I looked at the
>documentation at perl.com (How to embed perl in your C program), but
>it is not helpful to me because I am trying to use Borland Turbo C to
>compile my programs.
That's the wrong man paghe. 'perlembed', which you read is when you
have a large C program that needs to have a Perl interpreter built
into it so that it understandfs Perl. Your situation is the other
way around: You have a few functions in C that you want to put
into Perl. For this, I recommend that you look at the 'Inline' module
by Brian Ingerson. Try:
http://search.cpan.org/search?dist=Inline
If that doesn't work, then the manuals you need to read are
'perlxstut' and 'perlxs'.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Sun, 21 Jan 2001 21:15:29 GMT
From: Rob <a565a87@my-deja.com>
Subject: Re: Posting email from PERL to Outlook (Exchange)???
Message-Id: <94fjhb$2s6$1@nnrp1.deja.com>
The first part of your question (the part about counting stuff in the
Inbox) can be accomplished with this, I think, if you have the proper
modules installed:
use Win32::OLE;
eval {$oApp = Win32::OLE->GetActiveObject('Outlook.Application')};
die "Outlook not installed" if $@;
unless (defined $oApp)
{
$oApp = Win32::OLE->new('Outlook.Application', sub {$_[0]-
>Quit;}) or die "Oops, cannot start Outlook";
}
$oNameSpace = $oApp->GetNamespace("MAPI");
$oFolder = $oNameSpace->GetDefaultFolder(6);
foreach $oMailItem(in $oFolder->Items)
{
$nCount += 1;
}
undef $oFolder;
undef $oNameSpace;
undef $oApp;
As for what constitutes "proper modules," I've posted a question to
this forum under separate cover. (If you know how to configure the
OLE::Enum aspect of the perl environment for Win32, please tell me.)
-Rob
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sun, 21 Jan 2001 22:24:39 GMT
From: "What A Man !" <whataman@home.com>
Subject: RegEx with Digits
Message-Id: <3A6B6211.D95ABAEF@home.com>
I can't figure this out from perlre or the regex part of
the Perl FAQ. How do I match a filename that consists of
only 4 digits, i.e., 1947, 9777, or 0300? I don't know
what the digits will be ahead of time. All I know is that
they will all have 4 digits.
Thank You,
Dennis
------------------------------
Date: Sun, 21 Jan 2001 22:40:19 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: RegEx with Digits
Message-Id: <nzJa6.5532$tg4.24591@eagle.america.net>
On Sun, 21 Jan 2001 22:24:39 GMT, What A Man ! <whataman@home.com> wrote:
>I can't figure this out from perlre or the regex part of
>the Perl FAQ. How do I match a filename that consists of
>only 4 digits, i.e., 1947, 9777, or 0300? I don't know
>what the digits will be ahead of time. All I know is that
>they will all have 4 digits.
From the perlre manual page:
In particular the following metacharacters have their
standard egrep-ish meanings:
\ Quote the next metacharacter
--> ^ Match the beginning of the line
. Match any character (except newline)
--> $ Match the end of the line (or before newline at the end)
| Alternation
() Grouping
[] Character class
...
The following standard quantifiers are recognized:
* Match 0 or more times
+ Match 1 or more times
? Match 1 or 0 times
--> {n} Match exactly n times
{n,} Match at least n times
{n,m} Match at least n but not more than m times
...
In addition, Perl defines the following:
\w Match a "word" character (alphanumeric plus "_")
\W Match a non-word character
\s Match a whitespace character
\S Match a non-whitespace character
--> \d Match a digit character
\D Match a non-digit character
\pP Match P, named property. Use \p{Prop} for longer names.
\PP Match non-P
\X Match eXtended Unicode "combining character sequence",
equivalent to C<(?:\PM\pM*)>
\C Match a single C char (octet) even under utf8.
So you want to match the following pattern:
m/
^ # Match the beginning of the string
\d # Match any digit
{4} # ... occurring exactly 4 times
$ # Match the end of the string
/x
Which will compile, but you can be less verbose with /^\d{4}$/ .
--
Garry Williams
------------------------------
Date: 21 Jan 2001 22:40:32 GMT
From: damian@puma.qimr.edu.au (Damian James)
Subject: Re: RegEx with Digits
Message-Id: <slrn96mpc7.16b.damian@puma.qimr.edu.au>
Thus spake What A Man ! on Sun, 21 Jan 2001 22:24:39 GMT:
>I can't figure this out from perlre or the regex part of
>the Perl FAQ.
Are you sure -- did you look at the part that deals with 'special
characters' in regexs (in perlre under "In addition, Perl defines the
following")? And quantifiers?
>How do I match a filename that consists of
>only 4 digits, i.e., 1947, 9777, or 0300? I don't know
>what the digits will be ahead of time. All I know is that
>they will all have 4 digits.
>
How about
/^\d{4}$/;
HTH
Cheers,
Damian
------------------------------
Date: Sun, 21 Jan 2001 19:31:15 GMT
From: Michael Benson <mbenson@mediaone.net>
Subject: Re: Stupid question from a Newbie
Message-Id: <3A6B38EA.D7AC9DB6@mediaone.net>
Tom, your going to laugh when you see this. Just change the line <FORM
METHOD="POST"> to <FORM METHOD="GET">. The browser is trying to send
information to a page that can't accept posted information. Using the get
method, you will be telling the browser to retrieve the page, attaching any
form data to the Query String, allowable for html pages.
I hope this is helpful,
Michael Benson, Webmaster Virtual Weston:
www.weston.org
Tom Gregory wrote:
> I am just learning Perl and have tons of questions. The one in particular
> has to do with the "project" that started me trying to learn it.
>
> Being new, you folks let me know if I'm doing something wrong or whatever.
>
> I have a website and am trying to modify Redicart (a free shopping cart) to
> simply display an HTML page when the user finishes their selection, instead
> of going to a secure server. But I keep getting a 405 error when I try to
> do it the way I'm attempting. Here's what's in the script that actually
> executes
> :
> print "<FORM METHOD='POST'
> ACTION='https://secure.paymentclearing.com/cgi-bin/mas/split.cgi'>";
>
> Here's what I'm trying to get it to do:
>
> print "<FORM METHOD='POST'
> ACTION='http://www.agilityzone.com/confirm.htm'>";
>
> I know the original is executing another cgi script and returning values,
> but what am I missing here?
>
> I simply want it to display a page of the user's selections with a text
> statement for them to print the page, and then have it email me a copy of
> the order. Should be simple and in 'C' I could figure it out (maybe... been
> a while). But the answer has eluded me.
>
> Any help is appreciated. Please Email me directly, if you would.
>
> Thanks
>
> Tom
> agile3@bellsouth.net
------------------------------
Date: Mon, 22 Jan 2001 10:00:07 +1100
From: "Chris W" <chrisw.NOSPAM@dynamite.com.au>
Subject: Re: Text::CSV related question
Message-Id: <ZSJa6.16$nw1.1804@news0.optus.net.au>
The question was?
------------------------------
Date: Sun, 21 Jan 2001 16:38:40 -0600
From: "Enrico Ng" <ng@fnmail.com>
Subject: uploading files
Message-Id: <94fodi$3ck$1@newsx.cc.uic.edu>
I know how to write files using open, print, close
and how to upload files <form type=file
but how to I write the perl code to get the file
--
Enrico Ng <ng@fnmail.com>
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 112
**************************************