[24166] in Perl-Users-Digest
Perl-Users Digest, Issue: 6358 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Apr 3 11:05:42 2004
Date: Sat, 3 Apr 2004 08:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 3 Apr 2004 Volume: 10 Number: 6358
Today's topics:
Re: A file's directory <tore@aursand.no>
Re: best free Perl editor for Windows? <734562323@yahoo.de>
Re: best free Perl editor for Windows? <perl@my-header.org>
Re: best free Perl editor for Windows? <s.patterson@freeuk.com>
Emacs modules for Perl programming (Jari Aalto+mail.perl)
Re: eval() <toylet_at_mail.hongkong.com>
Re: free source for bbs (Jay Tilton)
Re: free source for bbs <kirk@strauser.com>
Re: free source for bbs <uri.guttman@fmr.com>
Re: free source for bbs <tassilo.parseval@rwth-aachen.de>
HTML Tag Counter (Shah Karim)
Re: HTML Tag Counter <tassilo.parseval@rwth-aachen.de>
Re: Lost data on socket - Can we start over politely? (Vorxion)
Media For Sale <ebenezer@shaw.ca>
Re: Media For Sale <uri@stemsystems.com>
PDF File Information thru PERL (Aqua)
Re: Perl and Internet Explorer <gnari@simnet.is>
Re: Possible to open a Berkeley 4.2 db file with DB_Fil <uri.guttman@fmr.com>
RFC: UniqueID Module <john@newchester.com>
Re: RFC: UniqueID Module (Anno Siegel)
Re: scope again <invalid-email@rochester.rr.com>
Re: uninitialized value in concatenation ... (Chris Conwell)
Re: uninitialized value in concatenation ... (Chris Conwell)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 03 Apr 2004 17:53:55 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: A file's directory
Message-Id: <pan.2004.04.02.14.36.28.420549@aursand.no>
On Fri, 02 Apr 2004 14:19:50 +0200, User At Domain Dot Invalid wrote:
> Given a file name (possibl a path to it given as well), is there a way
> to get or extract the name of the directory the file is in?
If you know the location of the file (ie. the path), you can use
File::Basename to extract only the directory part.
If you don't know where the file is (ie. you don't know that path), you
need to search for it. Take a look at File::Find and File::Find::Rule.
--
Tore Aursand <tore@aursand.no>
"Anyone who slaps a 'this page is best viewed with Browser X'-label on
a web page appears to be yearning for the bad old days, before the
web, when you had very little chance of reading a document written on
another computer, another word processor or another network." -- Tim
Berners-Lee, July 1996
------------------------------
Date: Fri, 02 Apr 2004 23:01:30 -0500
From: L D Jones <734562323@yahoo.de>
Subject: Re: best free Perl editor for Windows?
Message-Id: <406E371A.77D75BA3@yahoo.de>
PHP2 wrote:
>
> what is best free Perl editor for Windows?
What's a Perl editor?
------------------------------
Date: Sat, 03 Apr 2004 10:43:11 +0200
From: Matija Papec <perl@my-header.org>
Subject: Re: best free Perl editor for Windows?
Message-Id: <d7us60ttl9pt7en02g1v81bb87kvpm9ju6@4ax.com>
X-Ftn-To: L D Jones
L D Jones <734562323@yahoo.de> wrote:
>PHP2 wrote:
>>
>> what is best free Perl editor for Windows?
>
>What's a Perl editor?
Text editor which is convenient for editing perl scripts.
--
Matija
------------------------------
Date: 3 Apr 2004 11:00:27 GMT
From: Stephen Patterson <s.patterson@freeuk.com>
Subject: Re: best free Perl editor for Windows?
Message-Id: <slrnc6t6aa.k1.s.patterson@bloodnok.localdomain>
On Sat, 03 Apr 2004 10:43:11 +0200, Matija Papec wrote:
> X-Ftn-To: L D Jones
>
> L D Jones <734562323@yahoo.de> wrote:
>>PHP2 wrote:
>>>
>>> what is best free Perl editor for Windows?
>>
>>What's a Perl editor?
>
> Text editor which is convenient for editing perl scripts.
Alternatively ISTR someone mentioning an editor written in perl a
month or 2 ago.
--
Stephen Patterson http://patter.mine.nu/
steveSPAM@.patter.mine.nu remove SPAM to reply
Linux Counter No: 142831 GPG Public key: 252B8B37
Caution: breathing may be hazardous to your health.
------------------------------
Date: 03 Apr 2004 11:36:56 GMT
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Emacs modules for Perl programming
Message-Id: <perl-faq/emacs-lisp-modules_1080992138@rtfm.mit.edu>
Archive-name: perl-faq/emacs-lisp-modules
Posting-Frequency: 2 times a month
URL: http://tiny-tools.sourceforge.net/
Maintainer: Jari Aalto <jari.aalto@poboxes.com>
Announcement: "What Emacs lisp modules can help with programming Perl"
Preface
Emacs is your friend if you have to do anything comcerning software
development: It offers plug-in modules, written in Emacs lisp
(elisp) language, that makes all your programmings wishes come
true. Please introduce yourself to Emacs and your programming era
will get a new light.
Where to find Emacs/XEmacs
o Unix:
http://www.gnu.org/software/emacs/emacs.html
http://www.xemacs.org/
o Unix Windows port (for Unix die-hards):
install http://www.cygwin.com/ which includes native Emacs 21.x.
XEmacs port is bundled in XEmacs setup.exe available from
XEmacs site.
o Pure Native Windows port
http://www.gnu.org/software/emacs/windows/ntemacs.html
ftp://ftp.xemacs.org/pub/xemacs/windows/setup.exe
o More Emacs resources at
http://tiny-tools.sourceforge.net/ => Emacs resource page
Emacs Perl Modules
Cperl -- Perl programming mode
ftp://ftp.math.ohio-state.edu/pub/users/ilya/perl
http://www.perl.com/CPAN-local/misc/emacs/cperl-mode/
<ilya@math.ohio-state.edu> Ilya Zakharevich
CPerl is major mode for editing perl files. Forget the default
`perl-mode' that comes with Emacs, this is much better. Comes
standard in newest Emacs.
TinyPerl -- Perl related utilities
http://tiny-tools.sourceforge.net/
If you ever wonder how to deal with Perl POD pages or how to find
documentation from all perl manpages, this package is for you.
Couple of keystrokes and all the documentaion is in your hands.
o Instant function help: See documentation of `shift', `pop'...
o Show Perl manual pages in *pod* buffer
o Grep through all Perl manpages (.pod)
o Follow POD references e.g. [perlre] to next pod with RETURN
o Coloured pod pages with `font-lock'
o Separate `tiperl-pod-view-mode' for jumping topics and pages
forward and backward in *pod* buffer.
o Update `$VERSION' variable with YYYY.MMDD on save.
o Load source code into Emacs, like Devel::DProf.pm
o Prepare script (version numbering) and Upload it to PAUSE
o Generate autoload STUBS (Devel::SelfStubber) for you
Perl Module (.pm)
TinyIgrep -- Perl Code browsing and easy grepping
[TinyIgrep is included in Tiny Tools Kit]
To grep from all installed Perl modules, define database to
TinyIgrep. There is example file emacs-rc-tinyigrep.el that shows
how to set up dattabases for Perl5, Perl4 whatever you have
installed
TinyIgrep calls Igrep.el to to do the search, You can adjust
recursive grep options, set search case sensitivity, add user grep
options etc.
You can find latest `igrep.el' module at
<http://groups.google.com/groups?group=gnu.emacs.sources> The
maintainer is Jefin Rodgers <kevinr@ihs.com>.
TinyCompile -- To Browse grep results in Emacs *compile* buffer
TinyCompile is a minor mode for *compile* buffer from where
you can collapse unwanted lines or shorten file URLs:
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file1:NNN: MATCHED TEXT
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file2:NNN: MATCHED TEXT
-->
cd /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/
file1:NNN: MATCHED TEXT
file1:NNN: MATCHED TEXT
End
------------------------------
Date: Sat, 03 Apr 2004 11:40:52 +0800
From: toylet <toylet_at_mail.hongkong.com>
Subject: Re: eval()
Message-Id: <406e3211$1_1@rain.i-cable.com>
> You want eval{} not eval(). They do quite different things. BTW: For
> what you are doing you don't need to know what eval() does but if
Program execution now continued, but the error message still showed up.
COuld I suppress that as well?
DBD::mysqlPP::db do failed: Unknown table 'foo' at ./mysql.pl line 14.
--
.~. Might, Courage, Vision. In Linux We Trust.
/ v \ http://www.linux-sxs.org
/( _ )\ Linux 2.4.22-xfs
^ ^ 11:38am up 8 days 3:52 load average: 1.01 0.97 0.96
------------------------------
Date: Sat, 03 Apr 2004 02:03:45 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: free source for bbs
Message-Id: <406e1947.1830693@news.erols.com>
"Robin" <webmaster@infusedlight.net> wrote:
: I've actually fixed the security glitches now
Bullshit. Security is designed into a product. Your design is inherently
insecure. This is not something you can fix by pecking in a few more lines
of code.
: ....it's really shitty to get
: hacked, but it won't happen again.
You have no idea what you're doing, do you?
------------------------------
Date: Sat, 03 Apr 2004 04:15:06 GMT
From: Kirk Strauser <kirk@strauser.com>
Subject: Re: free source for bbs
Message-Id: <8765chn1g6.fsf@strauser.com>
=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
At 2004-04-02T21:18:58Z, Kirk Strauser <kirk@strauser.com> writes:
> I well bet $$$ that if your site ever gets any amount of traffic, then
> your message board *will* be compromised again.
That didn't take as long as I thought. As of 2004-04-02 at 10:09PM CST, all
categories were deleted except for one named "Idiot" with a topic of
"pwn3d!!!1".
For the record, I had nothing to do with that, and I do not in any way
condone the defacing of another's website. That's just plain wrong. Still,
I lack the words to express how completely not surprised I am.
Robin, pull your board offline. You need much more experience before
writing a system to let random people write data to your hard drive. Count
yourself lucky that you haven't opened a portal to the rest of your website.
=2D --=20
Kirk Strauser
The Strauser Group
Open. Solutions. Simple.
http://www.strausergroup.com/
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFAbjns5sRg+Y0CpvERAqdQAJ41P/xHjBJqe5MeMH0r29HUzMZ8jgCdGwca
TTtVDz33qfEoeMrYAyF5ugc=3D
=3Dadt8
=2D----END PGP SIGNATURE-----
------------------------------
Date: 01 Apr 2004 16:45:08 -0500
From: Uri Guttman <uri.guttman@fmr.com>
Subject: Re: free source for bbs
Message-Id: <siscsmfntlsr.fsf@tripoli.fmr.com>
oy!!! lookie here:
sub getfoot
{
my ($footer) = @_;
if (-e "$footer")
{
open (FOOT, "$footer");
@footer = <FOOT>;
close (FOOT);
return (@footer);
}
else
{
open (FOOT, ">$footer");
print FOOT <<END;
</body>
</html>
END
close (FOOT);
open (FOOT, "$footer");
@footer = <FOOT>;
return (@footer);
}
}
sub getfoot
{
my ($footer) = @_;
if (-e "$footer")
{
open (FOOT, "$footer");
@footer = <FOOT>;
close (FOOT);
return (@footer);
}
else
{
open (FOOT, ">$footer");
print FOOT <<END;
</body>
</html>
END
close (FOOT);
open (FOOT, "$footer");
@footer = <FOOT>;
return (@footer);
}
}
sub file_maxmode
{
my ($filename) = @_;
chmod (0777, $filename);
}
does anyone see something wrong there?
i wouldn't line my cat's litter box with this code. it isn't worthy
enough for her to piss on.
uri
------------------------------
Date: 3 Apr 2004 08:19:44 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: free source for bbs
Message-Id: <c4ls30$3m0$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Robin:
> I've actually fixed the security glitches now....it's really shitty to get
> hacked, but it won't happen again.
Hmmh, have you really? Appears as though someone is flooding your board
with an automated script or something. I guess he's having fun...
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: 3 Apr 2004 06:46:45 -0800
From: hahsmirak@yahoo.com (Shah Karim)
Subject: HTML Tag Counter
Message-Id: <28d5cf4f.0404030646.f70d0c5@posting.google.com>
Hi,
I am looking for a simple script that will count the tags in an HTML
document, and tally up the total number of occurences of each tag. The
end result should be a list of all tags found and the number of times
each tag was encountered.
Does anyone know if such a program is available freely somewhere?
Pointers would be appreciated.
Thanks,
Shah
------------------------------
Date: 3 Apr 2004 15:31:40 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: HTML Tag Counter
Message-Id: <c4mlcs$o6g$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Shah Karim:
> I am looking for a simple script that will count the tags in an HTML
> document, and tally up the total number of occurences of each tag. The
> end result should be a list of all tags found and the number of times
> each tag was encountered.
>
> Does anyone know if such a program is available freely somewhere?
> Pointers would be appreciated.
See <c4dvm6$qqq$1@nets3.rz.RWTH-Aachen.DE>. It includes an example that
counts the opening and closing tags. It should be pretty easy to change
this snippet to use a hash to store the tags and increase their number
each time they show up in the document.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: 2 Apr 2004 21:58:21 -0500
From: vorxion@knockingshopofthemind.com (Vorxion)
Subject: Re: Lost data on socket - Can we start over politely?
Message-Id: <406e284d$1_1@news.iglou.com>
In article <020420040931339533%jgibson@mail.arc.nasa.gov>, Jim Gibson wrote:
>In article <406ae243.0@juno.wiesbaden.netsurf.de>, Thomas Kratz
><ThomasKratz@REMOVEwebCAPS.de> wrote:
>
>>
>> That depends ;-) The questions are:
>>
>> 1. Do I need more than SOMAXCONN simultaneous connections?
>
>My understanding of the SOMAXCONN Unix kernel parameter is that it
>refers to the maximum number of "unaccepted socket connections that can
>be waiting in queue" (see for example
>http://www.islandnet.com/~mark/somaxconn.html ).
>
>Once the socket server program has done the accept on the incoming
>socket connection request (listen()), the socket is removed from the
>queue of waiting requests and is not restricted by the SOMAXCONN limit.
>Therefore, it is possible to have more than SOMAXCONN connections, but
>only up to SOMAXCONN waiting requests at any time. A typical value of
>SOMAXCONN is 5, but web servers need to handle many more simultaneous
>connections than that.
While it may -seem- irrelevant in light of my original apparent dimness
regarding buffering, that was my understanding of SOMAXCONN as well--that
it refers to un-accept()ed queued connections.
It's also readily testable--connect 6 times on a system where it's 5, or
set Listen to 1 and connect twice. You'll see that it doesn't blow up, and
in fact accepts them.
I handle maximum accepted connection count entirely separately.
Actually, going back to web servers, assuming you use a forked model,
they're still all sitting on the same port--how does it decide which socket
it will attempt to connect to? Or is there something in the lower layer
functionality that forces it to either aggregate the pool or forces a roll
to the first open spot in the pool?
THANKS to the very gracious help of those in this thread, I've got my
server processing data and accepting 1MB of input split between two
concurrent connections at once, not missing anything--it used to drop data
on the floor at 30k or so on -one- connection.
So...a HUGE "Thank You!" to everyone that contributed, and a special thank
you to Thomas, as his help was really the key that made it click for me,
even in the presence of everyone else's valuable contributions.
Had I just thought about NFS performance issues with small block sizes to
begin with, and extrapolated, I'd have figured it out myself, probably. I
just never added 2 and 2, much to my shame. Thanks for the help, folks!
And an apology to Uri for getting into it with him, last but not least.
FWIW, I may eventually convert. You've got me at least -thinking- about
it every time I'm typing a nest of curlies and closing them off right
now. Thinking about it is step #0.5. I still don't admit I have a problem
there, but I'm at least considering it. So all may not have been in vain
even there. I'll at -least- "cleanse" code snippets I may post here in
future.
And y'all got me using strict, finally. It is a wee bit helpful, actually.
So, much good has come out of this. Sorry for any headaches I induced for
anyone.
--
Vorxion - Member of The Vortexa Elite
------------------------------
Date: Sat, 03 Apr 2004 03:48:11 GMT
From: Mike Livingstone <ebenezer@shaw.ca>
Subject: Media For Sale
Message-Id: <406E3378.C8C3EF67@shaw.ca>
I have several different media for sale:
5" 640 MB optical disks (aka PD disks)
3" 125 MB optical disks (sometimes referred to as optimagneto)
3" 230 MB optical disks (sometimes referred to as optimagneto)
720K floppy disks
1.44 MB floppy disks without read/write tab
For info call (780) 437-1253 or email ebenezer@shaw.ca
Thanks.
Mike L
------------------------------
Date: Sat, 03 Apr 2004 04:07:35 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Media For Sale
Message-Id: <x73c7lk8l5.fsf@mail.sysarch.com>
>>>>> "ML" == Mike Livingstone <ebenezer@shaw.ca> writes:
ML> I have several different media for sale:
ML> 5" 640 MB optical disks (aka PD disks)
ML> 3" 125 MB optical disks (sometimes referred to as optimagneto)
ML> 3" 230 MB optical disks (sometimes referred to as optimagneto)
ML> 720K floppy disks
ML> 1.44 MB floppy disks without read/write tab
and do these come loaded with tons of useful perl code?
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 2 Apr 2004 19:42:18 -0800
From: junk@dlink.org (Aqua)
Subject: PDF File Information thru PERL
Message-Id: <55d7995c.0404021942.6c6ff96e@posting.google.com>
Hello Group,
I am posting this question to both perl and PDF Groups.
I would like to get all the information about a PDF file. I dont want
to modidy ot create a PDF file. Information like PDF Version, Total
Pages, if possible total images, if it is bookmarked etc.
In this regard I am trying various modules like PDF (PDF::Parse,
PDF::Core) and PDF::API2. The first module work fine but not on all
PDF files. The second one, actually I dont know how to get information
without modifying the PDF.
I would appreciate any pointers in this regard.
Thank You
Dominic
------------------------------
Date: Sat, 3 Apr 2004 10:42:11 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Perl and Internet Explorer
Message-Id: <c4m4bl$lnr$1@news.simnet.is>
"akaliel" <akaliel@streamflo.com> wrote in message
news:7123bc57.0404020925.2f5f99ab@posting.google.com...
[snip IE problem]
use the $ENV{PATH_INFO} trick if your webserver supports it,
or just drop IE. there are plenty of alternatives
gnari
------------------------------
Date: 02 Apr 2004 17:09:24 -0500
From: Uri Guttman <uri.guttman@fmr.com>
Subject: Re: Possible to open a Berkeley 4.2 db file with DB_File?
Message-Id: <siscad1ut4kr.fsf@tripoli.fmr.com>
>>>>> "1" == 187 <bigal187.invalid@adexec.com> writes:
1> Is it possible to open a Berkeley 4.2 db file with DB_File?
1> It doesn't not seem to want to open:
IIRC, bsd dbm is not the exact same thing as berkeley db
(sleepycat). DB_File is for sleepycat's db and i think there is a
different tie/dbm module for berkeley db. so i think you are crossing db
types and modules which is why is failing.
uri
------------------------------
Date: Fri, 2 Apr 2004 21:02:31 -0600
From: "John" <john@newchester.com>
Subject: RFC: UniqueID Module
Message-Id: <c4l9gc$2iqd$1@news.f.de.plusline.net>
I need an alternative for 'use constant', but that allows the definition of
unique IDs not associated with scalar values.
I propose the UniqueID class, summarized below. I'm asking this list:
- Is this module necessary, or is there a better way to do this?
- Is it aptly named?
- Other comments before I post to CPAN?
Synopsis:
use UniqueID qw (red yellow blue);
my $color = red;
print "Just as we thought!\n" if $color == red;
print "This will never happen!\n" if $color == blue;
print "Nor will this!\n" if $color == 'red';
print "Color is ".$color->name.".\n";
$color + 1; #Raises an exception. Addition isn't defined for UniqueID
objects.
Output:
Just as we thought!
Color is red.
The '+' operation isn't defined for UniqueID objects at C:\test5.pl line 11
Rationale:
UniqueID lets you define unique identifiers that are not associated with
scalar values. Contrast this with the "constant" package, which simply
aliases names to scalar values.
UIDs are safer than constants, because they can not accidently be confused
with un-related scalars. For example, the following accident might happen
using aliased constants:
use constant red => 0;
my $color;
my $color = red if not 1; #*Don't* set $color to red.
#Comparing $color to red is the same as comparing it to 0.
if($color == red) {
print "Color is red!\n";
} else {
print "Color is NOT red!\n";
}
Output: Color is red!
Whereas colors can never be confused with numbers if you use UIDs:
use UniqueID qw (red);
my $color = red if 0; #*Don't* set $color to red.
###Red doesn't equal 0 or undef.
if($color == red) {
print "Color is red!\n";
} else {
print "Color is NOT red!\n";
}
Output: Color is NOT red!
------------------------------
Date: 3 Apr 2004 06:33:31 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: RFC: UniqueID Module
Message-Id: <c4llrr$41q$1@mamenchi.zrz.TU-Berlin.DE>
John <john@newchester.com> wrote in comp.lang.perl.misc:
> I need an alternative for 'use constant', but that allows the definition of
> unique IDs not associated with scalar values.
>
> I propose the UniqueID class, summarized below. I'm asking this list:
>
> - Is this module necessary, or is there a better way to do this?
> - Is it aptly named?
> - Other comments before I post to CPAN?
>
>
> Synopsis:
>
> use UniqueID qw (red yellow blue);
>
> my $color = red;
>
> print "Just as we thought!\n" if $color == red;
> print "This will never happen!\n" if $color == blue;
> print "Nor will this!\n" if $color == 'red';
^^
Wrong comparison operator. "==" is for numbers, you need "eq".
> print "Color is ".$color->name.".\n";
>
> $color + 1; #Raises an exception. Addition isn't defined for UniqueID
> objects.
>
> Output:
> Just as we thought!
> Color is red.
> The '+' operation isn't defined for UniqueID objects at C:\test5.pl line 11
You can have unique identifiers in Perl by just taking a reference to
anything. So you get most of the behavior you describe after just saying:
use constant red => \ '';
use constant yellow => \ '';
use constant blue => \ '';
instead of
use UniqueID qw (red yellow blue);
The difference is that the arithmetic operation is allowed and that
there is no ->name method.
> Rationale:
>
> UniqueID lets you define unique identifiers that are not associated with
> scalar values. Contrast this with the "constant" package, which simply
> aliases names to scalar values.
>
> UIDs are safer than constants, because they can not accidently be confused
> with un-related scalars. For example, the following accident might happen
> using aliased constants:
>
> use constant red => 0;
>
> my $color;
> my $color = red if not 1; #*Don't* set $color to red.
>
> #Comparing $color to red is the same as comparing it to 0.
> if($color == red) {
> print "Color is red!\n";
> } else {
> print "Color is NOT red!\n";
> }
>
> Output: Color is red!
...plus a warning, if warnings are on as they should. While an undef
*can* be mistaken for a 0 (or a ""), there is a difference, and a
program can tell which is which.
[...]
I have as yet not missed the functionality of UniqueID.
Anno
------------------------------
Date: Sat, 03 Apr 2004 02:38:24 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: scope again
Message-Id: <406E237A.8070303@rochester.rr.com>
Richard Morse wrote:
> In article <slrnc6je7l.ig8.xx087@smeagol.ncf.ca>,
> Glenn Jackman <xx087@freenet.carleton.ca> wrote:
...
>> % $s->fchsym
>> tile is 'foo'
>>
>
> Wait -- completely un-related to the question, what is this? How do you
> get an interactive Perl?
Windoze version:
perl -e "print '% ',eval <STDIN>,print qq(\n) while 1"
>
> Ricky
>
>
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: 3 Apr 2004 01:14:32 -0800
From: chris@mobiles.co.uk (Chris Conwell)
Subject: Re: uninitialized value in concatenation ...
Message-Id: <5f675152.0404030114.7c88784f@posting.google.com>
Uri Guttman <uri.guttman@fmr.com> wrote in message news:<siscbrmbv65e.fsf@tripoli.fmr.com>...
> i hope you don't actually use 1 char indents. 2 is bad enough with 3 or
> 4 being a good minimum.
No, that's just how it appeared when I cut and pasted into Google
Groups, by default Homesite uses 5.
> no need for () around @_. the left side provides the list context and
> the () are not doing anything.
>
> CC> 3915 return unless ($price);
>
> no need for () there, any expression is fine. only if statements (as
> below) need () for proper syntax.
Thanks, never realised that before.
> CC> 3916 if ($price) {
>
> why are you again testing $price when you just returned if you have no
> price?
As per previous posts, some apparently superfluous lines were added to
aid debugging when Perl appeared to me to be giving an impossible
error message.
> secondly, i bet your line numbering is at fault. how did you determine
> those line numbers? perl may have a different view of what line numbers
> are than you (or the program you used) do. did your line numbering thing
> count long wrapped lines as 1 or multiple lines? perl counts them as one
> line.
I wish it were that simple but unfortunately its not. The line
numbering is definitely correct and Homesite quite happily handles
line/word wrap.
Thanks for the input.
Chris.
------------------------------
Date: 3 Apr 2004 02:38:46 -0800
From: chris@mobiles.co.uk (Chris Conwell)
Subject: Re: uninitialized value in concatenation ...
Message-Id: <5f675152.0404030238.28e4289@posting.google.com>
John Bokma <postmaster@castleamber.com> wrote in message news:<406d007b$0$24338$58c7af7e@news.kabelfoon.nl>...
> > CC> Are you thinking that the error is actually on one of the "elsif"
> > CC> statements and is being incorrectly flagged as the first "if" line?
> >
> > that is very possible. perl does sometimes report line numbers in odd
> > places and this could be one of them. so investigate $this_index's value
>
> I remember this being a bug (got bitten by it a few times about a year
> ago), and it is indeed elsif related. Couldnīt find it with Google though.
Bingo! Yes, it appears to be a bug in that it was actually one of the
"elsif" lines further on causing the problem.
Many thanks for everyone's help in fixing this annoying problem.
Chris.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 6358
***************************************