[18704] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 872 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 10 18:11:02 2001

Date: Thu, 10 May 2001 15:10:25 -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: <989532625-v10-i872@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 10 May 2001     Volume: 10 Number: 872

Today's topics:
    Re: forking and variable references <mischief@velma.motion.net>
    Re: forking and variable references <uri@sysarch.com>
    Re: forking and variable references <ren@tivoli.com>
    Re: forking and variable references (Abigail)
    Re: format Question <mischief@velma.motion.net>
    Re: format Question <pne-news-20010510@newton.digitalspace.net>
    Re: format Question (Mark Jason Dominus)
    Re: how can I insert into a open file (Abigail)
    Re: I *really* don't understand this error message... (Gwyn Judd)
    Re: Javascript or Perl ? <michael-a-mayo@att.net>
    Re: Javascript or Perl ? <lmoran@wtsg.com>
    Re: Javascript or Perl ? (Art C)
    Re: Local Time <AgitatorsBand@yahoo.com>
    Re: Local Time <AgitatorsBand@yahoo.com>
    Re: Need help <krahnj@acm.org>
        New Perl Script <jap108864@Home.com>
    Re: New Perl Script <jurgenex@hotmail.com>
    Re: O_RDONLY" isn't numeric in entersub at .... nobull@mail.com
    Re: Perl 2 Exe (Abigail)
        RTF -> PDF <barry@website.ws>
    Re: RTF -> PDF <krahnj@acm.org>
    Re: setting environment variables (Anno Siegel)
    Re: setting environment variables <pne-news-20010510@newton.digitalspace.net>
    Re: setting environment variables <godzilla@stomp.stomp.tokyo>
    Re: setting environment variables <godzilla@stomp.stomp.tokyo>
    Re: setting environment variables <ren@tivoli.com>
        Source Documenter <stuart@zerostate.co.uk>
    Re: using MS Access (*.mdb) w/perl? (Andrew J. Perrin)
    Re: weird error on @array syntax nobull@mail.com
    Re: weird error on @array syntax (Mark Jason Dominus)
    Re: weird error on @array syntax (Mark Jason Dominus)
    Re: weird error on @array syntax (Mark Jason Dominus)
    Re: weird error on @array syntax (Craig Berry)
    Re: weird error on @array syntax <ren@tivoli.com>
    Re: weird error on @array syntax <ren@tivoli.com>
    Re: What's wrong with my loop? (Abigail)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 10 May 2001 19:10:39 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: forking and variable references
Message-Id: <tflptf8jtkg8cf@corp.supernews.com>

Randy Bey <randy.bey@rivernorthsys.com> wrote:
> OK so I am truly a dork.
> I want to fork a child process and have both parent and child share
> the same variable (a hash in this case).

You want IPC::Shareable.

Possibly you want ::SharedMem, which does not have a public
interface and is used by IPC::Shareable. You could even want
IPC::SharedMem, but that's not written yet AFAIK.


> While it appears that a child inherits all variables AS THEY ARE WHEN
> IT FORKS, after that all bets are off.

Absolutely. They are two distinct processes. Temp files, sockets,
shared memory, pipes, or some similar technique is needed to
keep the data syncrhonized. Perl 5 does not guarantee that it will
not move your variables around in memory, so even XS-based code
or using SysV shared memory (if available) via syscall will help
without serious work. Thankfully, Benjamin Sugars has done the
work and put it in a module.

> I have tried using $main::hash references, but I think both parent and
> child think they are main.

This is true as well.

> I have tried package parent (and package child) to distinguish
> themselves but each appears to have it's own idea of what $main::hash
> contains.

True.

> Clearly this is because they are two separate processes running and
> they do not share the same memory. I have proved this to myself by
> using hard references for hash ( $hashref = \%hash) and using
> %$hashref to dereference.

You've figured out the problem well. That's often much of finding an
answer.

> Am I smoking dope?

That could be, but I see no evidence of it here. Mr. Ockham told
me never to try proving something more than that for which I have
evidence, nor to try to disprove anything based simply on a lack
of evidence.

> Is there no way to share memory between these two
> disparate processes?

There are ways. IPC::Shareable is one.

Chris

-- 
Try not. Do, or do not. The Force is binary. -- Yoda,
The Empire Strikes Back (paraphrased)



------------------------------

Date: Thu, 10 May 2001 19:28:35 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: forking and variable references
Message-Id: <x7n18latq5.fsf@home.sysarch.com>

>>>>> "RB" == Randy Bey <randy.bey@rivernorthsys.com> writes:

  RB> I want to fork a child process and have both parent and child share
  RB> the same variable (a hash in this case).
  RB> While it appears that a child inherits all variables AS THEY ARE WHEN
  RB> IT FORKS, after that all bets are off.

because that is the definition of fork.

  RB> Am I smoking dope? Is there no way to share memory between these two
  RB> disparate processes?

you're not smoking good dope. perl supports SYSV style shared memory and
there are modules which make it easier to manage that. search cpan for
them.

