[15815] in Perl-Users-Digest
Perl-Users Digest, Issue: 3228 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 1 14:06:08 2000
Date: Thu, 1 Jun 2000 11:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959882714-v9-i3228@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 1 Jun 2000 Volume: 9 Number: 3228
Today's topics:
[Golf] Re: wc for perl (Abigail)
Re: C to perl? (brian d foy)
Re: C to perl? (Bart Lateur)
Re: C to perl? <juex@deja.com>
Re: C to perl? <bmb@ginger.libs.uga.edu>
Re: C to perl? <juex@deja.com>
Re: C to perl? (Ilya Zakharevich)
Can not expire cookies !!! jbrzezi@my-deja.com
Cookies stopped working w/Perl 5.6 ericwinslow@yahoo.com
file dates being reported incorrectly..... scumjr@my-deja.com
Re: file dates being reported incorrectly..... <abe@ztreet.demon.nl>
Inherit data structs from SUPER, How ??? <john@thinman.com>
Re: Inherit data structs from SUPER, How ??? nobull@mail.com
Re: Is it possible to compile Perl programs? (Abigail)
modules for handling flat text databases (David Wall)
Re: MS Documents to text---help (Martin Vorlaender)
Newbie <restlimanapat1@email.msn.com>
Re: Newbie (Andreas Kahari)
Re: Newbie nobull@mail.com
Newbie: help with linking to another webpage (MJS)
Re: Oracle 8.1, Perl 5.05, DBI on Solaris 2.6 <rereidy@indra.com>
Re: Parsing Email from Europe (Abigail)
Piddly runtime error using DB_File and Fcntl <darklight@hockey.net>
Re: Problem of perl on NT IIS chpshi@my-deja.com
Problems with MakeMaker om Win32 (ActiveState) <Greg.Thomas@iname.com>
Re: Quick Network Ping (Elaine -HFB- Ashton)
Re: Quick Network Ping <peckert@epicrealm.com>
Re: Quick Network Ping (Abigail)
Re: Setting DISPLAY with Perl (John Stanley)
Re: Setting DISPLAY with Perl (Abigail)
Re: simple array and scalar question nobull@mail.com
Re: simple array and scalar question squidrocks@my-deja.com
Re: SWIG NT Activestate 522 compile problem <ratbag98@hotmail.com>
Unable to get this the new version of perl to install. <dturner@raytheon.com>
Re: wc for perl <klowryNOklSPAM@fhlbatl.com.invalid>
Win32::Eventlog <elynt@exchange.ml.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 1 Jun 2000 17:50:10 GMT
From: abigail@arena-i.com (Abigail)
Subject: [Golf] Re: wc for perl
Message-Id: <8h67oi$ntb$1@news.panix.com>
On Thu, 01 Jun 2000 06:34:31 -0700,
crotchless gespatcho <klowryNOklSPAM@fhlbatl.com.invalid> wrote:
++
++ Here is a q & d wc in perl. I would appreciate any changes for
++ efficiency.
perl -pale '$c+=length;$w+=@F}{$_="$. $w $c"'
Abigail
------------------------------
Date: Thu, 01 Jun 2000 11:27:09 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: C to perl?
Message-Id: <brian-ya02408000R0106001127090001@news.panix.com>
In article <Pine.A41.4.21.0006011010430.15160-100000@ginger.libs.uga.edu>, Brad Baxter <bmb@ginger.libs.uga.edu> posted:
> 1 #!/usr/local/bin/perl -w
> 2 use strict;
> 3
> 4 {
> 5 my $scalar = " " x 100000;
> 6 }
> 7
> 8 ### isn't it freed now?
it's available to Perl for re-use, if that is what you mean.
it depends on what you think "free" means. ;)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Thu, 01 Jun 2000 16:14:32 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: C to perl?
Message-Id: <393686e6.440937@news.skynet.be>
brian d foy wrote:
>> >allocate memory in Perl. i dare you.
>>
>> $scalar = " " x 100000;
>
>:)
>
>now reference it by address...
$address = unpack 'L', pack 'P', $scalar;
--
Bart.
------------------------------
Date: Thu, 1 Jun 2000 09:34:15 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: C to perl?
Message-Id: <39369087$1@news.microsoft.com>
"Abigail" <abigail@arena-i.com> wrote in message
news:8h492p$5et$1@news.panix.com...
> On Wed, 31 May 2000 15:17:55 -0700, Jürgen Exner <juex@deja.com> wrote:
> ++ "brian d foy" <brian@smithrenaud.com> wrote in message
> ++ news:brian-ya02408000R3105001649120001@news.panix.com...
> ++ > In article <39356C66.DDC60593@none.com>, Michel <nobody@none.com>
posted:
> ++ >
> ++ > > Can anyone tell me how to translate a C program to perl? Or where
can I
> ++ > > get c2perl?
> ++ >
> ++ > there are things that you can do in C that you can't do in Perl.
> ++ [...]
> ++
> ++ That's not right.
> ++ Perl and C are both Turing languages, therefore you can do exactly the
same
> ++ things in both languages (or pretty much in any programming language).
> ++ The question is more if some concept is native to a particular language
and
> ++ therefore easy to use or if you have to work-around or even abuse some
other
> ++ language feature in order to simulate a specific feature.
>
>
> But that's an argument that's pointless when discussing translations,
> because you cannot determine from the program source what it will
> output, without running it. (After all, if you could, you could solve
> the halting problem.)
Well, yes and no. On a practical level you right, no doubt about that.
But: I could write a compiler which accepts C programs as input and
generates Perl code (instead of assembler) as output. For sure this would be
a daunting task and nobody in his right mind would do it except as an
academic excercise. And maybe I even have to implement some huge abstract
engine to simulate some C features, but it is possible.
In so far yes, I can transform any C program into a Perl program.
> Just *knowing* that there is an equivalent Perl program to every C
> program doesn't make you can find it.
From a practical approach you are certainly right. And those generated
programs I suggested above for sure aren't human-readable any more.
jue
------------------------------
Date: Thu, 1 Jun 2000 12:37:39 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: C to perl?
Message-Id: <Pine.A41.4.21.0006011230350.15160-100000@ginger.libs.uga.edu>
On Thu, 1 Jun 2000, brian d foy wrote:
> In article
<Pine.A41.4.21.0006011010430.15160-100000@ginger.libs.uga.edu>,
Brad Baxter <bmb@ginger.libs.uga.edu> posted:
>
> > 1 #!/usr/local/bin/perl -w
> > 2 use strict;
> > 3
> > 4 {
> > 5 my $scalar = " " x 100000;
> > 6 }
> > 7
> > 8 ### isn't it freed now?
>
> it's available to Perl for re-use, if that is what you mean.
> it depends on what you think "free" means. ;)
I haven't a clue. :-) Actually, I understood that when a program
(possibly written in c) freed memory it had previously allocated, that
memory was available only to the program for re-use--not available to
the OS (i.e., UNIX) for use by other processes.
This is a shallow understanding, and I wouldn't be at all surprised if
it's incorrect (or perhaps very different for different OS's).
--
Brad
------------------------------
Date: Thu, 1 Jun 2000 09:42:33 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: C to perl?
Message-Id: <39369278$1@news.microsoft.com>
"brian d foy" <brian@smithrenaud.com> wrote in message
news:brian-ya02408000R3105001958000001@news.panix.com...
> In article <39358f97@news.microsoft.com>, "Jürgen Exner" <juex@deja.com>
posted:
>
> > "brian d foy" <brian@smithrenaud.com> wrote in message
> > news:brian-ya02408000R3105001649120001@news.panix.com...
> > > In article <39356C66.DDC60593@none.com>, Michel <nobody@none.com>
posted:
> > >
> > > > Can anyone tell me how to translate a C program to perl? Or where
can I
> > > > get c2perl?
> > >
> > > there are things that you can do in C that you can't do in Perl.
>
> > That's not right.
> > Perl and C are both Turing languages, therefore you can do exactly the
same
> > things in both languages (or pretty much in any programming language).
>
> allocate memory in Perl. i dare you.
That's a feature of the programming language itself and has little to do
with what you can do with a program written in that language.
Haskell doesn't have variables, but still I can write the same programs in
Haskell as in Perl or C.
> i didn't say that they couldn't accomplish the same tasks, though.
That is what you usually use as a metric to compare two programs: The same
input generates the same output.
------------------------------
Date: 1 Jun 2000 17:12:36 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: C to perl?
Message-Id: <8h65i4$550$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was NOT sent to brian d foy
<brian@smithrenaud.com>],
who wrote in article <brian-ya02408000R0106001127090001@news.panix.com>:
> > 4 {
> > 5 my $scalar = " " x 100000;
> > 6 }
> > 8 ### isn't it freed now?
> it's available to Perl for re-use,
No it is not. Lexicals, compile-time and scratch variables are
sticky: whatever goes there, remains there.
my $a = 'a';
my $b = 'b' x 1e6 . $a . $a;
would take 3M (in recent Perls): one for 'b' x 1e6 (done at compile
time), one for a scratch variable which contained b...ba, and one
which sits in $b. [Older Perls would take an extra 1M for b...baa in
a scratch variable.]
Only one of these Ms is recoverable, one in $b, and only by explicit
undef $b;
Ilya
------------------------------
Date: Thu, 01 Jun 2000 17:02:09 GMT
From: jbrzezi@my-deja.com
Subject: Can not expire cookies !!!
Message-Id: <8h64ua$62u$1@nnrp1.deja.com>
I am using CGI::Cookie module.
I can read cookies but I have problem with expiring them:
I tried:
@content_cookie=();
%cookies = fetch CGI::Cookie;
foreach(keys %cookies) #get existing cookies
{
$current_cookie = $cookies{$_};
$current_cookie->expires('-1d');
push(@content_cookie, $current_cookie);
}
print header(-cookie=>\@content_cookie);
according to documentation all the cookies with passed expiration date
should not exist anymore.
However when I read cookies again they are there !
Any suggestions ?
Thanks,
Jerzy (jerzy@nandoDOTcom)
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 01 Jun 2000 17:26:02 GMT
From: ericwinslow@yahoo.com
Subject: Cookies stopped working w/Perl 5.6
Message-Id: <8h66ar$71e$1@nnrp1.deja.com>
Hello.
I've been using cookies with CGI.pm under 5.005_04 without problems. I
installed 5.6 on another Solaris 2.6 machine and the same 'working'
cookie code refused to work. Retrieving the cookie always came up empty-
handed. Has anybody else encountered problems with 5.6 in this way? I
checked out the documentation regarding changes in 5.6 and the latest
version of CGI.pm, but came across nothing that would have indicated
that I needed to change anything. Code is below:
Set Cookie:
----------
#!/usr/bin/perl -w
use CGI qw(:standard);
$r=new CGI;
$r->use_named_parameters(1);
#pull-off cookie values
$user=$r->param('user');
$closing=$r->param('closing');
$month=substr $closing, 0, 2;
$year=substr $closing, 2, 2;
$close=substr $closing, 5, 1;
$ind=$r->param('ind');
# make a 4 digit year
$cookies{'user'}=$user;
$cookies{'closing'}=$closing;
$cookies{'year'}=$year;
$cookies{'ind'}=$ind;
$shit=$r->cookie('name'=>'them',
'value'=>\%cookies);
print $r->header('cookie'=>$shit);
Retrieve cookie:
----------------
#!/usr/bin/perl -w
use CGI qw(:standard);
$r=new CGI;
$r->use_named_parameters(1);
print $r->header();
%cooks=$r->cookie('name'=>'them');
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 01 Jun 2000 16:03:22 GMT
From: scumjr@my-deja.com
Subject: file dates being reported incorrectly.....
Message-Id: <8h61g2$3mo$1@nnrp1.deja.com>
I have a simple script that is collecting statistics on files and
directories. Files that have special characters ("outside" the ascii
character range), Perl reports the dates incorrectly. No matter what
date I try to retrieve (last modified/accessed, or created) it reports
the date 11/31/69 regardless of the true date (from the command prompt
or through explorer). The kind of special characters I am referring to
are the 1/2 character (used in the Windows NT "send to 3.5 Drive"
shortcut) and French characters (characters with accents on
them.......our office is bilingual, and some of the files have been
created with french characters).
This is not really a big deal as there are very few files that have
these special characters, but I am curious as to why this might be
occurring? All the other stats I've been gathering have been fine
(size, etc).
thanks,
SJ
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 01 Jun 2000 19:30:36 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: file dates being reported incorrectly.....
Message-Id: <el6djso2f7pr12efi98idlh9luu5j96dtv@4ax.com>
On Thu, 01 Jun 2000 16:03:22 GMT, scumjr@my-deja.com wrote:
> I have a simple script that is collecting statistics on files and
> directories. Files that have special characters ("outside" the ascii
> character range), Perl reports the dates incorrectly. No matter what
> date I try to retrieve (last modified/accessed, or created) it reports
> the date 11/31/69 regardless of the true date (from the command prompt
> or through explorer).
NT seems to report the file date in the 11-th field returned by stat().
my $f_time = scalar localtime( (stat 'filename')[10] );
perldoc -f stat
--
Good luck,
Abe
------------------------------
Date: Thu, 01 Jun 2000 15:44:07 GMT
From: John from PUNY <john@thinman.com>
Subject: Inherit data structs from SUPER, How ???
Message-Id: <8h60c3$2u3$1@nnrp1.deja.com>
#!/usr/bin/perl
=pod
=head1 Inheritance
=head2 How do I pass the data structure references from the top level
module to the sub module (gracefully)?
Below are two subs and a test script:
Of course I tried the SUPER class syntax, but that only got me access
to methods, I'm really intersted in the configuration info in the hash
of hashes Super structure.
I'm developing a CGI type module suite to create and maintain a complex
structures using HTML tables as a three dimensional spread sheet to
control batch operations.
The key features are performance and maintainability. I am going to
port it to ASCII and GUI pretty as soon as I get thru this stage and
I'm going w/ CVS if anybody else sees the value in it.
I have recently been pretty successful in implementing the process on
NT systems run by a mainframe group untouched since 1973.
(see Perl Primer http://puny.vm.org/perl_primer)
=cut
# Super.pm, snip and discard above------------------>8-----------------
package Super ;
use Sub ;
my $test_var = "test!!" ;
sub new {
my $class = shift ;
my $self = {} ;
$self -> {'Sub'} = new Sub($self) ;
bless ( $self , $class ) ;
$self -> {'Inherit'} = 'The Wind' ;
return $self
}
sub doit {
my $self = shift ;
return $self -> {'Sub'} -> doit ;
}
sub super_test_sub {
my $self = shift ;
return "Inside Method Super::super_test_sub"
}
1;
# Sub.pm ------------------>8-----------------
package Sub ;
sub new {
my $class = shift ;
my $self = {} ;
bless ( $self , $class ) ;
$self -> {'caller'} = shift ;
return $self
}
sub doit {
my $self = shift ;
use Data::Dumper ;
$Data::Dumper::Indent = 2 ;
print Dumper( $self ) ;
print $self -> SUPER::super_test_sub." -Works\n" ;
print $SUPER::test_var," -Does not work\n" ;
return $self -> {'caller'} -> {'Inherit'}.":
This is how I returned Super's data from Sub by passing Super's
\$self, $self, reference to Sub using Sub's new() method" ;
}
1;
#supersub.prl--------------->8-----------------
# #!/usr/bin/perl
use strict ;
use Super ;
my $sup ;
$sup = new Super ;
print $sup -> doit."\n" ;
--
##############################################
# CXN, Inc. Contact: john@thinman.com #
# Proud Sponsor of Perl/Unix of NY #
# http://puny.vm.com #
##############################################
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 01 Jun 2000 17:55:15 +0100
From: nobull@mail.com
Subject: Re: Inherit data structs from SUPER, How ???
Message-Id: <u9bt1l8hos.fsf@wcl-l.bham.ac.uk>
John from PUNY <john@thinman.com> writes:
> =head1 Inheritance
Inheritance in perl is governed by the @ISA array.
You can maniplate a package's @ISA directly or with "use base".
In your example you have done neither so there is no inheritance
relationship between your packages.
BTW: You also appear to be confused about the nomenclature of
inheritance. Sub-classes inherit from super-classes.
Finally, as you correctly point out you can only inherit methods not
variables. However, you can have a method that simply returns a
reference to a variable.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 1 Jun 2000 17:55:41 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Is it possible to compile Perl programs?
Message-Id: <8h682t$ntb$3@news.panix.com>
On Thu, 1 Jun 2000 15:00:08 +0100, Stuart Brown <stuartb@abs.karoo.co.uk> wrote:
++
++ Is it possible to compile perl source code (into machine code or byte code -
++ whatever) and then run it as normal? Also is this possible with mod_perl?
FAQ.
Abigail
------------------------------
Date: 1 Jun 2000 12:40:50 -0400
From: darkon@one.net (David Wall)
Subject: modules for handling flat text databases
Message-Id: <8F46858A9darkononenet@206.112.192.118>
I've been using small (<50KB, often <10KB) flat text databases for various
things at work, and *finally* realized that someone has probably already
written a module to handle this sort of repetitive task. So I checked CPAN
and perl.com, and sure enough, I found several. Sprite.pm looks as if it
might be exactly what I need for the simple tasks I've been doing, but I
noticed several others, such as RDB, JDB, and AsciiDB::Tag. I've
tentatively decided to use Sprite for a bit and see how me and it agree
with each other, but I'm interested in hearing opinions on what modules are
suitable for small text databases. If anyone has the time and inclination
to share their opinion, I'd appreciate it.
To provide a little background, here are some of the things I've been
storing in text databases:
* seminar announcements. Has fields such as date/time, location, speaker,
and summary. When updated, another program reads the database and writes
out HTML to a seminar announcement page.
* Tracking assigned tasks, with fields like due date, person assigned, etc.
* Keeping records of journal articles and presentations for the division.
Nothing very complicated yet, just little things you might keep in a single
table in a database, in a spreadsheet, or even a word-processing document.
--
David Wall - darkon@one.net
"When the end of the world comes, I want to be in Cincinnati.
Everything happens ten years later there." -- attrib. Mark Twain
------------------------------
Date: Thu, 01 Jun 2000 19:09:33 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: MS Documents to text---help
Message-Id: <393698cd.524144494f47414741@radiogaga.harz.de>
Hendrik Uhlmann (HUhlmann@stn-atlas.de) wrote:
: JB Goss <jgoss@goss-com.com> writes:
: > I am looking for a Perl script for a Unix
: > machine that will strip the crud out of a MS Word document and
: > just leave the text (all text).
:
: Maybe that 'mswordview' helps. It converts MS-Word (8) to html. It's
: not a perl module, but maybe it do what you want...
Except that it's called "the wv library" (now that MS has an "mswordview"):
http://www.wvware.com/
cu,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
OpenVMS: When you | work: mv@pdv-systeme.de
KNOW where you want | http://www.pdv-systeme.de/users/martinv/
to go today. | home: martin@radiogaga.harz.de
------------------------------
Date: Wed, 31 May 2000 23:10:55 -0700
From: "RUSL" <restlimanapat1@email.msn.com>
Subject: Newbie
Message-Id: <#zo1Nf#y$GA.307@cpmsnbbsa09>
Hi,
I'm new to this NG so with the PERL Language... I would like to ask if
where can I find a good website that will help me to learn this language
particularly in Linux platform. Any help will be very much appreciated.
RUSL :)
------------------------------
Date: 1 Jun 2000 18:51:12 +0100
From: andkaha@hello.to.REMOVE (Andreas Kahari)
Subject: Re: Newbie
Message-Id: <39369480@merganser.its.uu.se>
In article <#zo1Nf#y$GA.307@cpmsnbbsa09>, RUSL <rmanapat@netzero.net> wrote:
>Hi,
>
> I'm new to this NG so with the PERL Language... I would like to ask if
>where can I find a good website that will help me to learn this language
>particularly in Linux platform. Any help will be very much appreciated.
>
>
>RUSL :)
>
>
Any help:
The comp.lang.perl.misc FAQ:
http://www.cs.uu.nl/wais/html/na-bng/comp.lang.perl.misc.html
Take a look at the main Perl site: http://www.perl.com/
Buy some books: http://perl.oreilly.com/
/A
--
# Andreas Kähäri
# All junk e-mail is reported to the
# appropriate authorities, no exceptions.
------------------------------
Date: 01 Jun 2000 18:05:01 +0100
From: nobull@mail.com
Subject: Re: Newbie
Message-Id: <u98zwp8h8i.fsf@wcl-l.bham.ac.uk>
"RUSL" <restlimanapat1@email.msn.com> writes:
> I'm new to this NG so with the PERL Language... I would like to ask if
> where can I find a good website that will help me to learn this language
> particularly in Linux platform. Any help will be very much appreciated.
Please consult the FAQ before posting _especially_ in a field/NG where
you are new.
You should also find the person responsible for giving you access to
Usenet shake them warmly by the throat and explain to them that they
should not be letting people loose on Usenet without this advice.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 01 Jun 2000 16:03:11 GMT
From: shartlly@home.com (MJS)
Subject: Newbie: help with linking to another webpage
Message-Id: <39368736.117175826@news>
I'm very new at this and am learning via looking at some existing
code. I want to call a HTML page if something is true. The following
line of code is supposed to do it, but it doesn't work. It always
brings up the download file window of the web browser.
I've tried variations suich as http://www....
as the Location: and it did no better.
Enough ranting: here is the line:
if ($FORM{'add_continue.x'}) {
print "Location: search-main.html \n\n"; #load new page
continue shopping
exit;
} else {
&display; #give chance to edit and finalize
}
Thanks in advance for your help.
Mike
------------------------------
Date: Thu, 01 Jun 2000 09:20:48 -0600
From: Ron Reidy <rereidy@indra.com>
Subject: Re: Oracle 8.1, Perl 5.05, DBI on Solaris 2.6
Message-Id: <39367F50.995DE894@indra.com>
Mark Heaton wrote:
>
> I have installed all the above and when we try to make a DBI call via Perl's
> DBI library an error occurs saying a Solaris patch is required for the Java
> Runtime Environment (1.1.10 and 1.1.8 both have the same result).
> From digging through Sun's website and elsewhere it is clear that Solaris
> 2.5.1 needs a patch applied to support native threads. However this is not
> needed for 2.6.
> Has anyone come accross this and been able to resolve this. The error is
> most likely in the Perl DBI lib but Oracle does not help with its errors.
> Regards
> Mark
From the text, it appears you are using a perl made with threads. The
DBI docs specifically state DBI is not thread safe.
--
Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C.
------------------------------
Date: 1 Jun 2000 17:34:27 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Parsing Email from Europe
Message-Id: <8h66r3$n91$2@news.panix.com>
On Thu, 01 Jun 2000 13:20:28 +0200, Jimmy Lantz <webmaster@ostas.lu.se> wrote:
++ Hi Dan,
++ I'm swedish and we use this kind of chars (å, ä, ö),
++ I my self is looking for a way to cnovert them into HTML from the
++ original format (that is, åäö)
++ I enclose the code which I have but it's not working for my purposes but
++ maybe it will for yours...
++ Try it out.
++ Cheers!
++ //Jimmy in Lund, Sweden
++
++ ######### My code / with some help from this Newsgroup, THANKS! (still
++ not working for me)
++
++ $value =~ s/Å/Å/g;
++ $value =~ s/å/å/g;
++ $value =~ s/Ä/Ä/g;
++ $value =~ s/ä/ä/g;
++ $value =~ s/Ö/Ö/g;
++ $value =~ s/ö/ö/g;
++ ##########################
++ $value =~ s/%[cC]5/Å/g;
++ $value =~ s/%[cC]4/Ä/g;
++ $value =~ s/%[dD]6/Ö/g;
++ $value =~ s/%[eE]5/å/g;
++ $value =~ s/%[eE]4/ä/g;
++ $value =~ s/%[fF]6/ö/g;
++
++ $value =~ s/\%C5/Å/g;
++ $value =~ s/\%C4/Ä/g;
++ $value =~ s/\%D6/Ö/g;
++ $value =~ s/\%E5/å/g;
++ $value =~ s/\%E4/ä/g;
++ $value =~ s/\%F6/ö/g;
++ ##\################
Eeew. This can be done in just 3 lines. First note that the third block
won't do anything that isn't already covered by the second block.
my %t = qw /Å Aring å aring Ä Auml ä auml Ö Ouml ö ouml/;
$value =~ s/([ÅåÄäÖö])/&$t{$1};/g;
$value =~ s/%([A-F0-9])/$t{$1} ? "&$t{$1};" : "%$1"/eig;
But no doubt there will be modules for that. Note that Å and such are
perfectly valid in HTML, so there isn't much need to encode them.
Abigail
------------------------------
Date: Thu, 01 Jun 2000 12:52:12 -0500
From: David Miller <darklight@hockey.net>
Subject: Piddly runtime error using DB_File and Fcntl
Message-Id: <3936A2CC.9D39EC32@hockey.net>
Can anyone give me some pointers? I'm relatively new to Perl and this
one is driving me nuts.
I'm creating a module to aid in the sharing (locking) of database files
on a unix system (perl, version 5.004_04 built for i386-linux).
I'm basing the code in my modules on an example given
in Programming Perl, Ch. 7, DB_File, Locking Databases).
Here are the relevant sections of my module:
----------------------- BEGIN MODULE EXAMPLE ----------------------
#!/usr/bin/perl -w
#
# DBShare.pm
#
# The dopen method returns a reference to an array containing
# the database object pointer in element 0 and a filehandle in element 1;
#
package DBShare;
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(dopen dread dwrite ddelete dkeys disakey dclose);
use Fcntl;
use DB_File;
use FileHandle;
use strict;
my $Debug = 1;
sub LOCK_SH { 1 }
sub LOCK_EX { 2 }
sub LOCK_NB { 4 }
sub LOCK_UN { 8 }
# -------------------------------METHODS-----------------------
sub dopen {
if ($Debug) { print "Enter dopen... "; };
my($type, $filename, $fd, %db_hash, $db);
($type, $filename) = @_;
$db = [];
$db->[0] = tie(%db_hash, 'DB_File', $filename, O_CREAT|O_RDWR, 0666)
or die "dbcreat $filename: $!";
$db->[1] = new FileHandle;
$fd = ($db->[0])->fd;
open(($db->[1]), "+<&=$fd") or die "Unable to open dbfile: $!";
flock(($db->[1]), LOCK_UN);
if ($Debug) { print "Exit dopen!\n"; };
return bless $db, $type;
} # END OF dopen
# -----------------------------
sub dkeys {
if ($Debug) { print "Enter dkeys... "; };
my ($db, @keys, $key, $value, $i);
($db) = @_;
@keys = ();
$i = 0;
unless (flock (($db->[1]), LOCK_SH | LOCK_NB)) {
unless (flock (($db->[1]), LOCK_SH)) { die "Unable to sharelock dbfile: $!" }
}
$i = 0;
until ( $db->[0]->seq($key, $value, R_NEXT) != 0 ) {
if ($Debug) { print ("Key $i : $key ") }
$keys[$i++] = $key;
}
flock (($db->[1]), LOCK_UN);
if ($Debug) { print "Exit dkeys!\n"; };
return @keys;
} # END OF dkeys
# various other methods are not included as they didn't seem relevant to
# me. I will post them if anyone feels they hold a key to the problem.
------------------------ END MODULE EXAMPLE ---------------
The following is the program I'm using to test the module:
------------------- BEGIN TEST PROGRAM -------------------
#!/usr/bin/perl -w
use DBShare;
$db = DBShare->dopen('test.db');
print ( $db->dkeys, "\n" );
$db->dwrite('name', 'David E. Miller');
$db->dwrite('rank', 'GEN');
$db->dwrite('serial', '123-45-6789');
print ($db->dread('name'), $db->dread('rank'), $db->dread('serial'),
"\n");
print ( $db->dkeys, "\n" );
print ( $db->disakey('fred'), $db->disakey('name'), "\n");
$db->ddelete('rank');
print ( $db->dkeys, "\n" );
-------------------- END TEST PROGRAM ---------------------
Now the problem... When I run the test program, the results are fine
except that on each call to the method dkeys I get a non-fatal error as
shown below:
------------------BEGIN OUTPUT ---------------------
Enter dopen... Exit dopen!
Use of uninitialized value at DBShare.pm line 139.
Enter dkeys... Exit dkeys!
Enter dwrite... Exit dwrite!
Enter dwrite... Exit dwrite!
Enter dwrite... Exit dwrite!
Enter dread... Exit dread!
Enter dread... Exit dread!
Enter dread... Exit dread!
David E. MillerGEN123-45-6789
Use of uninitialized value at DBShare.pm line 139.
Enter dkeys... Key 0 : rank Key 1 : serial Key 2 : name Exit dkeys!
rankserialname
Enter disakey... Exit disakey!
Enter disakey... Exit disakey!
01
Enter ddelete... Exit ddelete!
Use of uninitialized value at DBShare.pm line 139.
Enter dkeys... Key 0 : serial Key 1 : name Exit dkeys!
serialname
------------------END OUTPUT------------------------
The error refers to line 139, which is the "flock (($db->[1]),
LOCK_UN);" line in the dkeys method. Here are the things that are
bugging me about this problem:
1) the error is printed prior to any of the print functions that are
imbedded in the method. How can any variable at line 139 be
uninitialized if (as far as I can tell) that line of code hasn't been
executed yet?
2) all of the other methods in this module have the same flock
function almost immediately prior to the end of the method, yet the
dkeys method is the only one that produces this error.
3) I can comment out that line and the error "moves" to the next line
of code.
I would appreciate any assistance that could be offered. I'm beating my
head against the monitor at this point.
TIA
Dave Miller
------------------------------
Date: Thu, 01 Jun 2000 15:48:36 GMT
From: chpshi@my-deja.com
Subject: Re: Problem of perl on NT IIS
Message-Id: <8h60kg$30l$1@nnrp1.deja.com>
Thanks a lot!
In article <39365E01.8EC3FC26@sei.cmu.edu>,
Ted Marz <tfm@sei.cmu.edu> wrote:
> There are a couple of possibilities.
>
> It may be that the .pl (or .plx for PerlScript) extension isn't
> associated with Perl.
>
> It may be that there isn't the correct permissions on the cgi
directory
> INSIDE of IIS. .pl files need execute permission. .plx files just
need
> script permission
>
> ActiveState should have some documentation on correct setup (if they
are
> up at the moment :) ).
>
> As for sendmail.. Somewhere on Microsoft's tech sites there is a port
of
> sendmail for NT. There is also another mailer (blat) that has package
> support under Perl that runs under NT. Or, you could talk directly to
> the SMTP server using one of the Net:: packages (I think).
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 01 Jun 2000 17:30:19 +0100
From: Greg Thomas <Greg.Thomas@iname.com>
Subject: Problems with MakeMaker om Win32 (ActiveState)
Message-Id: <fl2djskblpj0m90mdl6ldoljgj3svj34u1@4ax.com>
Hi,
To make sure the problem I'm seeing wasn't caused by a hosed
installation, I've downloaded and installed from fresh the current
version of Perl from ActiveState (Perl 5.6.0, ActiveState build 613
plus the PPM fix on Windows 98SE). My problem is that for some reason,
I can't get MakeMaker (v5.45) to work. Whenever I try
C:\temp> perl makefile.pl
on everything I've downloaded, the procedure fails to find the
installation of Perl:
Unable to find a perl 5 (by these names: C:\Perl\bin\Perl.exe miniperl
perl perl5 perl5.6.0, in these dirs: C:\WINDOWS C:\WINDOWS\COMMAND
C:\PERL\BIN C:\Perl\bin)
Despite the fact that c:\perl\bin\perl.exe exists;
C:\> c:\perl\bin\perl.exe -v
This is perl, v5.6.0 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
...
Has anyone seen this before? I can't say I've ever looked closely at
MakeMaker before, just used it. Using the verbose option didn't give
any more information relating to this problem, and setting PERL_SRC
didn't make any difference. So, any ideas?
TIA,
Greg
--
This post represents the views of the author and does
not necessarily accurately represent the views of BT.
------------------------------
Date: 1 Jun 2000 15:28:22 GMT
From: elaine@chaos.wustl.edu (Elaine -HFB- Ashton)
Subject: Re: Quick Network Ping
Message-Id: <slrn8jd097.pq9.elaine@chaos.wustl.edu>
In article <8h5m05$rsr$1@nnrp1.deja.com>, scarey_man@hotmail.com wrote:
>Does anyone know how to quickly ping a device using perl, when the
>device is not available over the network and a normal UNIX ping would
>take a few seconds or more to time out?
http://search.cpan.org/search?dist=Net-Ping
e.
------------------------------
Date: Thu, 01 Jun 2000 15:37:58 GMT
From: Paul Eckert <peckert@epicrealm.com>
Subject: Re: Quick Network Ping
Message-Id: <3936822F.64A324A9@epicrealm.com>
scarey_man@hotmail.com wrote:
>
> Does anyone know how to quickly ping a device using perl, when the
> device is not available over the network and a normal UNIX ping would
> take a few seconds or more to time out?
>
Dear s_m:
You're treading a fine line here between a truly unreachable object
and slowly-reachable objects, but the solution would be to use Net::Ping,
but to set the default and/or explicit timeouts to shorter times than 5
seconds (the default).
For instance:
Net::Ping->new("icmp", 1); # set dflt timeout to 1 second
From the manpage:
If a default timeout ($def_timeout) in seconds is provided, it is used
when a timeout is not given to the ping() method (below). The timeout must
be greater than 0
and the default, if not specified, is 5 seconds.
--
Paul Eckert
Sr. Software Engineer
Epicrealm Inc.
1651 N. Glenville Dr., Suite 212
Richardson, TX 75081
(972) 479-0135 x300
peckert@epicrealm.com
------------------------------
Date: 1 Jun 2000 17:23:56 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Quick Network Ping
Message-Id: <8h667c$n91$1@news.panix.com>
On Thu, 01 Jun 2000 12:47:03 GMT,
scarey_man@hotmail.com <scarey_man@hotmail.com> wrote:
++ Does anyone know how to quickly ping a device using perl, when the
++ device is not available over the network and a normal UNIX ping would
++ take a few seconds or more to time out?
Several people will suggest Net::Ping, but given the unique conditions
of your situation, there's a much simpler method.
# Returns true if the device is available, and undef if not.
sub ping {undef}
Abigail
------------------------------
Date: 1 Jun 2000 17:40:28 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Setting DISPLAY with Perl
Message-Id: <8h676c$94p$1@news.NERO.NET>
In article <393668BF.4A6AF37A@usgs.gov>,
William H. Asquith <wasquith@usgs.gov> wrote:
>`export DISPLAY=mydisplay`;
>or
>`setenv DISPLAY mydisplay`;
>produces the following
>Can't exec "export": No such file or directory at blah.......
>Can't exec "setenv": No such file or directory at blah.......
>
>Yet I can in fact run export from the prompt.
And when you have a "prompt", what program are you talking to? What
happens when you do "man export" or "man setenv"?
>Basically, how can I get a Perl script to set the DISPLAY?
What is DISPLAY? Is it an environment variable? What special means of
accessing environment variables does perl provide to you, the
programmer? Might the same method of accessing all other environment
variables work for accessing this particular one?
>Do I need an external shell script to do it?
>Is Perl not able to modify her environmental variables on the fly?
Are you a troll?
------------------------------
Date: 1 Jun 2000 17:55:04 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Setting DISPLAY with Perl
Message-Id: <8h681o$ntb$2@news.panix.com>
On Thu, 1 Jun 2000 13:44:31 GMT, William H. Asquith <wasquith@usgs.gov> wrote:
++ `export DISPLAY=mydisplay`;
++
++ or
++
++ `setenv DISPLAY mydisplay`;
++
++ produces the following
++
++ Can't exec "export": No such file or directory at blah.......
++ Can't exec "setenv": No such file or directory at blah.......
++
++ Yet I can in fact run export from the prompt.
Sure you can. And you can call gethostbyname in Perl, but not from
the prompt. That's because gethostbyname is a Perl primitive, just
like export and setenv are shell commands.
Furthermore, even if you would be able to call export or setenv,
it doesn't help you, as it would only set the environment variable
of the child process.
++ Basically, how can I get a Perl script to set the DISPLAY?
++ Do I need an external shell script to do it?
++ Is Perl not able to modify her environmental variables on the fly?
Why don't you read the FAQ? It's explained there.
Abigail
------------------------------
Date: 01 Jun 2000 18:03:52 +0100
From: nobull@mail.com
Subject: Re: simple array and scalar question
Message-Id: <u9aeh58haf.fsf@wcl-l.bham.ac.uk>
squidrocks@my-deja.com writes:
> I have a file stored in an array @file which contains contains
> filename.exe.
No. I've read that three files and it doesn't make any sense.
Do you mean @file contains a single element list which contains the
name of a file?
> If I would try and use the array in the following code
> like if (-f @file){ ...etc it doesn't work.
That's right. An array used in a scalar context returns the number of
elements.
> If I give
> $tl a definite like $tl=filename.exe then it works.
Agh! Barewords! And that dot wont be in $tl
> But since the file is going to change I can't do that and you can't
> just say $tl=@file.
You can say $tl=$file[0] or ($tl)=@file
For that matter if @file only ever has one element why use an array at
all?
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 01 Jun 2000 17:53:32 GMT
From: squidrocks@my-deja.com
Subject: Re: simple array and scalar question
Message-Id: <3936a1d6.73253454@news.it.gvsu.edu>
If $tl contains the correct filename.
if (-e $tl) {
die "hey, $tl is already here, dufus!";
}
print "I'm gonna get $tl";
system ("wget @tlink");
should produce
hey, (filename) is already here!
------------------------------
Date: Thu, 1 Jun 2000 16:20:52 +0100
From: "Rob Rainthorpe" <ratbag98@hotmail.com>
Subject: Re: SWIG NT Activestate 522 compile problem
Message-Id: <8h5v1a$jus@jupiter.gre.ac.uk>
"Rob Rainthorpe" <ratbag98@hotmail.com> wrote in message
news:8h5s6t$jql@jupiter.gre.ac.uk...
> (In the absence of a newsgroup for Swig, I guess this newsgroup's the most
> appropriate location for this question)
>
> I'm using Activestate build 522 (perl 5.005_03) with Swig 1.1p5 on a
Windows
> 2000 machine with Visual C++ 6.0 SP3. Swig itself compiles beautifully. I
> then go to the Examples directory to see what I can do. I've edited the
> top-level makefile.win according to the instructions but the following is
> what I get:-
etc. etc.
Bad form, I know, to reply to one's own messages.
The answer, which comes under the "I'm so dumb I don't deserve to live"
heading, is to use the patch from www.swig.org, which clearly says that it
helps with recent versions of ActiveState perl.
Sorry for the interruption to your lives.
Rob.
------------------------------
Date: Thu, 01 Jun 2000 10:21:19 -0500
From: Dale Turner 1 <dturner@raytheon.com>
Subject: Unable to get this the new version of perl to install.
Message-Id: <39367F6F.A08A96DB@raytheon.com>
Hello,
I am having problems installing the latest version of PERL.
I checked the version that is installed and found that is a leftover
from the NT server resource kit. I checked in all the places in
the registry the app note said to look but found nothing. I did a
FIND on PERL and found entries but i did not feel comfortable
deleting registry entries.
I could sure use a good uninstall program about know.
Any ideas how to uninstall the old version of perl.????
Dale Turner
------------------------------------------------------------------
C:\>perl -v
This is perl, version 5.001
Unofficial patchlevel 1m.
Copyright 1987-1994, Larry Wall
Win32 port Copyright (c) 1995 Microsoft Corporation. All rights
reserved.
Developed by hip communications inc., http://info.hip.com/info/
Perl for Win32 Build 107
Built Apr 29 1996@22:56:57
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5.0 source
kit.
C:\>
------------------------------
Date: Thu, 01 Jun 2000 10:39:00 -0700
From: crotchless gespatcho <klowryNOklSPAM@fhlbatl.com.invalid>
Subject: Re: wc for perl
Message-Id: <01832eac.a9a08580@usw-ex0104-026.remarq.com>
You know, I have been to the PPT site for diff and wc and I
cannot get the code because it is one line. I have tried in both
IE4 and Netscape. Is there a way to download the code in a
readable format?
Tlhank you,
Kermit
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Thu, 01 Jun 2000 13:44:38 -0400
From: Eli Mansour <elynt@exchange.ml.com>
Subject: Win32::Eventlog
Message-Id: <3936A106.11991139@exchange.ml.com>
Can somebody give me an example of writing an error to
to NT eventlog.
I can' seem to get the syntax straight.
Thanks,
Eli
------------------------------
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 V9 Issue 3228
**************************************