[10692] in Perl-Users-Digest
Perl-Users Digest, Issue: 4283 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 24 14:07:24 1998
Date: Tue, 24 Nov 98 11:01:27 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 24 Nov 1998 Volume: 8 Number: 4283
Today's topics:
Re: "ELSE" command in Perl?? (Rich)
Re: "ELSE" command in Perl?? (Mike Stok)
Re: $_[0] pass by reference ? <tchrist@mox.perl.com>
Re: ??? Perl iis downloaded with Personal Web Server ? <gellyfish@btinternet.com>
[Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
a regexp question (Antti-Jussi Korjonen)
Re: a regexp question (Matthew Bafford)
Re: a regexp question (Bart Lateur)
Re: a regexp question (David Alan Black)
Re: a regexp question (Tad McClellan)
Re: a regexp question (Andre L.)
Re: a regexp question (Mike Stok)
Re: AAA Anyone out there need the full step by step ins <gellyfish@btinternet.com>
Any ideas? <lin@wdg.mot.com>
Re: Any ideas? <Allan@due.net>
Re: Any ideas? (Tad McClellan)
Re: Any ideas? (Tad McClellan)
AnyDBM ans sync-ing (Mike Willett LADS LDN X7563)
Re: appending <gellyfish@btinternet.com>
Can't edit web generated files <gss2@roogna.eng.wayne.edu>
Re: Changing defaults defined in other file (Tad McClellan)
Re: Changing the env variables? <dan@clockwork.net>
Closing bad pipe, empty $! (Robert Devereaux)
copy a file - How? <airman@inreach.com>
CPerlObj <gerhard@uni-x.net>
creating pop account <vpaquin@toile-sherbrooke.com>
Crypt and decrypt string <gicarone@istat.it>
Re: Crypt and decrypt string <jhoglund@mirage.skypoint.net>
crypt <tbsmith@viper.net>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Nov 1998 00:33:11 GMT
From: richm@ucesucks.mulveyr.roc.servtech.com (Rich)
Subject: Re: "ELSE" command in Perl??
Message-Id: <slrn75jvk4.5mv.richm@ll.aa2ys.ampr.org>
On Mon, 23 Nov 1998 21:53:17 +0100, Jeroen Roeper <lookitsme@cyberspam.com> wrote:
>Hi perl wizards,
>
>a question, I have a Perl script that displays a flat text database. Now I
>want to know if there is such thing as the If-Then-Else command such as in
>VB
>
>This is the chunk of code I use now, but it doesn't seem to work, any
>ideas??
>
> if( $web = "" )
> {
> print "<b>$com</b><br>";
> else
> print "<a href=\"$web\">$com</a>";
> }
>
You might want to look up the difference in syntax between the comparison
and assignment operators, not to mention the details about which ones to use
for different datatypes.
- Rich
--
Rich Mulvey
My return address is my last name,
followed by my first initial, @mulveyr.roc.servtech.com
http://mulveyr.roc.servtech.com
Amateur Radio: aa2ys@wb2wxq.#wny.ny.usa
------------------------------
Date: 24 Nov 1998 01:03:12 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: "ELSE" command in Perl??
Message-Id: <73d0kg$c9c@news-central.tiac.net>
In article <73clid$ama$1@camel21.mindspring.com>, AmD <Allan@due.net> wrote:
>Shoot, I forgot to mention your code still won't work. Better check out eq
>as compared to == when comparing because I am pretty darn sure you don't
>mean = in your if statement, it is always true. It sets $web to "".
Surely you mean it's always false, as the if sees a logical value of the
"result" of the assignment, and the empty string is a false value in perl
- any other defined string apart from the one character '0' would be
considered true.
Your original point of using $web eq "" rather than $web == "" or $web =
"" still stands as it's most likely that the original person meant $web eq
"" and didn't realise that the other two have behaviour which may surprise
people who haven't read the docs or used the -w flag while developing
their code.
Mike
>AmD wrote in message <73cl0r$t0c$1@camel21.mindspring.com>...
>>Jeroen Roeper wrote in message <73cht7$oib$1@news2.xs4all.nl>...
[...]
>>> if( $web = "" )
>>> {
>>> print "<b>$com</b><br>";
>>> else
>>> print "<a href=\"$web\">$com</a>";
>>> }
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 24 Nov 1998 03:44:29 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: $_[0] pass by reference ?
Message-Id: <73da2t$jtj$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Rakesh Puthalath <rakesh_puthalath@hotmail.com> writes:
A($x);
:sub A
:{
: $subvar = shift;
:\xa0 $subvar = shift;
You just shifted off your @_. shift modifies its array. Those are no
longer available.
:\xa0 $subvar = 'John';
:\xa0 $_[0] = 'John';
:\xa0 print $subvar, "\n";
:}
BTW, you used:
Content-Type: text/plain; charset=x-user-defined
I don't know how I'm supposed to display that charset.
What is this hex 0xA0 character, anyway?
--tom
--
I believe in the waterbed theory of linguistics.
If you push down here, it pops up there.
-- <1993Jan20.181244.8680@netlabs.com>
------------------------------
Date: 23 Nov 1998 23:17:59 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: ??? Perl iis downloaded with Personal Web Server ????
Message-Id: <73cqf7$js$1@gellyfish.btinternet.com>
On Sun, 22 Nov 1998 10:38:02 -0500 thierry tastiel <tastiel@email.msn.com> wrote:
> When testing my perl programs locally, the code is downloaded instead of
> executed.
> I'm using Windows 98, Personal Web Server and II4 or Netscape 4.5.
>
> How should I configure the .pl files ?
>
This is to do with the configuration of the Server and nothing specific to
do with Perl, despite this it has been asked and answered many times on this
group - which a search of DejaNews would indicate.
Alternatively you could ask in comp.infosystems.www.servers.ms-windows
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Tue, 24 Nov 1998 11:24:02 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage911906641.26158@news.teleport.com>
Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 10 Sep 1998
[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last major update of the Perl FAQ was in Summer of
1998; of course, ongoing updates are made as needed. ]
For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).
http://cpan.perl.org/doc/FAQs/
Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.
perldoc perlfaq
man perlfaq
If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.
If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.
http://cpan.perl.org/
http://www.perl.com/CPAN/
http://cpan.perl.org/doc/FAQs/FAQ/html/
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/
You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)
California ftp://ftp.cdrom.com/pub/perl/CPAN/
Texas ftp://ftp.metronet.com/pub/perl/
South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
Australia ftp://cpan.topend.com.au/pub/CPAN/
Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
Another possibility is to use one of the FTP-via-email services; for
more information on doing that, send mail to <mail-server@rtfm.mit.edu>
(not to me!) with these lines in the body of the message, flush left:
setdir usenet-by-group/news.announce.newusers
send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.
Have fun with Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 24 Nov 1998 12:57:17 GMT
From: aajii@raaseri.ton.tut.fi (Antti-Jussi Korjonen)
Subject: a regexp question
Message-Id: <73eafd$ju0$1@baker.cc.tut.fi>
HI!
po1-4;;;;;1:auto
I need to split this line into two parts and it has to be splitted
from the first ";" -> "po1-4" and ";;;;1:auto". I tried using word
boundary split(/\b;/,$temp), it worked for this one, but not for
a case like po1-;;;;;1:auto.
The question is, how do I tell perl to use only the FIRST match in
splitting and leave it that way?
I don't want any answers telling me to read the perldoc...
--
__/ __/ __/ __/ Antti-Jussi Korjonen
__/ __/ __/ __/ __/__/ Vaajakatu 5 D 85
__/ __/ __/ __/ __/__/ 33720 TAMPERE, FINLAND
__/ __/ __/__/__/ __/ __/ tel. +358-(0)40-577 83 23
Antti-Jussi.Korjonen@sonera.fi
--------->> http://www.students.tut.fi/~k150556 <<---------
------------------------------
Date: Tue, 24 Nov 1998 08:02:55 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: a regexp question
Message-Id: <MPG.10c4788a14db67f4989730@news.scescape.net>
In article <73eafd$ju0$1@baker.cc.tut.fi>, aajii@raaseri.ton.tut.fi
says...
=> HI!
=>
=> po1-4;;;;;1:auto
=> I need to split this line into two parts and it has to be splitted
^^^^^ ^^^^^
=> from the first ";" -> "po1-4" and ";;;;1:auto". I tried using word
=> boundary split(/\b;/,$temp), it worked for this one, but not for
=> a case like po1-;;;;;1:auto.
=>
=> The question is, how do I tell perl to use only the FIRST match in
=> splitting and leave it that way?
=>
=> I don't want any answers telling me to read the perldoc...
Whoops, and here I was going to help you out...
With an attitude like that, I'd say look in perlfunc.
FYI: The sigline needs a space after it... (Ie: '-- ').
Also, splitted is not a word -- it's 'split'.
Hope This Helped!
--Matthew
------------------------------
Date: Tue, 24 Nov 1998 13:36:04 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: a regexp question
Message-Id: <365ab5dd.2137021@news.skynet.be>
Antti-Jussi Korjonen wrote:
>po1-4;;;;;1:auto
>I need to split this line into two parts and it has to be splitted
>from the first ";" -> "po1-4" and ";;;;1:auto".
>The question is, how do I tell perl to use only the FIRST match in
>splitting and leave it that way?
I can see two ways at a first glance.
A) ($first,$rest) = split /;/,$_,2; # split into 2 parts
B) /;/; $first = $`; $rest = $';
Bart.
------------------------------
Date: 24 Nov 1998 09:18:37 -0500
From: dblack@pilot.njin.net (David Alan Black)
Subject: Re: a regexp question
Message-Id: <73ef7t$dso$1@pilot.njin.net>
Hello -
aajii@raaseri.ton.tut.fi (Antti-Jussi Korjonen) writes:
>HI!
>po1-4;;;;;1:auto
>I need to split this line into two parts and it has to be splitted
>from the first ";" -> "po1-4" and ";;;;1:auto". I tried using word
>boundary split(/\b;/,$temp), it worked for this one, but not for
>a case like po1-;;;;;1:auto.
>The question is, how do I tell perl to use only the FIRST match in
>splitting and leave it that way?
>I don't want any answers telling me to read the perldoc...
OK - in that case, read _Anna Karenina_. My favorite part is when Anna
throws herself into Vronsky's arms, crying, "The LIMIT parameter can be
used to split a line partially: ($login, $passwd, $remainder) =
split(/:/, $_, 3); When assigning to a list, if LIMIT is omitted, Perl
supplies a LIMIT one larger than the number of variables in the list, to
avoid unnecessary work. For the list above LIMIT would have been 4 by
default. In time critical applications it behooves you not to split
into more fields than you really need."
David Black
dblack@pilot.njin.net
------------------------------
Date: Tue, 24 Nov 1998 11:55:15 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: a regexp question
Message-Id: <3ure37.luj.ln@flash.net>
Antti-Jussi Korjonen (aajii@raaseri.ton.tut.fi) wrote:
: The question is, how do I tell perl to use only the FIRST match in
: splitting and leave it that way?
: I don't want any answers telling me to read the perldoc...
^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^
That's too bad, because that is where the answer is.
Guess you will just have to continue to wallow in ignorance...
I don't take direction very well, so I'm going to tell
you to read the perldoc anyway:
perldoc -f split
Pay particular attention to the third argument.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 24 Nov 1998 13:30:38 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: a regexp question
Message-Id: <alecler-2411981330380001@dialup-601.hip.cam.org>
In article <73ef7t$dso$1@pilot.njin.net>, dblack@pilot.njin.net (David
Alan Black) wrote:
> Hello -
>
> aajii@raaseri.ton.tut.fi (Antti-Jussi Korjonen) writes:
>
> >I don't want any answers telling me to read the perldoc...
>
> OK - in that case, read _Anna Karenina_. My favorite part is when Anna
> throws herself into Vronsky's arms, crying, "The LIMIT parameter can be
> used to split a line partially: ($login, $passwd, $remainder) =
> split(/:/, $_, 3); When assigning to a list, if LIMIT is omitted, Perl
> supplies a LIMIT one larger than the number of variables in the list, to
> avoid unnecessary work. For the list above LIMIT would have been 4 by
> default. In time critical applications it behooves you not to split
> into more fields than you really need."
Now, *that* is romantic literature. :)
Andre
------------------------------
Date: 24 Nov 1998 18:13:28 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: a regexp question
Message-Id: <73et08$1mv@news-central.tiac.net>
In article <73eafd$ju0$1@baker.cc.tut.fi>,
Antti-Jussi Korjonen <Antti-Jussi.Korjonen@sonera.fi> wrote:
>HI!
>
>po1-4;;;;;1:auto
>I need to split this line into two parts and it has to be splitted
>from the first ";" -> "po1-4" and ";;;;1:auto". I tried using word
>boundary split(/\b;/,$temp), it worked for this one, but not for
>a case like po1-;;;;;1:auto.
>
>The question is, how do I tell perl to use only the FIRST match in
>splitting and leave it that way?
One way might be to say say
($first_part, $rest) = split( /;/, $string, 2 );
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 23 Nov 1998 23:43:14 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: AAA Anyone out there need the full step by step instructions to setup roaming profiles on NT???
Message-Id: <73crui$k1$1@gellyfish.btinternet.com>
On Sun, 22 Nov 1998 13:42:47 -0600 Scott Winterstein <sw12467@advancedits.com> wrote:
> I have the step by step instructions on how to setup roaming profiles. Not
> the hard to understand ones you will find anywhere you look, these are step
> by step. No BS and rhetoric, just the plain facts will trade to some on who
> will build me a perl script that will include passing variables...My hard
> work making it simple for you. For your easy Task of setting up something I
> have very little exp at but enough to learn from someone whos willing to
> help email me at
> scott12467@yahoo.com
>
If you had paid attention you would have discovered how totally against the
spirit of this newsgroup (and indeed the wider Usenet) your post is.
If you had spent some time researching the problem you would have found
some answers. DejaNews for instance.
I'm not interested in roaming profiles either so there you go.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Tue, 24 Nov 1998 09:27:56 -0800
From: Brandon Lin <lin@wdg.mot.com>
Subject: Any ideas?
Message-Id: <365AEC9C.A3980A11@wdg.mot.com>
Hi all,
I want to create a perl script which extracts a data
from a webpage everyday. Can anyone please help
me on this?
I am thinking calling `telnet www.microsoft.com 80`,
then inputing a HTTP request. But this doesn't work.
Or do I need to use a module?
Thanks for your help.
Regards,
Brandon
------------------------------
Date: Tue, 24 Nov 1998 13:36:54 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Any ideas?
Message-Id: <73eu35$dgp$1@camel18.mindspring.com>
Brandon Lin wrote in message <365AEC9C.A3980A11@wdg.mot.com>...
>Hi all,
>
>I want to create a perl script which extracts a data
>from a webpage everyday. Can anyone please help
>me on this?
>I am thinking calling `telnet www.microsoft.com 80`,
>then inputing a HTTP request. But this doesn't work.
>Or do I need to use a module?
Well, the answer just couldn't be more simple, LWP::Simple that is.
#!/usr/local/bin/perl -w
use strict;
use LWP::Simple;
my $htmlinfo = get("http://www.microwsoft.com");
print $htmlinfo;
or
#!/usr/local/bin/perl -w
use strict;
use LWP::Simple;
getprint("http://www.microwsoft.com");
You get the idea.
AmD
------------------------------
Date: Tue, 24 Nov 1998 13:24:46 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Any ideas?
Message-Id: <u51f37.rjk.ln@flash.net>
Brandon Lin (lin@wdg.mot.com) wrote:
: I want to create a perl script which extracts a data
: from a webpage everyday. Can anyone please help
: me on this?
: Or do I need to use a module?
^^^^^^^^^^^^
Yes. (well, you don't *need* to, but you probably *want* to ;-)
use LWP::Simple;
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 24 Nov 1998 13:25:53 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Any ideas?
Message-Id: <181f37.rjk.ln@flash.net>
Brandon Lin (lin@wdg.mot.com) wrote:
: Subject: Re: Any ideas?
Yes.
Putting the subject of your post in your Subject header
seems like a Really Good Idea... ;-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 24 Nov 1998 16:40:30 GMT
From: willettm@ml.NOSPAM,.com (Mike Willett LADS LDN X7563)
Subject: AnyDBM ans sync-ing
Message-Id: <73enhu$gl9$1@news.ml.com>
Hi,
Does anyone know if using NDBM (or the others) automatically
sync up the output files ? It seems to (according to my tests)
but I'd like a 'guarantee' or some sort of caveat ?
Mike
------------------------------
Date: 24 Nov 1998 00:06:32 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: appending
Message-Id: <73cta8$kd$1@gellyfish.btinternet.com>
On Mon, 23 Nov 1998 11:38:33 -0000 Richard Hitchell <richard_h@ttabconnectors.com> wrote:
> Hi- I this is a very simple question but I am new to all this so I apologise
> in advance! I am writing my first perl program and want to append one file
> to another without creating a totally new file, I also need to make sure
> that no characters are added (ascii).
>
> This is how I thought it might be done- but of course it just copies one
> file to the other...
>
> open ( FILE_TO_COPY, $a) || die "cannot open $a for reading: $!";
> open ( MERGEFILE, ">>$b") || die "cannot open $b: $!";
> while (<FILE_TO_COPY>) {
> print MERGEFILE $_;
> }
> print "\nWeekly files merged!";
> close(FILE_TO_COPY);
> close(MERGEFILE);
Are you sure it doesnt do what you want ? The use of >> does open the file
for appending.
I'm not sure if it would matter in this case but generally one should avoid
the variables $a and $b as these are special to Perl as the operands of a
sort function.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Tue, 24 Nov 1998 12:29:30 -0500
From: shienh gurpreet <gss2@roogna.eng.wayne.edu>
Subject: Can't edit web generated files
Message-Id: <365AECFA.656174A4@roogna.eng.wayne.edu>
I have a script that generates web pages and saves them on the server.
My problem is that the new pages generated belong to group "WEB" and I
do not have permissions to modify those pages, if I need to. The
permissions are -rw-r--r--. Please suggest a solution. (Please consider
me a newbie to this server permissions thing and elaborate). Help is
greatly appreciated.
------------------------------
Date: Tue, 24 Nov 1998 11:13:27 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Changing defaults defined in other file
Message-Id: <nfpe37.9qj.ln@flash.net>
Anneke Treep (anneke@echelon.nl) wrote:
: I am writing script that uses defaults from another file, but should
: also be able
: to override these. But somehow it doesn't work yet - the value 7 is
: still being
: used.. What am I doing wrong??
Using a lexically scoped variable.
: file1 - the main script ====================================
: use strict;
: use vars qw($value);
: use mylib;
: # Changing defaults
: $mylib::value = 6; # delete this line if you need the
^^^^^^^^^^^^^
^^^^^^^^^^^^^ access a variable in the Symbol Table of 'mylib' package
: default value
: somefunc();
: ...
: =====================================================
: file2 - my library module =================================
: package mylib;
: use Exporter ();
: @ISA = qw(Exporter);
: @EXPORT = qw(value somefunc);
: @EXPORT_OK = qw();
: %EXPORT_TAGS = ();
: my $value = 7;
^^
^^ lexically scoped (when you use 'my') vars are NOT in the symbol table
use local() instead of my() here
: sub somefunc {
: # use the $value variable
Try this to see that you are accessing two *different* variables
print "\$mylib::value is '$mylib::value' in somefunc()\n";
print "\$value is '$value' in somefunc()\n";
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 23 Nov 1998 20:22:50 -0600
From: Dan Brian <dan@clockwork.net>
Subject: Re: Changing the env variables?
Message-Id: <365A187A.75ADE12D@clockwork.net>
You're right if he's actually trying to modify the parent's env. I had the
impression that he wasn't. He is altering the perl global %ENV which is loaded
from the daemon's env. While not advisable, it is perfectly do-able and works.
O'Reilly's latest "Programming Perl" even illustrates a primary use of 'delete'
as modifying the environment by deleting $ENV{} keys, if only for the life and
scope of that process.
I R A Aggie wrote:
> In article <3659CC62.3B680977@clockwork.net>, Dan Brian
> <dan@clockwork.net> wrote:
>
> + You sure can alter the environment; why are there two posts saying you
> + can't?
>
> YOU CAN NOT MODIFY THE PARENT PROCESS' ENVIRONMENT. The parent process in
> this case will be the http daemon. The moment the original poster's cgi
> script stops, so does any change to the environment.
>
> That's the mechanism he's trying to use to communicate with the customer on
> the other end. His methodolog will simply not work. He needs to send the
> his modifications back thru the http daemon, either as a new page on STDOUT,
> or perhaps as simple as:
>
> print "Location: http://<whatever>/<somethingelse>\n\n";
>
> if he wants these modifications and shifts to appear transparent to the
> customer.
>
> James
------------------------------
Date: 24 Nov 1998 17:29:24 GMT
From: bobdev@fc.hp.com (Robert Devereaux)
Subject: Closing bad pipe, empty $!
Message-Id: <73eqdk$k85@fcnews.fc.hp.com>
I'm running Perl version 5.004_01 on HPUX.
When I execute the following program:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#! /usr/local/bin/perl
sub PipeTest {
open(SENDMAIL, "| /usr/lib/xxsendmail -t")
or return(1, "Pipe open failed ($!).\n");
close(SENDMAIL)
or return(1, "Error on pipe close ($!).\n");
return(1, "No errors\n");
}
($result, $errmsg) = &PipeTest();
print("result is $result\n");
print("errmsg is $errmsg\n");
exit;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
the output is:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
result is 1
errmsg is Error on pipe close ().
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
So why doesn't $! have anything in it? Help, anyone? Thanks!
--
Bob Devereaux
Software and Services Group R&D
HP Fort Collins
1-970-898-3423
------------------------------
Date: Tue, 24 Nov 1998 18:20:18 GMT
From: "L. Birdwell" <airman@inreach.com>
Subject: copy a file - How?
Message-Id: <365AF97F.A878AFE7@inreach.com>
I am trying to copy a .gif file from one directory on my server to a new
one I am creating. I can create the directory fine, but I don't know how
to copy a file to it???
I am trying:
open (FILE, ">$path/images/main_bnr.gif");
print FILE main_bnr.gif; (Where main_bnr.gif is in same dir as cgi
program)
close (FILE);
This seems to create a file in the /images directory, but is only a very
small file and not the whole graphics file I am trying to transfer.
Thanks for any help
mailto:airman@inreach.com
------------------------------
Date: Tue, 24 Nov 1998 11:35:49 +0100
From: Gerhard Kutzelnigg <gerhard@uni-x.net>
Subject: CPerlObj
Message-Id: <365A8C05.A5CCAA2E@uni-x.net>
Hi,
can anybody tell me where to find information on how to use CPerlObj in
a c++ program?
Thanks
gerry
------------------------------
Date: Tue, 24 Nov 1998 00:27:55 -0500
From: "vincent" <vpaquin@toile-sherbrooke.com>
Subject: creating pop account
Message-Id: <Str62.48$D36.27@wagner.videotron.net>
Please excuse my english
How could I create a new pop account by the way of a perl script?
Thanks
------------------------------
Date: Tue, 24 Nov 1998 13:39:43 +0100
From: Giuseppe Carone <gicarone@istat.it>
Subject: Crypt and decrypt string
Message-Id: <365AA90F.13EAB347@istat.it>
I need some procedure for crypt and decrypt some variable in perl
script. The crypt bultin function crypt bat don't decript the string.
Can somone help me ?
Giuseppe Carone
gicarone@istat.it
------------------------------
Date: 24 Nov 1998 13:40:39 GMT
From: Jamie Hoglund <jhoglund@mirage.skypoint.net>
Subject: Re: Crypt and decrypt string
Message-Id: <73ed0n$690$4@shadow.skypoint.net>
Giuseppe Carone <gicarone@istat.it> wrote:
: I need some procedure for crypt and decrypt some variable in perl
: script. The crypt bultin function crypt bat don't decript the string.
: Can somone help me ?
There are a lot of encryption/decryption modules on CPAN, however, if
all you require is simple encryption, have a look at XOR. (The '^'
operator) You can perform encryption and decryption with it, but the keys
have to be fairly large to be effective.
None of this is very good if you're using it on a public server, (Have a
look at public key encryption methods for that) as the keys need to be
kept with the data :-/ but XOR reasonably good for transfering data, as
far as I can tell anyway. (resist the urge to just duplicate the same
small string over and over)
Jamie
--
-------------------------------------------------------------------------
jamie@lecart.com
http://www.lecart.com
------------------------------
Date: Tue, 24 Nov 1998 00:29:01 -0600
From: Todd Smith <tbsmith@viper.net>
Subject: crypt
Message-Id: <365A522D.58DAC070@viper.net>
i've seen the encryption algorithim for crypt written in C, but since
perl is my strong point, has anyone seen a version of the algorithim in
Perl?
--
_______________
Todd Smith
Perl Programmer
ITC^Deltacom
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 4283
**************************************