but i bet this is an XY problem. there are many ways for two processes
to share information which doesn't always mean sharing memory. in fact
shared memory is not a good solution in many of those situations. why
don't you try to describe your larger needs and not be focused on the
single solution you have on your mind.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


------------------------------

Date: 10 May 2001 13:32:13 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: forking and variable references
Message-Id: <m3u22tm4wi.fsf@dhcp9-172.support.tivoli.com>

On Thu, 10 May 2001, randy.bey@rivernorthsys.com wrote:

> Is there no way to share memory between these two disparate
> processes?

See perlipc(1).

-- 
Ren Maddox
ren@tivoli.com


------------------------------

Date: Thu, 10 May 2001 20:17:34 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: forking and variable references
Message-Id: <slrn9fltqu.cp9.abigail@tsathoggua.rlyeh.net>

Randy Bey (randy.bey@rivernorthsys.com) wrote on MMDCCCIX September
MCMXCIII in <URL:news:i4ilft4pfb78c5ork1tq7ncjmetnn3s73t@4ax.com>:
//  OK so I am truly a dork.
//  I want to fork a child process and have both parent and child share
//  the same variable (a hash in this case).
//  While it appears that a child inherits all variables AS THEY ARE WHEN
//  IT FORKS, after that all bets are off.
//  I have tried using $main::hash references, but I think both parent and
//  child think they are main.

Well, yes. That's how they are supposed to act.

//  I have tried package parent (and package child) to distinguish
//  themselves but each appears to have it's own idea of what $main::hash
//  contains.
//  Clearly this is because they are two separate processes running and
//  they do not share the same memory. I have proved this to myself by
//  using hard references for hash ( $hashref = \%hash) and using
//  %$hashref to dereference.
//  Am I smoking dope? Is there no way to share memory between these two
//  disparate processes?

Of course there is. Did you look into 'man perlipc', or the appropriate
pages in the Camel?



Abigail
-- 
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print 
               qq{Just Another Perl Hacker\n}}}}}}}}}'    |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w


------------------------------

Date: Thu, 10 May 2001 18:31:57 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: format Question
Message-Id: <tflnktjc3f7va2@corp.supernews.com>

Lou Moran <lmoran@wtsg.com> wrote:
> I have (with a lot of help from CLPM) written a script that translates
> a 5 character username into 5 numbers (seen here):

> #!/usr/bin/perl -w
> use diagnostics;
> use strict;

> open (LIST, "sn.txt") || die "No file exists: $!" ;

> my $names = join "", <LIST>;

Take a look at the above line, then the below line.

> my $pwd = join "", $names;

What is it you expect the previous line to do? If you
mean 'my $pwd = $names;',  then just write that. If you
expect $names to be an array, then you've been in front
of your screen too long.

I've read your posts before. You know better than this.
Are you just tired?

[snip]

> but the output doesn't look like the format.

What does the output look like?

> What am I missing?

> (Looked in perldoc -q format, perldoc -f format & perldoc perlform but
> am wiling to go back)

See above... I don't think formats are the main problem here.

Sometimes you just need to walk away from your code for a few
minutes, give up all your preconceived notions about which part
isn't working, and look at where your values come from and what
they equal when you're working with them.

Chris

-- 
The purpose of a language is not to help you learn the
language, but to help you learn other things by using the
language. --Larry Wall, The Culture of Perl, August 1997



------------------------------

Date: Thu, 10 May 2001 20:44:39 +0200
From: Philip Newton <pne-news-20010510@newton.digitalspace.net>
Subject: Re: format Question
Message-Id: <3enlftkhs0clc9a63emmn8nqr75t6b18ik@4ax.com>

On Thu, 10 May 2001 12:31:01 -0400, Lou Moran <lmoran@wtsg.com> wrote:

> On Thu, 10 May 2001 18:01:55 +0200, Philip Newton
> <pne-news-20010510@newton.digitalspace.net> wrote wonderful things
> about sparkplugs:
> 
> >Is your input file only six characters long?
> 
> No, it's about 300 lines of 5 characters, like so:
> 
> aname
> bname
> cname
> 
> Do I need to know how man lines I'll be printing using @<<<<< ?

No, you can immediately tell that it will print only one line :)

What you almost certainly want is to use a loop over all the lines in the input
file. For each line, chomp() it to get rid of the trailing newline, assign the
result to $name and to $pwd and then do your tr/// (or y/// if you prefer) magic
on $pwd. Then write() that line. Something like this:

    # open LIST for reading
    # open NEWFILE for writing
    my($name, $pwd);
    while(<LIST>) {
        chomp;
        $name = $pwd = $_;
        $pwd =~ tr/.../.../;   # abbreviated for the example
        write NEWFILE;
    }
    # close LIST and NEWFILE
    # define format

Warning: don't put "my" before $name and $pwd inside the loop, or the format
won't be able to see the variables, since they're lexically scoped. However, if
they're file-scoped "my" variables, you'll be fine.

This way, you'll write() one record for each record you read.

Oh, you'll probably also want to split your format into a header and the real
lines. Read perlform about header formats (the easy way is to call it
NEWFILE_TOP).

