[21849] in Perl-Users-Digest
Perl-Users Digest, Issue: 4053 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 31 18:05:55 2002
Date: Thu, 31 Oct 2002 15:05:09 -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 Thu, 31 Oct 2002 Volume: 10 Number: 4053
Today's topics:
Re: [OT] Re: Open a HTML page not using redirect <jim@remove.deadgoodsolutions.com>
Re: [OT] Re: Open a HTML page not using redirect (Tad McClellan)
File truncating script <bob@bobber.com>
Re: format of .db.pag file ? <mike_constant@yahoo.com>
Re: format of .db.pag file ? <goldbb2@earthlink.net>
Re: format of .db.pag file ? <jim.bloggs@eudoramail.com>
free GUI debugger for perl (eddie wang)
Re: How can I check STDIN in a fork or a child's vari <mike_constant@yahoo.com>
Re: How can I check STDIN in a fork or a child's vari <goldbb2@earthlink.net>
LWP & Sending Headers (Shelby)
Problem with NEXT::ACTUAL <heather710101@yahoo.com>
regexp question (Alex Gittens)
Re: regexp question <pinyaj@rpi.edu>
Re: regexp question <rgarciasuarez@free.fr>
Re: regexp question <robert.bunney@hotmail.com>
Re: sub procedure question <rgarciasuarez@free.fr>
Re: telnet in perl <nospam@nospam.org>
Re: Terminating regex with space or end of line <goldbb2@earthlink.net>
Re: UTF-8 translation? <ekulis@apple.com>
Re: UTF-8 translation? <ekulis@apple.com>
Re: Writing Microsoft Outlook Notes With Perl -- FINISH (Chris)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 31 Oct 2002 19:47:02 -0000
From: "jimbo" <jim@remove.deadgoodsolutions.com>
Subject: Re: [OT] Re: Open a HTML page not using redirect
Message-Id: <1036093622.65232.0@iapetus.uk.clara.net>
wow chill out a bit dude! There's little point in replying if you can't add
something constructive.
I think he has a valid question, it just that like a lot of posts here they
are not strictly perl. And where did all the German stuff come from?
"Brian McCauley" <nobull@mail.com> wrote in message
news:u9n0oufpaj.fsf@wcl-l.bham.ac.uk...
> "ee ee" <ee@ee.ee> writes upside down:
>
> > I disagree that it's nothing to do with Perl
>
> Disagreeing with obviously true statements is a pointless exercise.
>
> > i'm trying to control HTML from within Perl using the Perl commands,
>
> And if you were trying to output gramatically/idomatically correct
> German would questions about German grammar and idiom become
> "something to do with Perl"?
>
> > ok there is an element of HTML in there but you guys seem to have
> > the broadest knowledge
>
> And a lot of the people who post here are fluent (or even native)
> speakers of German - but that does not make it acceptable to come here
> to ask questions about German!
>
> Occasionally you'll find that quite often the odd thread here does
> digress into discussion of HTML, German or netiquette but none of
> these are actually related to Perl.
>
> > "Jeff Zucker" <jeff@vpservices.com> wrote in message
> > news:3DC0647E.90702@vpservices.com...
> > >
> > > But since this has nothing to do with perl, why don't we just drop it.
>
> Please do so.
>
> --
> \\ ( )
> . _\\__[oo
> .__/ \\ /\@
> . l___\\
> # ll l\\
> ###LL LL\\
------------------------------
Date: Thu, 31 Oct 2002 16:59:13 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: [OT] Re: Open a HTML page not using redirect
Message-Id: <slrnas3de1.37l.tadmc@magna.augustmail.com>
[ please don't post TOFU.
text rearranged, but with multiple top-posters in this thread,
the attributions are still befuddled, I think.
]
jimbo <jim@remove.deadgoodsolutions.com> wrote:
> "Brian McCauley" <nobull@mail.com> wrote in message
> news:u9n0oufpaj.fsf@wcl-l.bham.ac.uk...
>> "ee ee" <ee@ee.ee> writes upside down:
>>
>> > I disagree that it's nothing to do with Perl
>>
>> Disagreeing with obviously true statements is a pointless exercise.
>>
>> > i'm trying to control HTML from within Perl using the Perl commands,
>> > "Jeff Zucker" <jeff@vpservices.com> wrote in message
>> > news:3DC0647E.90702@vpservices.com...
>> > >
>> > > But since this has nothing to do with perl, why don't we just drop it.
>>
>> Please do so.
> There's little point in replying if you can't add
> something constructive.
I assume then, that you would not do that yourself.
I'm failing to see what is constructive in _your_ reply. Please
try explaining it some more.
> I think he has a valid question,
^^^^^
The issue is not whether or not the question is valid.
The issue is if it is a question _about_ Perl. (it is not)
ee's question was about browser behavior. If you write your
CGI program in Java instead of Perl, would the browser's
behavior be different?
No.
It cannot be a question about the programming language if the
answer is the same regardless of programming language.
Browsers just react to whatever output the CGI program makes.
_What_ output to make is not dependent on the programming language
you've chosen.
_How_ to output it _is_ specific to the language used though, so
Q: How do I make output with Perl?
A: use the print() function.
covers the Perl aspect of ee's question.
ee has the cart before the horse. He wants to write a program
but he doesn't know what the program must do!
To find out about browser behavior, you should be looking in
browser related places, such as the comp.infosystems.www.*
newsgroups.
Once you know what output you need to make, _then_ you are
ready to turn your attention to writing a program that
will make that output.
> it just that like a lot of posts here they
> are not strictly perl.
Brian already said that. Repeating it is not constructive.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 31 Oct 2002 19:16:12 GMT
From: Bob <bob@bobber.com>
Subject: File truncating script
Message-Id: <3DC1817B.60006@bobber.com>
Hello,
I wrote a script that trims a file to a certain size by chopping off
lines from the beginning of the file. This is specifically for log files.
I need it because our apache logs are growing huge, and we have
webtrends installed. The powers that be want to keep roughly 2 months
of stats always in the logs, so this was one way I thought of to
accomodate this. I thought also of using logrotate ( Im on a redhat 7.1
box), but rotating out an entire log file loses the 2 month minimum.
The script works, but it seems a bit slow when processing large files.
Im not sure this can be improved too much, but if someone could tell me
in what way I can optimize the code or give a general critique that
would be great.
Thanks!
B
#!/usr/bin/perl -w
use strict;
my $usage = "Useage: cutlog.pl <filename> <desired size> <M b k>\n".
"M = megabytes, k = kilobytes, b = bytes\n\n";
if ( @ARGV < 3 ) {
print $usage;
} else {
my ( $file, $size, $unit ) = @ARGV;
my @data = split(" ", `/usr/bin/wc -cl $file` );
my ( $lines, $bytes ) = @data;
my ( $trimfile, $filesize );
if ( $unit eq "M" || $unit eq "k" || $unit eq "b" ) {
my $entered_size = $size;
$unit eq "M" ? $size = $size * 1024000
: $size = $size * 1024;
if ( $bytes < $size ) {
if( $unit eq "b" ) {
print "$file is already less than $entered_size bytes ($bytes
bytes)\n\n";
} else {
$unit eq "M" ? $filesize = $bytes/1024000
: $filesize = $bytes/1024;
print "$file is already less than $entered_size Kb ($filesize
Kb)\n\n";
}
} else {
my $count = 0;
my $linestocut = $lines - int( ($size/( $bytes/$lines)) + .5 );
open( IN, "< $file" );
while ( <IN> ) {
if ( $count >= $linestocut ) {
$trimfile .= $_ if $. >= 0;
}
$count++;
}
close( IN );
open( OUT, "> $file" );
print OUT $trimfile;
close( OUT );
}
} else {
print $usage;
}
}
------------------------------
Date: Thu, 31 Oct 2002 13:42:53 -0800
From: "Newbie" <mike_constant@yahoo.com>
Subject: Re: format of .db.pag file ?
Message-Id: <aps83u$4hlqf$1@ID-161864.news.dfncis.de>
"doofus" <jim.bloggs@eudoramail.com> wrote in message
news:aprp5m$4emsf$1@ID-150435.news.dfncis.de...
Can anyone shed any light on the likely format of databe files whose
extensions are .db.pag and .db.dir.
I know dbm.pag etc are DBM. But what about those ones.
These are SDBM_File files. A wild guess is that .pag contains data and .dir
holds an index tree.
--
Sorry if this has been posted in the wrong place. Just thought someone might
know offhand
Best Wishes,
Lord Doofus
------------------------------
Date: Thu, 31 Oct 2002 16:57:17 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: format of .db.pag file ?
Message-Id: <3DC1A73D.6D24BB71@earthlink.net>
doofus wrote:
>
> Can anyone shed any light on the likely format of databe files whose
> extensions are .db.pag and .db.dir.
> I know dbm.pag etc are DBM. But what about those ones.
The .pag and .dir extentions are of files created by SDBM. I'm sure
that you can use google to find out more... or, since sdbm comes with
perl, you could download perl's source, and read the source of sdbm.
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Thu, 31 Oct 2002 22:50:09 -0000
From: "doofus" <jim.bloggs@eudoramail.com>
Subject: Re: format of .db.pag file ?
Message-Id: <apsc34$4dc74$1@ID-150435.news.dfncis.de>
Benjamin Goldberg wrote:
> doofus wrote:
>>=20
>> Can anyone shed any light on the likely format of databe files whose
>> extensions are .db.pag and .db.dir.
>> I know dbm.pag etc are DBM. But what about those ones.
>=20
> The .pag and .dir extentions are of files created by SDBM. I'm sure
> that you can use google to find out more... or, since sdbm comes with
> perl, you could download perl's source, and read the source of sdbm.
Thanks! to both Benjamin and Newbie. That's excellent. I was sure =
someone would know.
:-)
--
doofus
------------------------------
Date: 31 Oct 2002 12:55:34 -0800
From: eddiekwang@hotmail.com (eddie wang)
Subject: free GUI debugger for perl
Message-Id: <879e0e64.0210311255.7706d45@posting.google.com>
Hi, everyone.
what are my options if i want to get a free GUI debugger for perl? is
avaiable for both Windows and Unix?
thank you in advance!
eddy
------------------------------
Date: Thu, 31 Oct 2002 12:07:19 -0800
From: "Newbie" <mike_constant@yahoo.com>
Subject: Re: How can I check STDIN in a fork or a child's variables in a parent?
Message-Id: <aps2gp$4kk6k$1@ID-161864.news.dfncis.de>
"David E. Shapiro" <david.shapiro@bti.com> wrote in message
news:2c75e852.0210311006.b6725ae@posting.google.com...
Use select to timeout like this:
#!/usr/bin/perl -w
# pipe1 - bidirectional communication using two pipe pairs
# designed for the socketpair-challenged
use IO::Handle;
pipe(READER,WRITER);
my $response = undef;
# Parent
my $pid = undef;
defined($pid = fork) or die "cannot fork: $!\n";
if ($pid) {
my $line = "";
close WRITER;
for (my $count = 1; $count < 8; $count++) {
if (defined(READER)) {
chomp($line = <READER>);
print "Parent just read this `$line'\n";
if ($line =~ /N|Y/i) {
$response = $line;
last;
}
} else {
print "Parent didn't see anything from child\n";
}
sleep 3;
}
unless (defined $response) {
kill 9,$pid;
} else {
print "Saw response: $response\n";
}
} else {
close READER;
my $count = 0;
ASK:
print "Do another Tape (y/n):\n";
my $rbit = "";
vec($rbit, fileno(STDIN), 1) = 1;
if (!select($rbit, undef, undef, 5)) { # <= timeout after 5
seconds
print STDERR "Reply is timed out after 5 seconds\n";
exit 1;
}
my $response = <STDIN>;
print WRITER $response;
if ($response !~ /Y|N/i and $count < 3) {
$count++;
goto ASK;
}
exit;
}
------------------------------
Date: Thu, 31 Oct 2002 17:31:34 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: How can I check STDIN in a fork or a child's variables in a parent?
Message-Id: <3DC1AF46.8EC11807@earthlink.net>
David E. Shapiro wrote:
>
> Hello,
>
> I have a program that waits for a user to enter something. However, I
> need it to timeout after awhile if they do not select an option.
[snip]
> ASK:
> print "Do another Tape (y/n):\n";
> my $response = <STDIN>;
> print WRITER $response;
> if ($response !~ /Y|N/i and $count < 3) {
> $count++;
> goto ASK;
> }
> exit;
> }
>
> Instead of looping in the parent and checking if something in in the
> READER, it stops dead until the user types something. I would be
> happy enough just to check if $response had something in the parent,
> but the parent does not know about the child's $response. It seems
> simple, but I am going coco trying to figure this out. There are a
> lot too simple examples on forks out there. I have not found one that
> shows what I want to do.
You don't need fork for this -- it's completely irrelevant.
What you want is a timeout ... so, write code that does a timeout.
sub ask_question {
my ($question, $timeout) = @_;
$timeout ||= 10;
my $sel = IO::Select->new(\*STDIN);
my $count = 0;
while(1) {
ASK: {
{ local $| = 1; print $question }
if( $::buffer =~ s/^(y|n)?(.*)\n//i ) {
return lc($1) if $1;
return undef if ++$count == 3;
redo ASK;
}
}
() = $sel->can_read($timeout) or return undef;
sysread( STDIN, $::buffer, 8192, length $::buffer )
or die "sysread failed: $!";
}
}
my $tape = ask_question("Do another Tape (y/n):");
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: 31 Oct 2002 13:57:36 -0800
From: webmaster@smwebdesigns.com (Shelby)
Subject: LWP & Sending Headers
Message-Id: <ed11fbd8.0210311357.54206878@posting.google.com>
use LWP::Simple;
$doc = get $url;
print "Content-type: text/html\n\n";
print "$doc";
exit;
The code above is what I've been using to send information to a
shopping cart script so that if the user exits the browser while the
credit card authorization is still going on the order will still take
place.
In short I am needing to be able to send the customers IP address in
the header instead of my server's IP. Is there an extension of
LWP::COMMON where I can specify the header information so it looks
like the user is requesting the page rather than my script? Any and
all help is greatly appreciated.
Thanks
Shelby
webmaster@smwebdesigns.com
------------------------------
Date: Thu, 31 Oct 2002 22:56:33 +0000 (UTC)
From: Da Witch <heather710101@yahoo.com>
Subject: Problem with NEXT::ACTUAL
Message-Id: <apscf1$gta$1@reader1.panix.com>
According to the docs for NEXT.pm, if one wants method dispatch to
generate an error when a suitable method is not found, one is supposed
to use NEXT::ACTUAL. But, as the example below shows, no error is
actually generated:
use strict;
use warnings;
package Foo;
use NEXT;
sub new { bless {}, 'Foo' }
sub AUTOLOAD { (shift)->NEXT::ACTUAL::AUTOLOAD(@_); }
package main;
my $f = Foo->new();
$f->bar(); # should trigger an error but doesn't
Foo->baz(); # ditto
__END__
Am I doing something wrong, or is this a bug in NEXT? Any ideas on
how to coax NEXT::ACTUAL into doing the right thing?
Thanks!
hk
------------------------------
Date: 31 Oct 2002 12:56:54 -0800
From: alex@gittens.net (Alex Gittens)
Subject: regexp question
Message-Id: <334e5e55.0210311256.22a680cb@posting.google.com>
This probably isn't that hard, but it is beyond me right now... I am
trying to add a 'www.' to a url if it isn't already there. Here is the
regexp I'm currently using:
s{http://([^w][^w]?[^w]?[^.]?.*)}{http://www.\1};
It doesn't match url's like http://walkingdead.net however. The only
changes I can thing of making make it fail for urls like
http://aaa.org. Can anyone suggest a better regexp?
------------------------------
Date: Thu, 31 Oct 2002 16:11:28 -0500
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
To: Alex Gittens <alex@gittens.net>
Subject: Re: regexp question
Message-Id: <Pine.SGI.3.96.1021031161047.64086B-100000@vcmr-64.server.rpi.edu>
[posted & mailed]
On 31 Oct 2002, Alex Gittens wrote:
>This probably isn't that hard, but it is beyond me right now... I am
>trying to add a 'www.' to a url if it isn't already there. Here is the
>regexp I'm currently using:
>
>s{http://([^w][^w]?[^w]?[^.]?.*)}{http://www.\1};
You want a negative look-ahead:
s{http://(?!www\.)}{http://www.};
The (?!www\.) means "that is not followed by 'www.'".
--
Jeff "japhy" Pinyan RPI Acacia Brother #734 2002 Acacia Senior Dean
"And I vos head of Gestapo for ten | Michael Palin (as Heinrich Bimmler)
years. Ah! Five years! Nein! No! | in: The North Minehead Bye-Election
Oh. Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)
------------------------------
Date: 31 Oct 2002 21:15:43 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: regexp question
Message-Id: <slrnas37c7.r3.rgarciasuarez@rafael.example.com>
Alex Gittens wrote in comp.lang.perl.misc :
> This probably isn't that hard, but it is beyond me right now... I am
> trying to add a 'www.' to a url if it isn't already there. Here is the
> regexp I'm currently using:
>
> s{http://([^w][^w]?[^w]?[^.]?.*)}{http://www.\1};
You might want to look at the regexp assertions in the perlre manpage.
s{^http://(?!www\.)}{http://www.$1};
(and don't use \1 in the right side of s/// BTW)
> It doesn't match url's like http://walkingdead.net however. The only
> changes I can thing of making make it fail for urls like
> http://aaa.org. Can anyone suggest a better regexp?
--
Grepping the source is good for the soul. -- the perldebguts manpage
------------------------------
Date: Thu, 31 Oct 2002 22:45:48 GMT
From: "robertbu" <robert.bunney@hotmail.com>
Subject: Re: regexp question
Message-Id: <woiw9.41870$iV1.40752@nwrddc02.gnilink.net>
I don't know if you care for your use of
the code, but I occassionally see a
www2 address like
http://www2.edc.org/NCIP/Default.htm
and the regular expressions so far would
would result in a mangled address.
This RE fixes this specific problem, but there
may be others valid addresses that
get mangled.
/(http:\/\/)(?!www[2]?\.)(.*)/
== Rob ==
ex@gittens.net> wrote in message
news:334e5e55.0210311256.22a680cb@posting.google.com...
> This probably isn't that hard, but it is beyond me right now... I am
> trying to add a 'www.' to a url if it isn't already there. Here is the
> regexp I'm currently using:
>
> s{http://([^w][^w]?[^w]?[^.]?.*)}{http://www.\1};
>
> It doesn't match url's like http://walkingdead.net however. The only
> changes I can thing of making make it fail for urls like
> http://aaa.org. Can anyone suggest a better regexp?
------------------------------
Date: 31 Oct 2002 21:15:42 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: sub procedure question
Message-Id: <slrnas373g.r3.rgarciasuarez@rafael.example.com>
Daniel Mueller wrote in comp.lang.perl.misc :
> sub parse {
>
> my ($datarecord, $column) = @_;
> my $line = "";
> my @text = (0);
> my $counter = 0;
> my $counter2;
> my @output = (0);
>
> sub readdata { # for removing the quotes
You shouldn't declare a subroutine from the inside another subroutine,
unless you _really_ know what's you're doing.
If you had enabled warnings on your program (always do when developing),
Perl you have told you that $line was not going to "stay shared" (lookup
this warning in the perldiag manpage), which produces exactly the
behavior you don't want.
Move readdata in the outer scope.
--
Q: How many extreme programmers does it take to change a lightbulb?
A: Two (Firstly to write the regression tests, then to declare that it's a
hardware problem) -- Nicholas Clark in p5p
------------------------------
Date: Thu, 31 Oct 2002 13:40:04 -0500
From: "Christian Caron" <nospam@nospam.org>
Subject: Re: telnet in perl
Message-Id: <aprte4$m4k3@nrn2.NRCan.gc.ca>
"ZZT" <a@b.c> wrote in message news:aprs5f$1ij$1@news1.wdf.sap-ag.de...
> Hello,
>
> how can I simulate a telnet session to a specific port in perl and get
> the "console" responce back to a variable/array, send keys etc. simple
> as possible?
>
> thanks a lot
>
You can use Net::Telnet
You'll find documentation on www.cpan.org (search for Net::Telnet
documentation).
Christian
------------------------------
Date: Thu, 31 Oct 2002 16:55:44 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Terminating regex with space or end of line
Message-Id: <3DC1A6E0.C2A3DADD@earthlink.net>
Simon Andrews wrote:
[snip]
> my $string = "bob bog bos";
>
> $string =~ s/bo[bgs]([\s\$])/done$1/g;
>
> print $string;
>
> # Want to get "done done done"
Try one of these:
$string =~ s/bo[bgs](\s|$)/done$1/g;
$string =~ s/bo[bgs](?!\S)/done/g;
$string =~ s/bo[bgs](?=\s|$)/done/g;
$string =~ s/bo[bgs]\b/done/g;
Note that the fourth one has a slightly different meaning than the first
three, but it has the same effect on your sample data. Personally, I
would go with the (?!\S) or \b versions. Well, actually, I'd probably
go with:
$string =~ s/\bbo[bgs]\b/done/g;
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Thu, 31 Oct 2002 14:20:49 -0800
From: Ed Kulis <ekulis@apple.com>
Subject: Re: UTF-8 translation?
Message-Id: <B9E6ECC1.4526%ekulis@apple.com>
On 10/31/02 2:39 AM, in article
slrnas21v6.rma.bernard.el-hagin@gdndev25.lido-tech, "Bernard El-Hagin"
<bernard.el-hagin@DODGE_THISlido-tech.net> wrote:
> In article <3dc1031d.1321572310@news.cis.dfn.de>, Helgi Briem wrote:
>> On 31 Oct 2002 04:10:02 GMT, gorilla@elaine.furryape.com
>> (Alan Barclay) wrote:
>>
>>> In article <B9E5B191.40C1%ekulis@apple.com>,
>>> Ed Kulis <ekulis@apple.com> wrote:
>>>> In perl, (and of course being perl it's not too hard at all) I'm writing a
>>>> translator that will take multi-octet characters like an umlated-o and turn
>>>> it into a safe corresponding character like plain-old-lower-case-o.
>>>
>>> Are you going to translate the 'u's to 'v's, the 'i's to 'j's and the
>>> '1's to 'l's too?
>>>
>>> Accented characters aren't 'plan-old' characters with extra ink. They
>>> are different letters. By removing the accent you are corrupting the
>>> word.
Yikes! I really do apologise for the "plain old" description. I'm just an
unaware American :-o
We've got to do something because our business here requires for instance
that something go on an address label
"Ms. Ångström Çedilla Ümlaut"
won't travel through our some of our interface transport engines so I'm
proposing that the best I can do for those interfaces is
"Ms. Angstrom Cedilla Umlaut"
>>
>> To a pedant, yes. In the real world, no. We Icelanders use
>> a lot of accented and special letters and we routinely
>> replace them with the plain ASCII equivalent when
>> corresponding with foreigners. To my certain knowledge,
>> Germans and Swedes do the same.
>
>
> As do Poles.
>
Glad to hear it!
>
> Cheers,
> Bernard
> --
> echo 42|perl -pe '$#="Just another Perl hacker,"'
------------------------------
Date: Thu, 31 Oct 2002 14:28:04 -0800
From: Ed Kulis <ekulis@apple.com>
Subject: Re: UTF-8 translation?
Message-Id: <B9E6EE74.452A%ekulis@apple.com>
On 10/30/02 10:34 PM, in article s94w9.49351$wm6.9978@nwrddc01.gnilink.net,
"Jürgen Exner" <jurgenex@hotmail.com> wrote:
> Ed Kulis wrote:
>> In perl, (and of course being perl it's not too hard at all) I'm
>> writing a translator that will take multi-octet characters like an
>> umlated-o and turn it into a safe corresponding character like
>> plain-old-lower-case-o.
>
> Oh, I see.
> So you are simplifying the t and the i into an l, too, aren't you? After all
> , it's the same character, just with an additional dash resp. an additional
> dot on top.
That's the best I can do for some of our interface engines.
>
> There are a couple of options:
> - Teach your Unix tools UTF-8
Big job lots of separate departments with a stake and limited resources to
devote to the change.
> - Recode your file from UTF-8 to whatever your Unix tools understand (maybe
> ISO-8895-1?). This is easy to do with Text::Iconv
Thank you for the Text::Iconv reference that's just the kind of thing I was
looking for.
> - do not accept non-ASCII characters from your datasource, e.g. block
> non-ASCII in the input field
Massive customization in our soon to be obsolete GUI client.
>
>> Question:
>> Is there a module/reference that already maps all the UTF-8 codes to
>> "safe" ASCII and vice-versa.?
>
> This is by definition of the term "character" not possible.
There would definitely be a loss of information.
>
>> Question:
>> Are there module/references that generally map one character coding
>> scheme to another?
>
> If you are talking about changing the encoding from X to Y then have a look
> at Text::Iconv.
I'll check it out!
Thanks for all the suggestions.
>
> jue
>
>
------------------------------
Date: 31 Oct 2002 12:22:15 -0800
From: mullman@charter.net (Chris)
Subject: Re: Writing Microsoft Outlook Notes With Perl -- FINISHED!
Message-Id: <c71b7a2c.0210311222.5d34c217@posting.google.com>
mullman@charter.net (Chris) wrote in message news:<c71b7a2c.0210220638.71e61d3d@posting.google.com>...
> I've got this half-baked idea for writing a program that will
> dynamically generate Microsoft Outlook Notes from information gathered
> from a database. I know how to do everything except create the
> Outlook Note. Can anyone point me in the direction of information for
> accomplishing this? I've seen others do this (not with Perl) where
> the program will seek data from the weather service and write that
> data into an Outlook Note. That's similar to what I am trying to do.
>
> Any help will be greatly appreciated.
>
> Chris
Here it is folks!
-----CODE BEGINS-----
$nntp = Net::NNTP->new("news.ISP.net", Debug => 0) || die "Couldn't
connect to the server: $!";
($num,$first,$last,$name) = ($nntp->group("comp.lang.perl.misc"));
for (; $first <= $last; $first++)
{
$info = $nntp->head($first);
if (@{$info} ne "")
{
@msg_date = %{$nntp->xhdr( 'Date', $first )};
@subject = %{$nntp->xhdr( 'Subject', $first )};
@message_id = %{$nntp->xhdr( 'Message-ID', $first )};
if ($msg_date[1] =~ $today)
{
print ("DATE: $msg_date[1]\nMESS: $subject[1]");
# use existing instance if Outlook is already running
eval {$ex = Win32::OLE->GetActiveObject('Outlook.Application')};
die "Outlook not installed" if $@;
unless (defined $ex) {
$ex = Win32::OLE->new('Outlook.Application', sub
{$_[0]->Quit;})
or die "Oops, cannot start Outlook";
}
$olMAPI = $ex->GetNameSpace("MAPI") or die "Error getting name
space";
$notes = $olMAPI->Folders("Mailbox")->Folders("Notes") or die
"Error getting folder"; #change the "Mailbox" to be whatever your
Outlook application has for your mailbox. For example, the default is
"Personal Folders."
$myItem = $notes->Items->Add;
$myItem->{body} = join('', @{$nntp->body($first)});
$myItem->Save;
undef $notes;
undef $olMAPI;
undef $ex;
}
else
{
print ("not today\n");
}
}#END if (@{$info} ne "")
}#END for (; $first <= $last; $first++)
$nntp->quit;
Thanks to everyone who helped especially Erik who taught me to use the
join() This script is getting posts from an NNTP server then creating
Outlook Notes for each message. I can then HotSynch my Palm which is
configured to synchronize those notes resulting in a solution for
taking my newsgroup posts with me to read at my leisure. Way better
than buying software!
Thanks again,
Chris
------------------------------
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 4053
***************************************