[18046] in Perl-Users-Digest
Perl-Users Digest, Issue: 206 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 3 11:05:30 2001
Date: Sat, 3 Feb 2001 08:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <981216309-v10-i206@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 3 Feb 2001 Volume: 10 Number: 206
Today's topics:
Re: 'print' problem-again! nobull@mail.com
* Perl vs. Java in high-traffic Website * (Reto Hersiczky)
Re: `backticks` broken with fresh install of ActivePerl (Rudolf Polzer)
Re: Apologies to Joyce Kilmer, a hack for your enjoymen (Rudolf Polzer)
Re: Apologies to Joyce Kilmer, a hack for your enjoymen <joe+usenet@sunstarsys.com>
Re: Apologies to Joyce Kilmer, a hack for your enjoymen (Clinton A. Pierce)
Re: Can't read entire file into string. <m_ario@my-deja.com>
Create executable from Perl script <leekembel@hotmail.com>
CSV and XML <maw@markaw.com>
Curses: Memory access failure <usenet@michnet.de>
Re: having problems w/ $( $) ...or... :( with $( nobull@mail.com
Re: How To Reverse 8 bit arithmetic value (Garry Williams)
Re: implace substitution <bcaligari@my-deja.com>
Re: Initial Caps (Rudolf Polzer)
Re: Modules/Constants. nobull@mail.com
Re: Modules/Constants. (Garry Williams)
Re: Modules/Constants. (Garry Williams)
Re: Modules/Constants. nobull@mail.com
Re: Modules/Constants. delanthear@my-deja.com
Need a email perl/cgi script <newuser@nospam.slip.net>
Odd error with hashes. <christopher_j@uswest.net>
Re: Odd error with hashes. (Clinton A. Pierce)
Re: Perl & arrays <m_ario@my-deja.com>
perl versions create "duplicates" - extra perl[version] <steptayl@my-deja.com>
Re: select and perlvar <thoren@southern-division.com>
Re: select and perlvar <thoren@southern-division.com>
simple database using cgi script ? linker444@my-deja.com
Re: simple database using cgi script ? <bcaligari@my-deja.com>
Re: simple database using cgi script ? <m_ario@my-deja.com>
To read an array from a frame <paolo@eurotime.it>
Re: Vim quickfix mode with Perl <nospam.newton@gmx.li>
win32::iphelp for retrieving mac addresses <jensluetzen@yahoo.de>
Re: win32::iphelp for retrieving mac addresses <carvdawg@patriot.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 03 Feb 2001 12:12:40 +0000
From: nobull@mail.com
Subject: Re: 'print' problem-again!
Message-Id: <u9elxgdkxz.fsf@wcl-l.bham.ac.uk>
Bin - Lu <b0l4549@cs.tamu.edu> writes:
> Your information is very helpful. But I need the print content-type line
> because I use a socket before the redirection. The socket doesn't work
> without the print "content-type: text/html\n\n";
What!? Can you explain what lead to you that conclusion?
> The socket code is as follows:
[ snip old Perl4 style, but otherwise OK looking, socket code ]
> Maybe I can change the socket code to make it work without the print line?
> I don't know how to do it. Do you have any clue? Thanks very much!
It would help if first you gave us a clue as to why you thing that
code to open a socket would be magically linked with whether or not a
particular string had be emitted on STDOUT.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 3 Feb 2001 10:48:01 GMT
From: cut_here.retoh@dplanet.ch (Reto Hersiczky)
Subject: * Perl vs. Java in high-traffic Website *
Message-Id: <Xns903D779016001cuthereretohdplanetc@195.186.1.107>
! Need *your* opinion !
"Some guys explain to a customer: Websites from <that> kind of traffic
meet the edge of running dynamic pages with Perl. They sugguest to
make future developments in pure Java."
Technical Conditions:
- Apache Webserver
- Sun Solaris
- Postgres database, ~ 15 Tables, < 50000 rows
- Web traffic approximately 25000 page views per hour
I assume the reason for their advise lies in the fact it is easyer
to protect the intellectual property with Servlets rather than
deploying a script where the customer becomes the ability to read code.
* Please reply your opinion!
I'd prefer a CC to my mail address. Remove "cut_here." prefix.
Thanks,
Reto
"guilty as another hacker of the Perl republic"
------------------------------
Date: Sat, 3 Feb 2001 14:33:32 +0100
From: rpolzer@web.de (Rudolf Polzer)
Subject: Re: `backticks` broken with fresh install of ActivePerl on Win98
Message-Id: <slrn97o25c.bas.rpolzer@rebounce.rpolzer-lx>
Tom Bates <tfbiv@SPAMMENOTerols.com> schrieb Folgendes:
> I installed ActivePerl on my Win98SE WinBook XL3 and found that the
> backtick is broken - the output of the command is displayed rather
> than captured by perl. This worked fine before my hard drive crashed
> and I had to have it replaced (under warranty thank god). I also have
> ActivePerl installed on another machine at another location, and
> things all seem to be working fine (including scripts with backticks).
>
> I removed and reinstalled it (it's build 523 on CD that I bought back
> in Nov 99), and it still does it.
>
> If I run this little test:
>
> $test = `cd`;
> print "\$test = \"$test\"\n";
> print $?;
> print $!;
> print "--";
>
> This is what I get:
>
> C:\Util\Perl>perl -w test.pl
> C:\Util\Perl
> $test = ""
> $? = 0, $! = "No such file or directory"
> --
Try `command /c cd` instead of cd. If this works, you cannot use internal
command.com commands in backticks.
Then it also happens with del, copy, ren, dir etc.
And try this:
`xcopy /?`.
See a pattern? xcopy is external and exists as an .exe file.
You only can execute external commands in backticks because they seem to
not open a command.com session. Internal commands are those DOS
commands that you do not find as an .EXE, .COM or .BAT file on your hard
drive.
--
Nuper erat medicus, nunc est vispillo, Diaulus:
Quod vispillo facit, fecerat et medicus.
------------------------------
Date: Sat, 3 Feb 2001 14:38:19 +0100
From: rpolzer@web.de (Rudolf Polzer)
Subject: Re: Apologies to Joyce Kilmer, a hack for your enjoyment
Message-Id: <slrn97o2eb.bas.rpolzer@rebounce.rpolzer-lx>
Clinton A. Pierce <clintp@geeksalad.org> schrieb Folgendes:
> #!/usr/bin/perl -w
>
> '% * % % * % %<>
> * % ~ * % % * % * * % * *
> * % % * * % * % *<> * % ~ % % % * %
> * * * % * % % % % * % % % % % % * % % * %
> % * % % ^ * % % % % *[] % % * * % * * % % %
> % * % % % % % % * * % * * @ * @ % * % %
> % ^ % * % * % * * % % * % <> % % % % * % %() %
> % % * * * % % * % % * * % * * * * % * * % % * * *
> % * * * % % * % % *[]<> % % % % * % * * * % % *<>
> % * * % % % * * % * * * \ * %\ * * * %/ \ # % * *
> % % % *\ * /\ * *// % %\ <>\ // % %/ % \// % * %
> * * *\ \|| \ \/ / % %// \ \ *\ /<> %// %// % %<>
> * % * %\ \ | | ||// % || // \// % // * * * %
> %{} % * ----\ \ | / %||// / ---/ / * % % *
> % * *\ ____\ \| | / / / /----/ * %
> \ ----\ | / // /
> \ \ / /'
> =~m/(.*)/s;$_=$1;
> s![-\\|_/\s]!!g
> ;%e=('%',0,
> '^',132918,
> '~'=>18054,
> '@'=>19630,
> '*' =>0b01,
^^^^
Does not work. Perl complains about this. Is it really _your_ hack or did
you copy it from a book? I tried replacing the b with a 6 but that was
not the fault; I also tried inserting a x before it, but no text
appeared; just a row of all the same characters and then another one.
> '#'=>13099,
> '[]'=>4278,
> '<>'=>2307,
> '{}'=>9814,
> '()',2076);
> for $a(keys
> %e){$e{$a}=
> sprintf"%b"
> , $e{$a};}
> $y= qq{(}.join(
> '|',map "\Q$_\E"
> ,keys %e).qq{)};s/$y
> /$e{$1}/gex;print pack"B*",$_;
Looks nice, but does not work.
--
Nuper erat medicus, nunc est vispillo, Diaulus:
Quod vispillo facit, fecerat et medicus.
------------------------------
Date: 03 Feb 2001 09:01:32 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Apologies to Joyce Kilmer, a hack for your enjoyment
Message-Id: <m3lmrn50hv.fsf@mumonkan.sunstarsys.com>
rpolzer@web.de (Rudolf Polzer) writes:
> Does not work. Perl complains about this. Is it really _your_ hack or did
> you copy it from a book? I tried replacing the b with a 6 but that was
> not the fault; I also tried inserting a x before it, but no text
> appeared; just a row of all the same characters and then another one.
>
Are you using 5.6? It works fine for me on linux w/5.6,
but not w/5.005_03.
--
Joe Schaefer
------------------------------
Date: Sat, 03 Feb 2001 15:24:45 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Apologies to Joyce Kilmer, a hack for your enjoyment
Message-Id: <1pVe6.277018$hD4.66747295@news1.rdc1.mi.home.com>
[Posted and mailed]
[re-organized a bit]
In article <slrn97o2eb.bas.rpolzer@rebounce.rpolzer-lx>,
rpolzer@web.de (Rudolf Polzer) writes:
>> '*' =>0b01,
> ^^^^
> Does not work. Perl complains about this.
> [...]
> I tried replacing the b with a 6 but that was
> not the fault; I also tried inserting a x before it, but no text
> appeared; just a row of all the same characters and then another one.
It's a 5.6-ism. You aren't using 5.6? Shame on you. It's been out
since...well gee, at least the summer of 1999. It means 1, but
represented as a binary literal. For example 0b0101 would be 5 in
binary. Simply replace it with:
'*' => 1,
And it'll be fine. BTW, there are other things in the hack
that use 5.6-isms: I think pack "B*" is one and sprintf "%b" is another).
Get yourself a modern Perl.
>Is it really _your_ hack or did you copy it from a book?
This is my hack. I WRITE books, not copy from them. Get yourself
a real interpreter and then come back to play. Writing hacks for old
versions of perl teaches nothing.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Sat, 03 Feb 2001 13:35:56 GMT
From: Mario <m_ario@my-deja.com>
Subject: Re: Can't read entire file into string.
Message-Id: <95h1ft$1be$1@nnrp1.deja.com>
In article <3a7af127.15418309@wingate>,
lkenny@fisheries.org (LK) wrote:
> This is probably just a little thing I am overlooking, butI want to
> read a file into a string. so far I have set up:
>
> open(FILE,"$file") || die("Cannot open file $file: $!");
> $data = <FILE>;
> close (FILE);
> open (FIEL, ">>$dats");
> print FIEL "$data";
>
> But the print only prints the first line of the file.
It's not an error,it behaves in this way (reading a line at once).
You read the entire file by accessing all the lines sequencially.
open (FILE,"<$file") || die "$file:$!";
while (<FILE>) {
$data.=$_;
}
close (FILE) || die "$file:$!";
--
Mario
diab.litoATusa.net
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sat, 03 Feb 2001 14:28:30 GMT
From: "Studio 51" <leekembel@hotmail.com>
Subject: Create executable from Perl script
Message-Id: <iAUe6.61037$V22.12720657@news4.rdc1.on.home.com>
I guess theres few options out there for doing this, Indigo's Perl2Exe, and
activestate has something called PerlApp. What I'm wondering is how they
compare to a regular Perl script?
Is there a speed difference?
Do they use more/less resources?
Are there any other limitations? Maybe some functions don't work so well?
Is there anyone out there that's done this on a regular basis, or use a Perl
executable in a high-load environment, and would like to share thier
experiences?
LKembel
------------------------------
Date: Sat, 3 Feb 2001 14:02:48 -0000
From: "MAW" <maw@markaw.com>
Subject: CSV and XML
Message-Id: <981209295.3122.0.nnrp-07.c2deffc1@news.demon.co.uk>
Hi There,
I'm hoping somebody can help me oujt or point me in the right direction. I
have a java class which can convert any CSV file into an XML file, in the
following format:
CSV File contents
"item1","item2","item 3","this is the fourth item"
Result in:
<COL_1>item1</COL_1>
<COL_2>item2</COL_2>
<COL_3>item 3</COL_3>
<COL_4>this is the fourth item</COL_4>
The reason I have this, is I have a web server running Java Servlets that
receives a CSV file and then needs to convert it to XML. Well, now I have to
convert everything over to Perl so I need a script/module that can convert
from a CSV file to an arbitary XML file
Thanks
------------------------------
Date: Sat, 3 Feb 2001 14:37:47 +0100
From: Michael Velten <usenet@michnet.de>
Subject: Curses: Memory access failure
Message-Id: <D01-02-03.T14-37-47@michnet.de>
Hi there,
the following function doesn't work on my Linux machine:
sub draw_line {
my ($mode, $row, $col) = @_;
my $cur_line_str;
innstr($row, $col, $cur_line_str, $COLS - 1); # Error!
($mode eq 'n') ? eval { attrset(A_NORMAL) } : eval { attrset(A_REVERSE) };
addstr($row, $col, $cur_line_str);
}
On the 'innstr' function the program aborts with the error message (in
german:) "Speicherzugriffsfehler". I think in english it's something
like "Memory access failure" (or "buffer overflow").
When I initialize the variable $cur_line_str with "enough" characters
my $cur_line_str = "x" x $COLS;
the program works correct.
The curios thing is that the same program works correctly under an
other Linux machine (SuSE 6.2, unfortunately I don't know the version of
Curses or ncurses).
Is there any known bug in ncurses/Curses or what can be the problem?
(I'm running Debian 2.2 (Potato), Perl 5.005_03 and ncurses 1.85)
Thanks in advance,
Michael
------------------------------
Date: 03 Feb 2001 12:31:40 +0000
From: nobull@mail.com
Subject: Re: having problems w/ $( $) ...or... :( with $(
Message-Id: <u97l38dk2b.fsf@wcl-l.bham.ac.uk>
chains@yahoo.com writes:
> I'm having some problems setting $( and $) w/ Perl 5.6 on Linux 2.2.16
> could someone please show me what I'm doing wrong.
You are forgetting that you must always cut out the branch you are
standing on last.
Once you've dropped superuser priviledge (by making $< and $>
non-zero) you can't alter $( or $).
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Sat, 03 Feb 2001 15:04:25 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: How To Reverse 8 bit arithmetic value
Message-Id: <Z5Ve6.743$Sn3.26465@eagle.america.net>
On Sat, 03 Feb 2001 07:13:16 GMT, John W. Krahn <krahnj@acm.org> wrote:
>gipperca@my-deja.com wrote:
>>
>> How would I reverse an 8 bit value???
>>
>> If the binary value were 01110001, or 0x71, I want the reversed
>> value, 10001110, or 0x8e.
>
>$ perl -e '$x = "\x71"; $y = ~$x; printf "%X %X\n", ord $x, ord $y;'
>71 8E
If you can't be right, at least be lucky! :-)
On second thought, maybe the OP really meant `invert' when he said
`reverse'. Hmmm.
--
Garry Williams
------------------------------
Date: Sat, 03 Feb 2001 08:56:31 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
Subject: Re: implace substitution
Message-Id: <95gh3u$n24$1@nnrp1.deja.com>
In article <95fed8$3g1$1@bob.news.rcn.net>,
ebohlman@omsdev.com (Eric Bohlman) wrote:
> Brendon Caligari <bcaligari@my-deja.com> wrote:
>
> > Following works under linux build
> > perl -pi -e 's/foo/bar/g' test
> > But not under win32
>
> On Win32 the command-line quote character is " rather than '.
>
>
same thing
perl -pi -e "s/foo/bar/g" test.txt
I get
Can't do inplace edit without backup.
However, with
perl -p -iXX -e "s/foo/bar/g" test.txt
Amends the file but creates the backup file
....hey wait a sec...
Programming Perl III says:
"(F) You're on a system such as MS-DOS that gts confused if you try
reading from a deleted (but still opened) file. You hae to say -i.bak,
or some such.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sat, 3 Feb 2001 14:18:51 +0100
From: rpolzer@web.de (Rudolf Polzer)
Subject: Re: Initial Caps
Message-Id: <slrn97o19r.b6b.rpolzer@rebounce.rpolzer-lx>
shanmughom_sivasubra@my-deja.com <shanmughom_sivasubra@my-deja.com> schrieb Folgendes:
> You can try
>
> $value = s/(\w)(\w|\s)/\u$1/g;
He could have solved the problem himself: he could also prepend his string
with a space, apply his re, and remove the space using sub. Of course,
your solution is cleaner, but I think newbies should think, too.
>
> In article
> <F3D71846642C7031.2F367D7AA052277B.1AD7779D470FD0C9@lp.airnews.net>,
> "Barry Glick" <barryg@kingcon.com> wrote:
> > I'm in a on-line web master class, now learning to do CGI/PERL
> scripts. The
> > class has very little in the way of help, so I help some one in this
> > newsgroup can help me.
> >
> > My assignment was to create a simple CGI script that will take input
> from
> > the user in a form, strip out the extraneous characters (+,=,&), then
> print
> > it with the first letter of each word capitalized. I can almost do
> it with
> > this:
> >
> > $value =~ s/\s(\w)/ \u$1/g;
> >
> > But that only capitalizes the first letter of every word AFTER the
> first
> > one, since the first word has no space. Can anyone tell me how to
> > capitalize the first letter of ALL words entered into, say, a text
> box of an
> > HTML form?
> >
> > Thanks in advance for any help.
> >
> > Barry Glick
> > barryg@kingcon.com
> >
> >
>
>
> Sent via Deja.com
> http://www.deja.com/
--
Nuper erat medicus, nunc est vispillo, Diaulus:
Quod vispillo facit, fecerat et medicus.
------------------------------
Date: 03 Feb 2001 12:21:41 +0000
From: nobull@mail.com
Subject: Re: Modules/Constants.
Message-Id: <u9ae84dkiy.fsf@wcl-l.bham.ac.uk>
delanthear@my-deja.com writes:
> I've got the constants in a .pm file, and I'm requiring that file.
In general you need to use(), not require() modules that import
symbols into your namespace.
> Later on I'm doing this:
>
> $command = CONSTANT_NAME;
> my $header = pack("C4N", $command, $param1, $param2, $param3, datasize);
> 'Argument "CONSTANT_NAME" isn't numeric in pack'
>
> I'm baffled!
Yes, it's true that if you forget to "use strict" you can often get
baffling errors. If you'd used strict you've got:
Bareword "CONSTANT_NAME" not allowed while "strict subs" in use in the
line where you say $command = CONSTANT_NAME.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Sat, 03 Feb 2001 14:11:19 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: Modules/Constants.
Message-Id: <bkUe6.730$Sn3.26489@eagle.america.net>
On Sat, 03 Feb 2001 05:03:44 GMT, delanthear@my-deja.com
<delanthear@my-deja.com> wrote:
>> <delanthear@my-deja.com> wrote:
>>
>> >I'm playing with a script which uses quite a lot of constants.
>> >(declared with "use constant CONSTANT_NAME => VALUE;") I'd prefer to
>> >keep them in a separate file than the main scripts. What's the
>> >easiest way of doing this? I've played with creating a module, but
>> >I'm unsure how to use the exporter to export constants and how to
>> >make them
>> >visible to the other modules I'm using.
>> >
>> >Anyone got any clues? Or am I going about this the wrong way?
>
>> Garry Williams wrote:
>> Another approach would be to ignore the Exporter module and just place
>> your constants in a separate module without a package statement and
>> just require that module in the script that wants the constants. Now
>> there would be no choice on what the require'ing module could choose
>> to import.
This last paragraph is rubbish.
If I had tried this before posting it, I would not have posted it.
:-(
A way to get all constants (and subroutines) from your module would be
to *include* a package statement in the module (probably `main', in
your case). Then *use* the module from another script -- *not*
require it. This limits the use of the module to only files declaring
the same package, though.
My first explanation, inheriting from Exporter, should be used (not
quoted above). It's more flexible.
One more thing: nobull's admonishment about use strict is excellent
advice. It may be a pain to get some old scripts running clean under
strict, but it will pay back in the longer term.
--
Garry Williams
------------------------------
Date: Sat, 03 Feb 2001 14:47:32 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: Modules/Constants.
Message-Id: <8SUe6.739$Sn3.26513@eagle.america.net>
On Sat, 03 Feb 2001 05:03:44 GMT, delanthear@my-deja.com
<delanthear@my-deja.com> wrote:
>> <delanthear@my-deja.com> wrote:
>>
>> >I'm playing with a script which uses quite a lot of constants.
>> >(declared with "use constant CONSTANT_NAME => VALUE;") I'd prefer to
>> >keep them in a separate file than the main scripts. What's the
>> >easiest way of doing this? I've played with creating a module, but
>> >I'm unsure how to use the exporter to export constants and how to
>> >make them
>> >visible to the other modules I'm using.
>> >
>> >Anyone got any clues? Or am I going about this the wrong way?
>
>> Garry Williams wrote:
>> Another approach would be to ignore the Exporter module and just place
>> your constants in a separate module without a package statement and
>> just require that module in the script that wants the constants. Now
>> there would be no choice on what the require'ing module could choose
>> to import.
>
>I've just tried this out and run into a problem.
This incorrect advice that I gave can be explained:
File x_h.pm:
use constant => 'hello';
1;
File x:
#!/usr/local/bin/perl -wl
use strict;
require x_h;
print STDOUT HELLO;
$ perl x
Bareword "HELLO" not allowed while "strict subs" in use at x line 4.
Execution of x aborted due to compilation errors.
The problem is that at compile-time `HELLO' is not declared. The
require statement is an execution-time thing. The use strict is not
satisfied at compile-time since the symbol `HELLO' is not declared by
the time it is being compiled.
The HELLO symbol would be in the current name space, if the compile
had been successful because the require would bring it in. As a
matter of fact, the main can be modified to tell the compiler that the
`HELLO' is a subroutine and this will compile and work as expected.
(The reason for this is that the use constant pragma really implements
the constant as a prototyped subroutine requiring no arguments.)
File x:
#!/usr/local/bin/perl -wl
use strict;
require x_h;
print STDOUT HELLO();
$ perl x
hello
Now compile-time is satisfied. But that's not quite what you wanted.
Simply changing the require to a use statement will get you what you
want. Now, at compile-time, the symbol HELLO is declared *before* its
use, so the compiler knows that it is a subroutine (constant):
#!/usr/local/bin/perl -wl
use strict;
use x_h;
print STDOUT HELLO;
$ perl x
hello
Sorry for the confusion. It just doesn't *ever* pay to post without
checking. :-(
--
Garry Williams
------------------------------
Date: 03 Feb 2001 15:38:49 +0000
From: nobull@mail.com
Subject: Re: Modules/Constants.
Message-Id: <u9wvb7dbee.fsf@wcl-l.bham.ac.uk>
garry@zvolve.com (Garry Williams) writes:
> On Sat, 03 Feb 2001 05:03:44 GMT, delanthear@my-deja.com
> <delanthear@my-deja.com> wrote:
> Garry Williams wrote:
> >> Another approach would be to ignore the Exporter module and just place
> >> your constants in a separate module without a package statement and
> >> just require that module in the script that wants the constants. Now
> >> there would be no choice on what the require'ing module could choose
> >> to import.
> This incorrect advice that I gave can be explained:
> Simply changing the require to a use statement will get you what you
> want. Now, at compile-time, the symbol HELLO is declared *before* its
> use, so the compiler knows that it is a subroutine (constant):
>
> #!/usr/local/bin/perl -wl
> use strict;
> use x_h;
> print STDOUT HELLO;
>
> $ perl x
> hello
>
> Sorry for the confusion. It just doesn't *ever* pay to post without
> checking. :-(
You are still giving dangerous advice. This works fine so long as
only one package trys to "use x_h". This may be the case now but as
the program becomes bigger it is likely that one day it will need to
split into multiple packages (or even modules). At that time it will
fail. Worse still you may write a modules that use x_h they will seem
to work fine until such time as you try to use more than one of these
modules in the same script.
The is a module designed to overcome this problem - it is called
Exporter.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Sat, 03 Feb 2001 15:50:25 GMT
From: delanthear@my-deja.com
Subject: Re: Modules/Constants.
Message-Id: <95h9bv$71e$1@nnrp1.deja.com>
thanks alot.
Its working now :)
k
-
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sat, 3 Feb 2001 05:41:40 -0800
From: "newuser" <newuser@nospam.slip.net>
Subject: Need a email perl/cgi script
Message-Id: <t7o2kdb8hutm0a@corp.supernews.com>
Hello,
I was just wondering if someone has a perl/cgi script that I can use
that basically does the following. Lets say for example I have a message
board where people post various messages and on my webpage I give the user
the option to if they want to place a x in the box (this part is done via
html) all replies to this person will automatically be sent to this person.
If someone has one that I can use that sure would be helpful.
thanks
------------------------------
Date: Sat, 3 Feb 2001 07:52:37 -0800
From: "Christopher M. Jones" <christopher_j@uswest.net>
Subject: Odd error with hashes.
Message-Id: <qOVe6.340$uH6.144429@news.uswest.net>
I was under the impression that with Perl 5 the text inside
the brackets for a hash key is implicitly quoted. IOW, it's
not necessary to put extra quotations around it. However, I
ran into an odd error where I had a dash in a hash key and
it interpreted the key as 0 (zero). Is this a bug or am I
missing something?
Here's some mock-up sample code that would cause the problem:
$a->{hash-key} = $something;
Which evaluates differently thant:
$a->{'hash-key'} = $something;
--
Connection reset by bear.
------------------------------
Date: Sat, 03 Feb 2001 16:00:08 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Odd error with hashes.
Message-Id: <cWVe6.277177$hD4.66764375@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <qOVe6.340$uH6.144429@news.uswest.net>,
"Christopher M. Jones" <christopher_j@uswest.net> writes:
> I was under the impression that with Perl 5 the text inside
> the brackets for a hash key is implicitly quoted.
This is true for simple identifiers.
> Here's some mock-up sample code that would cause the problem:
>
> $a->{hash-key} = $something;
This is not a simple identifier. It has a dash.
> Which evaluates differently thant:
>
> $a->{'hash-key'} = $something;
You bet. By design.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Sat, 03 Feb 2001 13:09:04 GMT
From: Mario <m_ario@my-deja.com>
Subject: Re: Perl & arrays
Message-Id: <95gvte$81$1@nnrp1.deja.com>
In article <95g53v$e2q$1@nnrp1.deja.com>,
T <tommylebrun@yahoo.com> wrote:
> Does anyone know if Perl has a limitation on the number of elements an
> array can have? Thanks, T.
It has not.Of course there is the phisical limit of the ram.
--
Mario
diab.litoATusa.net
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sat, 03 Feb 2001 15:51:50 GMT
From: Steve Taylor <steptayl@my-deja.com>
Subject: perl versions create "duplicates" - extra perl[version] binaries in /usr/bin
Message-Id: <95h9el$78e$1@nnrp1.deja.com>
After upgrading to perl 5.6 in debian, the perldoc was broken. Load the
perl 5.005 and it works. But /usr/bin has several perl[version]
binaries; is there a newer .deb with perl 5.6 and perldoc? Is config.pm
showing too many paths? Help is appreciated - TIA
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sat, 3 Feb 2001 15:28:55 +0100
From: Thoren Johne <thoren@southern-division.com>
Subject: Re: select and perlvar
Message-Id: <MPG.14e63415ace84b85989828@news.btx.dtag.de>
In article <x73ddwsjfs.fsf@home.sysarch.com>, Uri Guttman aka
uri@sysarch.com says...
> >>>>> "TJ" == Thoren Johne <thoren@southern-division.com> writes:
> TJ> does 'select' actual work as expected with '$|' but not with '$\'?
>
> this is a well known issue (or bug as some might say). $/ and $\ are
> globals and not file handle specific so select doesn't do anything with
> them.
>
> one basic solution is to localize $\ before you do any printing so you
> can set it on demand:
>
> sub print_stderr {
>
> local( $/ ) = ' err ' ;
> print STDERR @_ ;
> }
yeah, that's the way i currently use
> then you don't have to deal with resetting $/ afterwards. the same idea
> can be done with OO, and even closures:
>
> sub make_print_sub {
>
> my( $handle, $ors ) = @_ ;
>
> sub { local( $/ ) = $ors ; print $handle @_ }
> }
>
> $print_stderr = make_print_sub( \*STDERR, ' err ' ) ;
>
> $print_stderr->( "foo\n" ) ;
that looks fine to me.
--
----------------------------------------------------------------------
Thoren Johne - 8#X - thoren@southern-division.com
Southern Division Classic Bikes - www.southern-division.com
------------------------------
Date: Sat, 3 Feb 2001 15:35:57 +0100
From: Thoren Johne <thoren@southern-division.com>
Subject: Re: select and perlvar
Message-Id: <MPG.14e635b5603aabe3989829@news.btx.dtag.de>
In article <3a7b7702.7274$2e@news.op.net>, Mark Jason Dominus aka
mjd@plover.com says...
> In article <MPG.14e54ee2a634a07a989827@news.btx.dtag.de>,
> Thoren Johne <thoren@southern-division.com> wrote:
> >is there a place in perldoc, where i can see if a special variable is on
> >a 'per filehandle basis',
>
> If there were, it would be in 'perlvar'. For example:
>
> $~ The name of the current report format for the cur-
> rently selected output channel.
i think the docs are misleading about (not only) $\
output_record_separator HANDLE EXPR
^^^^^^
$OUTPUT_RECORD_SEPARATOR
$ORS
$\
The output record separator for the print operator...
and even via IO::handle it does not work as printed in the docs.
> Right. Sucks, doesn't it?
yup - it does.
--
----------------------------------------------------------------------
Thoren Johne - 8#X - thoren@southern-division.com
Southern Division Classic Bikes - www.southern-division.com
------------------------------
Date: Sat, 03 Feb 2001 08:12:02 GMT
From: linker444@my-deja.com
Subject: simple database using cgi script ?
Message-Id: <95gegg$kes$1@nnrp1.deja.com>
hello, i am a newbie.
i need a simple database written in cgi script where the user can key
in his username and password to log in to a protected site.
anyone have the sample code or knows where to find them ?
i need the cgi script that checks the username and password against a
text file and if included, allows the user to log in....
please help.
i will lose my job...
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sat, 03 Feb 2001 09:07:49 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
Subject: Re: simple database using cgi script ?
Message-Id: <95ghp4$ncp$1@nnrp1.deja.com>
In article <95gegg$kes$1@nnrp1.deja.com>,
linker444@my-deja.com wrote:
> hello, i am a newbie.
>
> i need a simple database written in cgi script where the user can key
> in his username and password to log in to a protected site.
maybe you could be better off simply using apache's (or
whatever) .htaccess and stuff
>
> anyone have the sample code or knows where to find them ?
>
> i need the cgi script that checks the username and password against a
> text file and if included, allows the user to log in....
>
> please help.
>
> i will lose my job...
how did you get it?
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sat, 03 Feb 2001 12:52:48 GMT
From: Mario <m_ario@my-deja.com>
Subject: Re: simple database using cgi script ?
Message-Id: <95guuu$vo1$1@nnrp1.deja.com>
In article <95ghp4$ncp$1@nnrp1.deja.com>,
Brendon Caligari <bcaligari@my-deja.com> wrote:
> In article <95gegg$kes$1@nnrp1.deja.com>,
> linker444@my-deja.com wrote:
> > hello, i am a newbie.
> >
> > i need a simple database written in cgi script where the user can
key
> > in his username and password to log in to a protected site.
>
> maybe you could be better off simply using apache's (or
> whatever) .htaccess and stuff
>
> >
> > anyone have the sample code or knows where to find them ?
> >
> > i need the cgi script that checks the username and password against
a
> > text file and if included, allows the user to log in....
> >
> > please help.
It can be actually easy if you want to protect just one page.
If you need to do so with the entire site, the most part of the job is
on the server configuration.
Maybe not a newbie thing, but neither really difficult.
> > i will lose my job...
Well,if your job is server administration or cgi programming, it isn't
unfair that you lose it:-)
--
Mario
diab.litoATusa.net
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sat, 03 Feb 2001 15:34:26 GMT
From: "Pier Paolo" <paolo@eurotime.it>
Subject: To read an array from a frame
Message-Id: <6yVe6.93966$ew1.5673905@news.infostrada.it>
HI,
I'ld want to read with a pearl cgi an array stored into a hide frame of my
site.
This array is maked with javascript and is multidimensional.
It is possible to pass as string the array throught a form in a hidden
field.
But I do not want this way.
For securty I'ld want to read directly from my cgi the array and I do not
want to give any possibility at the visitors to use location to pass any
data that i do not want.
Please can you write me what is a better way to obtain that?
Regards and thank you in advance
Paolo
------------------------------
Date: Sat, 03 Feb 2001 10:11:06 +0100
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.li>
Subject: Re: Vim quickfix mode with Perl
Message-Id: <mogn7toa0ej8867276qlt8ig1u8c6bl3hj@4ax.com>
On 2 Feb 2001 19:23:04 GMT, gt4556a@acmex.gatech.edu (Jörg Ziefle) wrote:
> Does anybody use the quickfix mode within Vim (and even the perl
> debugger?)?
I use the Perl debugger very often, but usually to debug the program "1". `perl
-de1` gives you a nice interactive Perl.
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: Sat, 03 Feb 2001 13:03:32 +0100
From: jens <jensluetzen@yahoo.de>
Subject: win32::iphelp for retrieving mac addresses
Message-Id: <3A7BF394.E4606BBB@yahoo.de>
Hello all,
I am in search of the Win32::iphelp-module. Unfortunately, it's no
longer available at the site of the author.. maybe someone else could
help me get it?
I need it to extract the mac-addresses of remote computers (SNMP is not
an option)..
Thanks very much for your help,
Jens
jensluetzen@yahoo.de
------------------------------
Date: Sat, 03 Feb 2001 07:45:42 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: win32::iphelp for retrieving mac addresses
Message-Id: <3A7BFD75.2E30E5A2@patriot.net>
If the remote systems are NT, you can use the Win32::Lanman module...
jens wrote:
> Hello all,
>
> I am in search of the Win32::iphelp-module. Unfortunately, it's no
> longer available at the site of the author.. maybe someone else could
> help me get it?
>
> I need it to extract the mac-addresses of remote computers (SNMP is not
> an option)..
>
> Thanks very much for your help,
>
> Jens
>
> jensluetzen@yahoo.de
--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 206
**************************************