Note that after $= lines, $^L followed by a new header will be printed. (By
default, a form feed plus header format will be printed after sixty lines.) If
you don't want headers printed every "page", either set $= to an extremely high
number, or diddle with $- after every write() so that it never reaches zero.

> I had sort of envisioned it just sort of working as expected.

Well, if you used a format with ~~ in a line and an expression such as
"shift(@names), shift(@passwords)", then it would soft of work as expected, in
that one write() would write out all records, but you'd have to populate the
arrays be reading the whole file in first. I'd recommend the one-line-at-a-time
approach above.

> more reading (looks like CH 7 (PP3) and perldoc -f format are very
> similar. 

That's quite possible. I also recommend perldoc perlform.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


------------------------------

Date: Thu, 10 May 2001 19:45:49 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: format Question
Message-Id: <3afaefed.4ee7$39a@news.op.net>

In article <pqalftcopgu5addk8tkd0rlnfgujp1pef6@4ax.com>,
Lou Moran  <lmoran@wtsg.com> wrote:
>$pwd =~
>y/A-Za-z/2223334445556667778889990022233344455566677788899900/;

May I suggest:

        $pwd =~ y/A-Z/a-z/;
        $pwd =~ y/a-z/22233344455566677788899900/;
        #             abcdefghijklmnopqrstuvwxyz

The first time I saw your y/// line, I had to grovel over it to make
sure that the two halves were the same.  With my version, you don't
need to do that.

-- 
@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: Thu, 10 May 2001 20:19:40 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: how can I insert into a open file
Message-Id: <slrn9fltus.cp9.abigail@tsathoggua.rlyeh.net>

u153839111@spawnkill.ip-mobilphone.net
(u153839111@spawnkill.ip-mobilphone.net) wrote on MMDCCCVIII September MCMXCIII in <URL:news:l.989396178.1287261962@[202.106.159.34]>:
==  I only know append data in a open file ,but how can I insert into a open file. thank you very much
==   


FAQ


Abigail
-- 
perl -we'$;=$";$;{Just=>another=>Perl=>Hacker=>}=$/;print%;'


------------------------------

Date: Thu, 10 May 2001 20:49:57 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: I *really* don't understand this error message...
Message-Id: <slrn9flvnj.hvs.tjla@thislove.dyndns.org>

"Mein Lufkissenfahrzeug ist voller Aale"
said Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) in 
<9dduk8$qlp$4@mamenchi.zrz.TU-Berlin.DE>:
>According to Koos Pol  <.sig-news>:
>> 
>> Can someone please explain why I get this error on the following code?
>>     print F foo();          #  gives "Hello world!"
>> 
>> Can't locate object method "F" via package "foo" at myscript.pl line 100.
>
>Apparently foo isn't declared to be a sub when this point in compilation
>is reached.  So Perl tries another interpretation using foo as a

Yet another reason why "sub package" as opposed to "package->sub" is
evil perhaps?

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Hackers do it with all sorts of characters.


------------------------------

Date: Thu, 10 May 2001 18:17:05 GMT
From: "Michael A Mayo" <michael-a-mayo@att.net>
Subject: Re: Javascript or Perl ?
Message-Id: <BWAK6.15189$t12.1180637@bgtnsc05-news.ops.worldnet.att.net>

"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote
> > I'd like to learn Javascript and Perl.
> > And the question is which one to learn first ?
>
> Although my personal opinion is Java sucks, learn
> both Perl and Java languages, together.

Bringing up Java when someone mentions Javascript is like bringing up a P-52
WWII fighter plane when someone mentions a Ford car.  The two have nothing
to do with each other, except that they both happen to be programming
languages.

Your post is based on the (ignorant) assumtion that Java and Javascript are
related.  Java and Javascript are about as closely related as Java and
Lisp - which is to say, not at all.

I fail to see how anyone who claims to be a professional web programmer
could confuse
the two.

            -Mike








------------------------------

Date: Thu, 10 May 2001 14:25:22 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: Javascript or Perl ?
Message-Id: <36nlftok9ebq0ce9vrlr0i426itlk06d02@4ax.com>

On Thu, 10 May 2001 18:17:05 GMT, "Michael A Mayo"
<michael-a-mayo@att.net> wrote wonderful things about sparkplugs:


>Bringing up Java when someone mentions Javascript is like bringing up a P-52
>WWII fighter plane when someone mentions a Ford car.  The two have nothing
>to do with each other, except that they both happen to be programming
>languages.
>

Are you saying JAVA does't exist; like the P-52?

--
print "\x{263a}" 


------------------------------

Date: Thu, 10 May 2001 15:38:21 -0400 (EDT)
From: RTCamm@webtv.net (Art C)
Subject: Re: Javascript or Perl ?
Message-Id: <6676-3AFAEE2D-15@storefull-281.iap.bryant.webtv.net>

Depends on how you entered "the programming world".  Some with no prior
programming experience will first learn Javascript, which provides a
conceptual and contextual frame in which to at least begin with PERL.
Others take it the other way, having had experience with other higher
level languages, such as Visual Basic, which also has similarities to
PERL.

Yours is an open-ended question.  It can go either way based on previous
programming experience.

Art



------------------------------

Date: Thu, 10 May 2001 21:33:46 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: Local Time
Message-Id: <_ODK6.308$du2.29998@news.shore.net>

Abigail <abigail@foad.org> wrote:
: By the time an attacker gets to install a program in your PATH, you
: are comprimised already. Don't give yourself a false sense of security
: that using "localtime" gives you any additional security.

Wow. I'm back on clpm for only a couple of days and I'm already agreeing
with Abigail. Is that a sign of forthcoming apocalypse?

--Art


------------------------------

Date: Thu, 10 May 2001 21:41:10 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: Local Time
Message-Id: <WVDK6.309$du2.29998@news.shore.net>

Craig Berry <cberry@cinenet.net> wrote:
: Demonstrating awtdi would have been fine (and wouldn't have triggered
: criticism, I'll wager) if he had noted the security and other issues
: involved.  Knowingly posting code which is much less secure than another
: equally simple possible implementation, without pointing out that security
: problem, is irresponsible.  Posting insecure code unknowingly is grounds
: for criticism regarding the poster's level of expertise.

I think the "insecurity" of using `date` to retrieve a date string has
been, shall we say, somewhat overstated in this thread. Not everyone is
writing enterprise-level mission-critical apps in perl. Some of us are
just writing admin scripts to help us maintain our servers or whatnot.
Some of us are writing silly little CGI hacks (see
http://www.agitators.com/bin/bingo.cgi). Some people are even actually
rank newbies, learning to code perl and having enough trouble figuring out
how the fershlugginer thing works without being berated over security
because every single script they've ever written doesn't necessarily run
with taint mode, -w and use strict.

Granted, using
	my $date = `date`;
instead of 
	my $date = localtime;

is pretty silly, and something that newbies should probably be advised
against in most cases (maybe they want to quickly format the date using
command line switches and that's a lot easier than using localtime and
sprintf), but to introduce the issue of security without knowing the first
thing about what sort of application `date` will be used in or what it's
intended for is, IMO, a complete red herring.

--Art


------------------------------

Date: Thu, 10 May 2001 19:52:03 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Need help
Message-Id: <3AFAF162.95D7BA12@acm.org>

Per- Fredrik Pollnow wrote:
> 
> Hi,
> Can someone please help me........... I have tried and tried but I can't get
> it to work
> The thing is that I want the AVE value form the VMS_ING_SYS row and
> DB_LOC_01 row printed in to a file.
> This is what I have:
> 
> use strict;
> my ($d, $x, @z);
> open (DISK, "MONI_DISK.LOG") || die "Can't open file $!\n";
> open (NEW, "> new.txt") || die "Can't open file $!\n";
> 
> print "WMS_ING_SYS\tDB_LOC_01\n";
> while ($x = <DISK>) {
>        $x =~ s/[^:]+://;
>        $x =~ s/[^\s]*\w//;
>        $x =~ s/[)]//;
>        $x =~ s/[\s]+//;
>        @z = (split / /, $x);
>             foreach ($z[0] =~ /VMS_ING_SYS/) {
>             print "$z[16]\t\t";
>             }
>             foreach ($z[0] =~ /DB_LOC_01/) {
>             print "$z[16]\n";
>             }
> }

This will do what you want (given the supplied data.)

#!/usr/bin/perl -w
use strict;
open DISK, "MONI_DISK.LOG" or die "Can't open MONI_DISK.LOG: $!";
open NEW,  "> new.txt"     or die "Can't open new.txt: $!";

print "VMS_ING_SYS\tDB_LOC_01\n";
while ( <DISK> ) {
    my $ave = (split " ")[-3];
    print "$ave\t\t" if /\bVMS_ING_SYS\b/;
    print "$ave\n"   if /\bDB_LOC_01\b/;
    }


John
-- 
use Perl;
program
fulfillment


------------------------------

Date: Thu, 10 May 2001 18:49:27 GMT
From: "Josh" <jap108864@Home.com>
Subject: New Perl Script
Message-Id: <XoBK6.13696$V5.2527755@news1.rdc1.mi.home.com>

Hello could some one make me  a perl script i Think its a easy script well
If you want to help

E-mail me Jap108864@home.com




------------------------------

Date: Thu, 10 May 2001 11:57:13 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: New Perl Script
Message-Id: <3afae488$1@news.microsoft.com>

"Josh" <jap108864@Home.com> wrote in message
news:XoBK6.13696$V5.2527755@news1.rdc1.mi.home.com...
> Hello could some one make me  a perl script i Think its a easy script well
> If you want to help

You may want to try one of the "jobs.offered" NGs

jue




------------------------------

Date: 10 May 2001 19:12:43 +0100
From: nobull@mail.com
Subject: Re: O_RDONLY" isn't numeric in entersub at ....
Message-Id: <u9bsp1jco4.fsf@wcl-l.bham.ac.uk>

Mark Grimshaw <m.grimshaw@salford.ac.uk> writes:

> > See?  We told you that not using strict would come back to bite you.
> > 
> 
> Golly! - turned on strict in my script then hurriedly turned it off...
> :)

Yes the pain of retro-fitting strict conformance can be almost as bad
as the pain of not having it on in the first place.
 
> >   (F) With "strict subs" in use, a bareword is only allowed as a
> >   subroutine identifier, in curly brackets or to the left of the "=>" symbol.
> >   Perhaps you need to predeclare a subroutine?
> 
> curly braces did the trick - thanks.

Er, no it's the _last_ sentenence that holds the answer.

> > BTW: Is there any reason why are you instructing Perl to suppress the
> > prototype of the open_user_db() function?
> 
> ?????

Well is there?  That's what the & in &foo() means.

> > > In another CGI script (part of the same suite), I use exactly the same
> > > code character for character and it calls the same function from the
> > > same external module yet does not write the same errors to the apache
> > > error log.
> 
> What I meant was that the use of exactly the same functions did not
> write ANY error/warning messages etc. to the error logs.

I know that is what you meant.  My response made it perfectly clear
that I knew what you meant.

Consider the following:

In one script:
  foo; # Works fine

In another:
  foo; # Gives an error

The difference?  In the first one the function foo was defined. 

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: Thu, 10 May 2001 20:31:38 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Perl 2 Exe
Message-Id: <slrn9flula.cp9.abigail@tsathoggua.rlyeh.net>

Tony Van der Voort (tvdv@advalvas.be) wrote on MMDCCCVII September
MCMXCIII in <URL:news:3af872a5.51524068@news.skynet.be>:
""  Dear all,
""  
""  I'm doing tests with Perl2Exe for linux, but before I want to spend
""  150$ to buy the official version, i want to be shure that i can do
""  everything i want with it. The demo version is too limited to test all
""  the option (no tiny and small mode). Can some borrow me a registration
""  code ? I assume you that this is just for test. I buy immediatly my
""  own version after a positive evaluation of this tool.


The May issue of Dr. Dobbs discusses Perl2exe.

Conclusion: it's ok to use it if your goal is to distribute a single
file. Don't use it for speed up, code hiding or security.

Just like what the FAQ says, actually.



Abigail
-- 
perl -wle 'sub _ "Just another Perl Hacker"; print prototype \&_'


------------------------------

Date: Thu, 10 May 2001 13:54:18 -0700
From: "Barry Trottier" <barry@website.ws>
Subject: RTF -> PDF
Message-Id: <3afaffd4$0$171@wodc7nh6.news.uu.net>

Is there anything out there that converts from RTF to PDF?




------------------------------

Date: Thu, 10 May 2001 21:31:53 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: RTF -> PDF
Message-Id: <3AFB08CA.FD0B16C9@acm.org>

Barry Trottier wrote:
> 
> Is there anything out there that converts from RTF to PDF?

MS Word, StarOffice, WordPerfect, ...

What is your Perl question?


John
-- 
use Perl;
program
fulfillment


------------------------------

Date: 10 May 2001 18:27:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: setting environment variables
Message-Id: <9demhm$jsr$2@mamenchi.zrz.TU-Berlin.DE>

According to Fredrik de Vibe  <fredrik@devibe.net>:
> Hi
> 
> There's probably a simple solution to this, but I just can't find it.
> How do I set environment variables (like *nix' export, i.e. 'export
> PRINTER=printername') in perl?
> I tried $ENV{'PRINTER'} = "printername";, but that only worked while
> I was inside the script. Anybody know how to make this "permanent"?

That's a faq, and "perldoc -q environment" takes you there.  The short
answer is, you can't make it "permanent".

Anno


------------------------------

Date: Thu, 10 May 2001 20:50:32 +0200
From: Philip Newton <pne-news-20010510@newton.digitalspace.net>
Subject: Re: setting environment variables
Message-Id: <eiolft094s2ekoh7moo91ipcc7l6phm0km@4ax.com>

On Thu, 10 May 2001 19:58:13 +0200, Fredrik de Vibe <fredrik@devibe.net> wrote:

> I tried $ENV{'PRINTER'} = "printername";, but that only worked while
> I was inside the script. Anybody know how to make this "permanent"?

perldoc -q environment. RTFFAQ.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


------------------------------

Date: Thu, 10 May 2001 12:17:04 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: setting environment variables
Message-Id: <3AFAE930.65FB3F70@stomp.stomp.tokyo>

Fredrik de Vibe wrote:


> There's probably a simple solution to this, but I just can't find it.
> How do I set environment variables (like *nix' export, i.e. 'export
> PRINTER=printername') in perl?

> I tried $ENV{'PRINTER'} = "printername";, but that only worked while
> I was inside the script. Anybody know how to make this "permanent"?

Without more clear and concise parameters, it is difficult to
ascertain your final goal. Like all variables and returns from
a Perl script, special environmental variables are only good
while a script executes.

However, if you are running an Apache webserver or a webserver
which is configurable much like Apache, this information might
be of help, depending on your final goal, which is not clear.
Possibly, this site might inspire alternative ideas. Have a
look at this site; it might be of benefit to you.

http://httpd.apache.org/docs/mod/mod_env.html#setenv


Godzilla!


------------------------------

Date: Thu, 10 May 2001 12:24:25 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: setting environment variables
Message-Id: <3AFAEAE9.6E9FE59@stomp.stomp.tokyo>

Godzilla! wrote:
 
> Fredrik de Vibe wrote:
 
(snipped)

> look at this site; it might be of benefit to you.
 
> http://httpd.apache.org/docs/mod/mod_env.html#setenv
 
I meant to include this and forgot. There is a link
at this above site I feel you should explore. It is
more generic in nature and might be of benefit, as well.

http://httpd.apache.org/docs/env.html

Godzilla!


------------------------------

Date: 10 May 2001 13:36:53 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: setting environment variables
Message-Id: <m3pudhm4oq.fsf@dhcp9-172.support.tivoli.com>

On Thu, 10 May 2001, fredrik@devibe.net wrote:

> There's probably a simple solution to this, but I just can't find
> it.  How do I set environment variables (like *nix' export,
> i.e. 'export PRINTER=printername') in perl?  I tried $ENV{'PRINTER'}
> = "printername";, but that only worked while I was inside the
> script. Anybody know how to make this "permanent"?

Get to know the documentation included with Perl, including the FAQ.

$ perldoc -q environment        
Found in /usr/lib/perl5/5.6.0/pod/perlfaq8.pod
       I {changed directory, modified my environment} in a perl
       script.  How come the change disappeared when I exited the
       script?  How do I get my changes to be visible?

               Unix
                   In the strictest sense, it can't be done --
                   the script executes as a different process
                   from the shell it was started from.  Changes
                   to a process are not reflected in its parent,
                   only in its own children created after the
                   change.  There is shell magic that may allow
                   you to fake it by eval()ing the script's
                   output in your shell; check out the
                   comp.unix.questions FAQ for details.

-- 
Ren Maddox
ren@tivoli.com


------------------------------

Date: Thu, 10 May 2001 20:01:35 +0100
From: "Stuart Lowes" <stuart@zerostate.co.uk>
Subject: Source Documenter
Message-Id: <TvBK6.4332$po.738486@news6-win.server.ntlworld.com>

Hi

Can anyone suggest a perl source code documenter programs preferably for
win32 but I do have access to linux or unix if necessarily.

Thanks

Stu




------------------------------

Date: 10 May 2001 13:57:40 -0500
From: andrew_perrin@unc.edu (Andrew J. Perrin)
Subject: Re: using MS Access (*.mdb) w/perl?
Message-Id: <87oft1rpzv.fsf@nujoma.perrins>

yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) writes:

> fiat_lux (dab727@yahoo.com) wrote:
> : I'm in hot water to get a class project done. Basically I need to be able to
> : add/delete/query a MS Access 2000 database with perl. I told them not to use
> : Access, but they wouldn't listen and now there's no other choice.
> 
> : The extent of my perl/cgi knowledge is only manipulating HTML forms (ie.
> : emailing the data somewhere, or making "mad-libs" out of the form fields). I
> : have no clue how to access a database, let alone an MS Access *.mdb one. I
> : would most grateful if someone had some pointers for me. Even some sample
> : code would be a life-saver.
> 
> : Many thanks in advance. This is perl running on Windows, for the record. I'm
> : using the sambar web server and it's executing perl scripts just fine.
> 
> 
> DBI  
> 
> DBD - specificly the ODBC driver for DBI
> 
> 
> Never used this combination so I can't say more.
> 

Only thing I'd add is that the docs for DBD::ODBC contain examples
specific to Access, to you should be fine with them.

-- 
----------------------------------------------------------------------
Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology  
(Soon: Asst Professor of Sociology, U of North Carolina, Chapel Hill)
andrew_perrin@unc.edu - http://www.unc.edu/~aperrin


------------------------------

Date: 10 May 2001 19:04:50 +0100
From: nobull@mail.com
Subject: Re: weird error on @array syntax
Message-Id: <u9eltxjd19.fsf@wcl-l.bham.ac.uk>

"Godzilla!" <godzilla@stomp.stomp.tokyo> writes:

> Mark Jason Dominus wrote:

> > Wrong.  Perl never does this.  @ in a string is *always* interpreted
> > as an array interpolation, since version 5.000.

MJD is being careless here, he mis-read what he was responding to and
so did not to realise that "this" here effectively refers to "generate
the error: In string, @a now must be written as \@a".

> Personally, I am sticking with Berry on this one for
> three good reasons; he is knowledgeable, he makes good
> sense and he is polite. My latter reason being of
> greatest importance.

Godzilla sticking with people who are knowledgible and make sense?
Is this a one-off or a policy change?

MJD making carelessly false statements?  This isn't the only one in
the last few weeks.  Tad's been doing this quite a bit lately too.
Something is definitely strange in the state of c.l.p.* lately.

As Berry put it:

  I must admit that I have not been the greatest fan of your postings in
  the past, but your stuff has improved markedly in tone and content of
  late, and I welcome the change -- and I've always enjoyed your sense
  of humor, which is a key asset for any programmer.

I also welcome the change.  But then it happened once before - and
then Kira slipped back into her old ways.

Actually I think the Kira's sense of humor can be a bit cruel, and
as regular readers will appreciate, coming from NoBull that's quite a
strong statement.

Godzilla, since you say that you consider "being polite" to be "of
greatest importance" does this mean I can expect you to stop attacking
people with disabilities?  (In particular my dyslexia).  Some of your
spelling/grammar flames have really gone well beyond good natured banter. 

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: Thu, 10 May 2001 19:03:54 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: weird error on @array syntax
Message-Id: <3afae613.4dcb$298@news.op.net>

In article <m3vgn9ntb4.fsf@dhcp9-172.support.tivoli.com>,
Ren Maddox  <ren@tivoli.com> wrote:
>> Wrong.  Perl never does this.  @ in a string is *always* interpreted
>> as an array interpolation, since version 5.000.
>Um... perl -le 'print "@"'

If you wanted to be a literalist ass, why didn't you mention

        print "\@a"     # @ in this string does not interpolate an array

and

        print '@a';     # @ in this string does not interpolate an array

and

        print "$z[@a]"; # @ in this string does not interpolate an array

and

        print "\x40a";  # @ in this string does not interpolate an array

blah blah blah blah.  Do I have to qualify every remark with a zillion
trivial and irrelevant exceptions, when any fool can see that they are
not part of the issue under discussion?  Can we have a conversation
about technical issues without fussbudgeting?  Can we discuss
interpolation of arrays into strings without also treating all
possible issues of source vs. internal representation and all the many
and varied rules about interpolation generally?  What is gained by
this level of nitpicking?
-- 
@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: Thu, 10 May 2001 18:55:01 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: weird error on @array syntax
Message-Id: <3afae3fd.4d98$34b@news.op.net>

In article <u9eltxjd19.fsf@wcl-l.bham.ac.uk>,  <nobull@mail.com> wrote:
>MJD is being careless here, he mis-read what he was responding to 

Having reread both articles more carefully, I have come to the
conclusion that you are mistaken, and that I was right.

>MJD making carelessly false statements?  

I make false statements all the time.  For example, the section on my
'at error' article that Ren Maddox quoted was a deliberate falsehood.
(He apparently didn't understand this.)  But not this time.

False perhaps, but not carelessly so.

-- 
@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: Thu, 10 May 2001 19:13:10 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: weird error on @array syntax
Message-Id: <3afae845.4e07$24f@news.op.net>

In article <u9eltxjd19.fsf@wcl-l.bham.ac.uk>,  <nobull@mail.com> wrote:
>> Mark Jason Dominus wrote:
>
>> > Wrong.  Perl never does this.  @ in a string is *always* interpreted
>> > as an array interpolation, since version 5.000.
>
>MJD is being careless here, he mis-read what he was responding to and
>so did not to realise that "this" here  effectively refers to ...

The part of Craig's post to which I was responding did not contain the
word 'this'.

For clarification: I was specifically objecting to the 'leaps to the
conclusion' part.  If Perl "leaps to the conclusion that you are trying
to write a literal '@'" then there would be no need for it to issue an
error message; it would just interpret the @ as a literal @, and
continue executing.  The error message is there precisely because Perl
*does not* leap to that conclusion; Perl is not sure what you meant,
and since it is not sure, it aborts execution.

So no, I was not being careless.  Elliptical, perhaps.

-- 
@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: Thu, 10 May 2001 19:36:33 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: weird error on @array syntax
Message-Id: <tflre16l7p2b5f@corp.supernews.com>

Mark Jason Dominus (mjd@plover.com) wrote:
: >In brief, the Perl compiler cannot, at compiler time, see any other
: >reference to @a anywhere in your program, so it leaps to the conclusion
: >that you are trying to write a literal '@' rather than trying to
: >interpolate @a. 
: 
: Wrong.  Perl never does this.  @ in a string is *always* interpreted
: as an array interpolation, since version 5.000.

That was what I was trying to say, though perhaps I phrased it poorly.
Restated:  "Seeing array interpolation of an unknown array variable, perl
suspects you may have intended a literal @ and (old versions) errors out
or (new version) warns you about it."

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "God becomes as we are that we may be as he is."
   |               - William Blake


------------------------------

Date: 10 May 2001 14:42:40 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: weird error on @array syntax
Message-Id: <m3lmo5m1n3.fsf@dhcp9-172.support.tivoli.com>

On Thu, 10 May 2001, mjd@plover.com wrote:

> In article <m3vgn9ntb4.fsf@dhcp9-172.support.tivoli.com>,
> Ren Maddox  <ren@tivoli.com> wrote:
>>> Wrong.  Perl never does this.  @ in a string is *always*
>>> interpreted as an array interpolation, since version 5.000.
>>Um... perl -le 'print "@"'
> 
> If you wanted to be a literalist ass, why didn't you mention

Well, it certainly wasn't my intent to be a literalist of any kind.  I
just felt that you were stressing the array interpolation a bit to
strongly, particularly with your emphasis on "always".  In fact, I
only added that line as an afterthought to the subsequent text of my
post.

[other examples snipped]

> blah blah blah blah.

Does this imply that you didn't read the rest of my post?  Such as the
part where I quoted your URL reference as making the same type of
statement that you above sited as being "wrong"?

I'm fully aware that you know the whys and what-fors that apply here.
I was only observing that you were calling Craig on a statement that
was only vaguely incorrect, yet your correction was at least as
technically incorrect as the original statement.

> Do I have to qualify every remark with a zillion trivial and
> irrelevant exceptions, when any fool can see that they are not part
> of the issue under discussion?

Of course not.  But relevant ones should be included.  This seems very
similar to the recent thread about `date` where the poster was
criticized for not including the caveats regarding possible security
exposures of that method.  One might make the case that if your at all
concerned about security, then it is obvious that there are security
concerns with `date`, so pointing out those concerns for that specific
example is pretty silly.

> Can we have a conversation about technical issues without
> fussbudgeting?  Can we discuss interpolation of arrays into strings
> without also treating all possible issues of source vs. internal
> representation and all the many and varied rules about interpolation
> generally?  What is gained by this level of nitpicking?

What might be gained is that some people will gain a better
understanding of how and why they see the behavior that they see.

In another post in this thread you state:

> For clarification: I was specifically objecting to the 'leaps to the
> conclusion' part.  If Perl "leaps to the conclusion that you are
> trying to write a literal '@'" then there would be no need for it to
> issue an error message; it would just interpret the @ as a literal
> @, and continue executing.  The error message is there precisely
> because Perl *does not* leap to that conclusion; Perl is not sure
> what you meant, and since it is not sure, it aborts execution.

However, the old error message

  $ perl -le 'print "@a"'
  Literal @a now requires backslash at -e line 1, within string
  Execution of -e aborted due to compilation errors.

certainly makes it seem that Perl *did* leap to that conclusion.

The newer message:

  $ perl -le 'print "@a"'
  In string, @a now must be written as \@a at -e line 1, near "@a"
  Execution of -e aborted due to compilation errors.

sounds about the same really.

You could certainly make the case that this is more of a
look-before-you-leap situation where Perl sees the abyss and refuses
to jump, and I can accept that.

Would it make any difference if Craig's original statement had been:

  ... so it leaps to the conclusion that you *might* be trying to
  write a literal '@' ...

Of course, given the context that we know that Perl 4 did make the
full leap to literal '@', it seems reasonable to interpret Perl 5's
behavior as making the same leap with the change that the result of
the leap is an error.  Perl 5.6.1's behavior is certainly preferred as
it allows for interpolation of arrays that did not exist at compile
time.

I'm sorry that you took offense at my post -- that was certainly not
my intent.

-- 
Ren Maddox
ren@tivoli.com


------------------------------

Date: 10 May 2001 14:50:08 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: weird error on @array syntax
Message-Id: <m3heytm1an.fsf@dhcp9-172.support.tivoli.com>

On Thu, 10 May 2001, mjd@plover.com wrote:

> I make false statements all the time.  For example, the section on
> my 'at error' article that Ren Maddox quoted was a deliberate
> falsehood.  (He apparently didn't understand this.)  But not this
> time.

So I've re-read your deliberate falsehood several times, and the only
way I can make everything mesh is by assuming that you were just
oversimplifying for the sake of, well, making it simple.  And I'm
perfectly fine with that.  But how do you not afford Craig the same
luxury?

-- 
Ren Maddox
ren@tivoli.com


------------------------------

Date: Thu, 10 May 2001 20:34:52 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: What's wrong with my loop?
Message-Id: <slrn9flurc.cp9.abigail@tsathoggua.rlyeh.net>

Vaughan McAlley (vaughan@timboonmusic.com) wrote on MMDCCCIX September
MCMXCIII in <URL:news:B7204C80.1F0D%vaughan@timboonmusic.com>:
::  Hello,
::  
::  This code doesn't give me my beloved Internal Server Error, but the loop
::  doesn't run. I've checked the syntax against the obscure examples about five
::  times and can't find anything wrong. What's the matter?
::  
::  Thanks,
::  
::  Vaughan
::  
::  
::  @POSTAGE{'0airmail', 'NZairmail', 'NZecon_air', '1airmail', '1econ_air',
::  '4airmail', '4econ_air', '4seamail', '5airmail', '5econ_air', '5seamail'} =
::  ('', '', '', '', '', '', '', '', '', '', '' );

This populates the hash %POSTAGE.

::      foreach my $temp (@POSTAGE) {
::  #       $temp = <CHARGES>;   # read in the postage from charges file
::          print "This loop is running<BR>\n";
::      }

This loops over @POSTAGE, which, unless there's code elsewhere, is empty.


I bet you aren't using 'use strict;'.



Abigail
-- 
perl -le 's[$,][join$,,(split$,,($!=85))[(q[0006143730380126152532042307].
          q[41342211132019313505])=~m[..]g]]e and y[yIbp][HJkP] and print'


------------------------------

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 872
**************************************


home help back first fref pref prev next nref lref last post