[15509] in Perl-Users-Digest
Perl-Users Digest, Issue: 2919 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 2 00:05:27 2000
Date: Mon, 1 May 2000 21:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <957240312-v9-i2919@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 1 May 2000 Volume: 9 Number: 2919
Today's topics:
Re: #How to parse and strip perl comments? <phill@modulus.com.au>
Re: array searching <ascii7@home.com>
calling function name <crazycoder@my-deja.com>
Re: calling function name (Martien Verbruggen)
Re: CGI.pm and -w <webmaster@momsathome.on.ca>
Re: CGI.pm and -w <webmaster@momsathome.on.ca>
Re: CGI.pm and -w <jeff@vpservices.com>
Re: CGI.pm and -w <webmaster@momsathome.on.ca>
Re: CGI.pm and -w <webmaster@momsathome.on.ca>
CGI.pm and default values <webmaster@momsathome.on.ca>
Re: CGI.pm and default values <care227@attglobal.net>
Re: DBI Installation Win2K <fred@fred.com>
Extracting selected lines from a file <danmurph@worldnet.att.net>
Re: Extracting selected lines from a file <uri@sysarch.com>
Re: EZ: How do I check if a value exists in an array? <uri@sysarch.com>
Global Destruction Messages <bwalton@rochester.rr.com>
Help with an error please <webmaster@momsathome.on.ca>
Re: Help with an error please <care227@attglobal.net>
Re: Help with an error please <rootbeer@redcat.com>
Re: HOW CAN I TELL... (OT) (Martien Verbruggen)
Re: How do I detect the presence of a network? <care227@attglobal.net>
Re: more troubleshooting <care227@attglobal.net>
order cgi vars are passed in, predictable? <bian_les@hotmail.com>
Re: order cgi vars are passed in, predictable? <care227@attglobal.net>
Re: Passing DBI Connection between Processes? <makarand_kulkarni@My-Deja.com>
Re: Problem with $ sign in string <godzilla@stomp.stomp.tokyo>
Re: Problem with $ sign in string <lauren_smith13@hotmail.com>
Re: Problem with $ sign in string <lauren_smith13@hotmail.com>
Re: Problem with $ sign in string <care227@attglobal.net>
Problems with creating a unique key for a script to sea (Lobo)
Re: program that prints itself <johnlin@chttl.com.tw>
Re: program that prints itself <johnlin@chttl.com.tw>
Puzzled - Please help. <sparky@alt-usage-english.org>
Re: Puzzled - Please help. <phill@modulus.com.au>
Re: Puzzled - Please help. (Tad McClellan)
Re: resizing an image <sjohn92694@kcweb.net>
Re: resizing an image <rootbeer@redcat.com>
Re: resizing an image <rootbeer@redcat.com>
Re: toggling read-only flag for files in win32 <Jonathan.L.Ericson@jpl.nasa.gov>
Re: Where is it found? (Clinton A. Pierce)
Re: Which template module? CGI::FastTemplate? <webmaster@momsathome.on.ca>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 02 May 2000 10:55:50 +1000
From: Peter Hill <phill@modulus.com.au>
Subject: Re: #How to parse and strip perl comments?
Message-Id: <390E2796.3D1E@modulus.com.au>
Tom Phoenix wrote:
[snip]
> Oh, you want a program to do it. That smells as if you want to obfuscate
> your code.
No. My code is sufficiently obscure as it is, and needs no help in that
direction - I'm just production prepping some heavily (indeed
excessively) commented code.
>
> But, as far as parsing perl is concerned, "Nothing can parse Perl but
> perl." Perhaps you want to use one of the compiler backends, such as
> B::Deparse. In the current version, you may have to tweak the resulting
> code to get it to work.
That's probably going to be a good start. Thanks.
> Cheers!
Echoed.
--
Peter Hill,
Modulus Pty. Ltd.,
http://www.modulus.com.au/
------------------------------
Date: Tue, 02 May 2000 01:58:24 GMT
From: ascii7 <ascii7@home.com>
Subject: Re: array searching
Message-Id: <390CB38A.53D00FE2@home.com>
I did try it first. When I tried it all it did was assign @another_array
to @an_array. Thanks anyway, at least now I know that this isn't causing
me any problems.
Larry Rosler wrote:
>
> In article <390C8814.F97E8624@home.com> on Mon, 01 May 2000 22:52:36
> GMT, ascii7 <ascii7@home.com> says...
> > I am learning Perl and was wondering if you could help me with a
> > problem. I want to know if there is a way to pass the grep function a
> > variable. Ex:
> >
> > @an_array=grep /$a_string/, @another_array;
> >
> > Where $a_string is user input. Any help would be appreciated.
>
> What happened when you tried it?
>
> Warning: You must decide if the user input is a literal string or a
> regex. If the former, you should interpolate it thus:
>
> /\Q$a_string/
>
> Or you might use a different predicate, such as a comparison operator or
> the index() function, to decide if the match occurs.
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
------------------------------
Date: Tue, 02 May 2000 02:44:17 GMT
From: crazyCoder <crazycoder@my-deja.com>
Subject: calling function name
Message-Id: <8elfdu$mo4$1@nnrp1.deja.com>
is there a way to tell the name of the calling function in perl.
e.g.;
sub xyz {
abc("test1");
}
sub qwe {
abc("test2");
}
sub abc {
$str = @_;
print $str;
}
in sub abc can I know whether I am being called from xyz() or qwe()?
thanks,
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 02 May 2000 02:56:03 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: calling function name
Message-Id: <slrn8gsgtv.4l2.mgjv@verbruggen.comdyn.com.au>
On Tue, 02 May 2000 02:44:17 GMT,
crazyCoder <crazycoder@my-deja.com> wrote:
> is there a way to tell the name of the calling function in perl.
# perldoc -f caller
Martien
--
Martien Verbruggen |
Interactive Media Division | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Mon, 01 May 2000 22:23:28 -0400
From: Jennifer <webmaster@momsathome.on.ca>
Subject: Re: CGI.pm and -w
Message-Id: <390E3C20.D8B33B7C@momsathome.on.ca>
Tony Curtis wrote:
>
> Could you show some small code that demonstrates this
> behaviour? The following works fine for me:
>
> #!/usr/bin/perl -w
> use strict;
> use CGI qw(:standard);
>
> $CGI::POST_MAX=1024 * 1000; # max 1M posts
> $CGI::DISABLE_UPLOADS = 1; # no uploads
>
> print header(); # for example
>
> $ perl -cwT <this-script>
> <this-script> syntax OK
> $ ./<this-script> =
> (offline mode: enter name=value pairs on standard input)
> Content-Type: text/html
>
> $ perl -v
> ...
> This is perl, v5.6.0 built for i586-linux
> ...
I'm also mentioned that I was using CGI::Carp
qw(fatalsToBrowser), which I don't see in your program. Maybe
that's the difference?
Jennifer
------------------------------
Date: Mon, 01 May 2000 22:26:30 -0400
From: Jennifer <webmaster@momsathome.on.ca>
Subject: Re: CGI.pm and -w
Message-Id: <390E3CD6.FA5829FB@momsathome.on.ca>
Drew Simonis wrote:
>
> Jennifer wrote:
> >
> > I'm using the following statements at the top of my scripts.
> > $CGI::POST_MAX=1024 * 1000; # max 1M posts
> > $CGI::DISABLE_UPLOADS = 1; # no uploads
> >
> > Except now I am getting tons of warnings in my logs that they are
> > only used once and may be a typo. I'm also using CGI::Carp
> > qw(fatalsToBrowser) and -w Is there some way to stop these
> > errors aside from removing the fatalsToBrowser or -w?
>
> To stop the compiler warnings (-w) you could, as previously
> suggested, use the variables twice (wastefull, I think)
That was the only thing that I came up with on my own as well.
But I also though it was a bit of a cludge just as the poster who
suggested it said.
> or
> you could enclose these in a block and then turn off warnings
> for that block by setting the special variable $^W to 0.
>
> If you do that, make sure you use the 'local' directive so you
> don't change the main $^W.
I like this solution.
Jennifer
------------------------------
Date: Mon, 01 May 2000 20:16:04 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: CGI.pm and -w
Message-Id: <390E4874.A87ED968@vpservices.com>
Jennifer wrote:
>
> Tony Curtis wrote:
> >
>
> > Could you show some small code that demonstrates this
> > behaviour? The following works fine for me:
> >
> > #!/usr/bin/perl -w
> > use strict;
> > use CGI qw(:standard);
> >
> > $CGI::POST_MAX=1024 * 1000; # max 1M posts
> > $CGI::DISABLE_UPLOADS = 1; # no uploads
> >
> > print header(); # for example
> >
>
> I'm also mentioned that I was using CGI::Carp
> qw(fatalsToBrowser), which I don't see in your program. Maybe
> that's the difference?
No, the thing still runs for me with no warnings or errors after putting
in CGI::Carp qw (fat...
I repeat my suggestion that this is version dependent. What version of
CGI and Perl are you running, on what platform?
--
Jeff
------------------------------
Date: Mon, 01 May 2000 23:37:09 -0400
From: Jennifer <webmaster@momsathome.on.ca>
Subject: Re: CGI.pm and -w
Message-Id: <390E4D65.647B3214@momsathome.on.ca>
Drew Simonis wrote:
>
> Jennifer wrote:
> >
> > I'm using the following statements at the top of my scripts.
> > $CGI::POST_MAX=1024 * 1000; # max 1M posts
> > $CGI::DISABLE_UPLOADS = 1; # no uploads
> >
> > Except now I am getting tons of warnings in my logs that they are
> > only used once and may be a typo. I'm also using CGI::Carp
> > qw(fatalsToBrowser) and -w Is there some way to stop these
> > errors aside from removing the fatalsToBrowser or -w?
>
> To stop the compiler warnings (-w) you could, as previously
> suggested, use the variables twice (wastefull, I think) or
> you could enclose these in a block and then turn off warnings
> for that block by setting the special variable $^W to 0.
>
> If you do that, make sure you use the 'local' directive so you
> don't change the main $^W.
I'm not good with terminology. Enclosing in a block means
enclosing in curly braces right?
I tried the following and it still prints a warning to the logs.
Am I missing something?
{
local $^W = 0; #quiet warning that these variables only used once
$CGI::POST_MAX=1024 * 1000; # max 1M posts
$CGI::DISABLE_UPLOADS = 1; # no uploads
}
I also tried getting rid of CGI::Carp qw(fatalsToBrowser) to no
avail.
Jennifer
------------------------------
Date: Mon, 01 May 2000 23:51:04 -0400
From: Jennifer <webmaster@momsathome.on.ca>
Subject: Re: CGI.pm and -w
Message-Id: <390E50A8.EB3970C5@momsathome.on.ca>
Jeff Zucker wrote:
>
> Tony Curtis wrote:
> >
> > >> On Sun, 30 Apr 2000 21:24:57 -0400,
> > >> Jennifer <webmaster@momsathome.on.ca> said:
> >
> > > I'm using the following statements at the top of my
> > > scripts. $CGI::POST_MAX=1024 * 1000; # max 1M posts
> > > $CGI::DISABLE_UPLOADS = 1; # no uploads
> >
> > > Except now I am getting tons of warnings in my logs that
> > > they are only used once and may be a typo.
> >
> > Could you show some small code that demonstrates this
> > behaviour? The following works fine for me:
> >
> > [snip example of -w and strict safe use of those variables]
>
> Yeah, it works for me too. I seem to remember having had problems with
> this in the past though so perhaps it depends on the version of CGI.pm.
> Mine is 2.56 with activePerl build 522 on win98.
I'm using CGI version: 2.36 and perl version: 5.00404 on Solaris.
And so far have not found a solution other than turning off -w or
setting the variables twice.
Jennifer
------------------------------
Date: Mon, 01 May 2000 22:36:40 -0400
From: Jennifer <webmaster@momsathome.on.ca>
Subject: CGI.pm and default values
Message-Id: <390E3F38.39498B81@momsathome.on.ca>
I'm having a problem getting a radio button group to have the
correct default. The value is not already set so I don't see how
the 'sticky' characteristic is taking effect. To be sure, I am
printing the variable to the screen first before printing the
radio group and it has no value.
Is there something simple that I am missing? I'm having a bad
day for stupid errors and maybe fresh eyes can see something that
I can't.
print "Search boolean: ",$query->param('search_boolean');
print $query->radio_group(-name=>'search_boolean',
-'values'=>['OR','AND'],
-default=>'AND',
-labels=>{'OR' => 'Any Word',
'AND' => 'All Words'}
);
Jennifer
------------------------------
Date: Mon, 01 May 2000 23:11:16 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: CGI.pm and default values
Message-Id: <390E4754.93A768B8@attglobal.net>
Jennifer wrote:
>
> I'm having a problem getting a radio button group to have the
> correct default. The value is not already set so I don't see how
> the 'sticky' characteristic is taking effect.
this one here is probably better suited to
comp.infosystems.www.authoring.cgi
Try it, you'll like it.
------------------------------
Date: Tue, 02 May 2000 02:48:51 GMT
From: "Fred" <fred@fred.com>
Subject: Re: DBI Installation Win2K
Message-Id: <nmrP4.15032$x4.523097@newsread1.prod.itd.earthlink.net>
Thanks -jr
This worked perfectly, in about 30 seconds.
So much for the past 18 hours of effort.
Thanks so much for you help. =)
John
------------------------------
Date: Tue, 02 May 2000 02:07:29 GMT
From: "Daniel Murphy" <danmurph@worldnet.att.net>
Subject: Extracting selected lines from a file
Message-Id: <BLqP4.44893$WF.2336204@bgtnsc04-news.ops.worldnet.att.net>
I would like to extract selected continuous lines from a file. The first
line and the last line of the extracted lines will each have a certain text
string for which I will be searching. For example, in a 1000 line file, the
first occurance of this string might be on line 500, and the last occurance
on line 900. Not all lines in between have the string. I want to get all
lines between 500 and 900. Thanks in advance.
------------------------------
Date: Tue, 02 May 2000 02:20:27 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Extracting selected lines from a file
Message-Id: <x7vh0xy9p2.fsf@home.sysarch.com>
>>>>> "DM" == Daniel Murphy <danmurph@worldnet.att.net> writes:
DM> I would like to extract selected continuous lines from a file. The
DM> first line and the last line of the extracted lines will each have
DM> a certain text string for which I will be searching. For example,
DM> in a 1000 line file, the first occurance of this string might be
DM> on line 500, and the last occurance on line 900. Not all lines in
DM> between have the string. I want to get all lines between 500 and
DM> 900. Thanks in advance.
use the scalar range operator ..
while( <HANDLE> ) {
print if /first_string/ .. /second_string/ ;
}
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Tue, 02 May 2000 02:14:34 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: EZ: How do I check if a value exists in an array?
Message-Id: <x71z3lzojb.fsf@home.sysarch.com>
>>>>> "JE" == Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov> writes:
JE> Nick wrote:
>> what can I use to check whether a value exists in an array or not (
>> basically returning true if it does, false if not)? Is there a built-in
>> function?
JE> From perldelta (v5.6.0):
JE> exists() and delete() are supported on array elements
JE> Could be a reason to upgrade.
could be a faulty reason.
they only deal with individual elements and so do not scan the array for
a given value.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Tue, 02 May 2000 02:12:16 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Global Destruction Messages
Message-Id: <390E398D.81A4247B@rochester.rr.com>
I have a complicated application using DBI and Tk which works fine, with
the exception of a series of messages when the program is shut down. I
get eight of:
Attempt to free unreferenced scalar during global destruction.
and one of:
Can't upgrade that kind of scalar during global destruction.
Platform: Win32 -- Windows 98 SE.
Versions: Perl 5.005_03, ActiveState build 522 (can't use 5.6
because it requires NT service pack 5, which we don't
have universally)
Tk 800.020
DBI 1.13
Any ideas what these mean, and whether they are important? Thanks.
--
Bob Walton
------------------------------
Date: Mon, 01 May 2000 22:44:37 -0400
From: Jennifer <webmaster@momsathome.on.ca>
Subject: Help with an error please
Message-Id: <390E4115.F9E9C28@momsathome.on.ca>
I'm finding this error in my logs.
[Mon May 1 22:31:41 2000] db_query.cgi: Use of uninitialized
value at (eval 8) line 27.
I understand what 'Use of uninitialized value' means but I don't
know what (eval 8) means.
Line 27 of the main program is a comment.
Also this error is appearing about 5 or 6 times for each call to
the script.
Jennifer
------------------------------
Date: Mon, 01 May 2000 23:17:57 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Help with an error please
Message-Id: <390E48E5.E783FDAB@attglobal.net>
> I understand what 'Use of uninitialized value' means but I don't
> know what (eval 8) means.
>
> Line 27 of the main program is a comment.
What happens when you run from the command line? I recall that you
are using CGI.pm, and it has a very friendly command line interface
that allows you to pass it name/value pairs just as if they came
from a web form. Great for debugging scripts that may be complex.
(although I still can't figure out my own error. I think I can
endear myself to the local experts by answering the easy questions.
Im not trying to be helpfull, its all a cleverly crafted ploy to
get aid with my own problem =)
------------------------------
Date: Mon, 1 May 2000 20:45:44 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Help with an error please
Message-Id: <Pine.GSO.4.10.10005012043310.13677-100000@user2.teleport.com>
On Mon, 1 May 2000, Jennifer wrote:
> [Mon May 1 22:31:41 2000] db_query.cgi: Use of uninitialized
> value at (eval 8) line 27.
>
> I understand what 'Use of uninitialized value' means but I don't
> know what (eval 8) means.
It means that the error seems to be on line 27 of the 8th string
eval-uated at runtime. So, somewhere in your code (or in modules used by
your code) eval() is being given a string containing code which triggers
that warning.
Try stepping through your program in the debugger. Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 02 May 2000 02:49:31 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: HOW CAN I TELL... (OT)
Message-Id: <slrn8gsghn.4l2.mgjv@verbruggen.comdyn.com.au>
On Mon, 1 May 2000 14:50:06 -0700,
Larry Rosler <lr@hpl.hp.com> wrote:
> In article <dennis_marti-B8D5EA.01450829042000@news.starpower.net> on
> Sat, 29 Apr 2000 01:45:08 -0400, Dennis Marti <dennis_marti@yahoo.com>
> says...
> > In article <MPG.1373a45461592b1198a9ae@nntp.hpl.hp.com>, Larry Rosler
> > <lr@hpl.hp.com> wrote:
> >
> > > On 'most' operating systems (i.e., on the operating systems that run 90%
> > > or more of the world's computers), the system imposes a mandatory lock
^^^^^^^^^^^^^^^^^^^^^
> >
> > Where did you find this statistic? I'm still looking, but, so far,
> > haven't been able to verify it.
>
> <URL:http://www.dcd.uscourts.gov/ms-findings2.pdf>
>
> III. MICROSOFT'S POWER IN THE RELEVANT MARKET
>
> ...
>
> A. Market Share
>
> 35. Microsoft possesses a dominant, persistent, and increasing share
> of the worldwide market for Intel-compatible PC operating systems.
> Every year for the last decade, Microsoft's share of the market for
> Intel-compatible PC operating systems has stood above ninety percent.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> For the last couple of years, the figure has been at least ninety-five
> percent, and analysts project that the share will climb even higher over
> the next few years. Even in Apple's Mac OS were included in the
> relevant market, Microsoft's share would still stand well over eighty
> percent.
<nit>
"the world's computers" ne "Intel-compatible PC operating systems"
The figures (as mentioned above) get different when you include
Macintoshes, and no doubt get even more different if you include SPARC
and other architectures.
</nit>
Martien
--
Martien Verbruggen |
Interactive Media Division | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Mon, 01 May 2000 23:04:41 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: How do I detect the presence of a network?
Message-Id: <390E45C9.B56C9B6C@attglobal.net>
Stephan Gross wrote:
>
> I have an application that gets data from a database. The application
> will be distributed with the database. However, the most recent copy
> of the database is on the LAN.
>
> What I would like to do is have the Perl program check for
> connectivity to the LAN when it starts up.
to the LAN? er... hows ping do ya? (although handling the error
when checking for the connection to the database is much better)
------------------------------
Date: Mon, 01 May 2000 23:07:45 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: more troubleshooting
Message-Id: <390E4681.5D8C42CD@attglobal.net>
bh wrote:
>
> ok. I am horrible at substition, but according to my books this should
> work (I'm missing something obviously, I just don't know what).
>
> The $umask = "umask 022"
Don't use a regex when you don't need to. It makes things complex.
Considered using split()?
------------------------------
Date: Tue, 02 May 2000 02:30:14 GMT
From: Alex <bian_les@hotmail.com>
Subject: order cgi vars are passed in, predictable?
Message-Id: <sgsfdmtkoog162@corp.supernews.com>
Hi,
Is it true that cgi values aren't
always passed to a cgi in order as
they are on page? I have heard
this is true, but so far, I can always
predict the order my vars will come
through in the QUERY_STRING. I
am programming cgi's in C, but I figured
perl people could answer this.
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Mon, 01 May 2000 23:13:45 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: order cgi vars are passed in, predictable?
Message-Id: <390E47E9.98DB81B9@attglobal.net>
Alex wrote:
>
> Hi,
> Is it true that cgi values aren't
> always passed to a cgi in order as
> they are on page? I have heard
> this is true,
I recall
reading
a post
that
indicated
that the
values
usually
come back
in order,
but don't
have to, so
don't count
on it.
Also, this is
a question
better suited
to the group
listed in the
followup field.
------------------------------
Date: Mon, 01 May 2000 18:13:01 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Passing DBI Connection between Processes?
Message-Id: <390E2B9D.5A8EC8BF@My-Deja.com>
> How would I do it?
(a)have a mod_perl enabled web server and use Apache::DBI
(b) or FastCGI
------------------------------
Date: Mon, 01 May 2000 18:26:53 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Problem with $ sign in string
Message-Id: <390E2EDD.784FFB27@stomp.stomp.tokyo>
otrcomm@wildapache.net wrote:
> "UPS Ground - $20.62" (minus the quotation marks)
> and I want to pick the number 20.62 out of it
> The $ sign is getting in the way of everything that I try.
* smiles *
You are declaring '$20' as a variable,
silly boy! Oh, this does bring back
memories of so long ago...
Listen, lets talk data base. Forget all
this techno-geekster gibberish fancy
dancy coding to deal with a dollar sign.
Get rid of that puppy!
Why the heck do you need a $ in your data
base anyhow! Fire up your program editor
and delete that little monster everywhere.
While you are at it, get rid of:
UPS Ground -
..as well. Clutter, clutter, clutter.
Typical boy! Boys and their toys. Gurls
and thier curls!
Remove the $ and UPS Ground - from your
data base. Neither are needed and only
present a problem along with a lot of
unwarranted extra coding for nothing,
not to mention a messy over-filled
toy chest data base.
Pull your amount, 20.62 nice and plain.
>From your data base, $charge = "20.62";
$shipping_sting = join ("", "UPS Ground - ", "\$", $charge);
UPS Ground - $20.62
All done! One old fashion line, no geeksterese!
You are happy as a dead pig lying in sunshine!
Yeah, a backslash is needed.
Might even think about taking out that
decimal point while you are at it. No
real need for that in your data base
either, don't ya think? Clean up your
data base, forget all those Band Aid
codes to fix what shouldn't be a
problem initially.
Have fun and remember, everyone was
a beginner once and, some pros are
still beginners!
Godzilla!
------------------------------
Date: Mon, 1 May 2000 18:42:16 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Problem with $ sign in string
Message-Id: <8elbou$lmk$1@brokaw.wa.com>
Godzilla! <godzilla@stomp.stomp.tokyo> wrote in message
news:390E2EDD.784FFB27@stomp.stomp.tokyo...
> otrcomm@wildapache.net wrote:
>
> > "UPS Ground - $20.62" (minus the quotation marks)
>
> > and I want to pick the number 20.62 out of it
>
> > The $ sign is getting in the way of everything that I try.
>
>
> * smiles *
>
> Listen, lets talk data base. Forget all
> this techno-geekster gibberish fancy
> dancy coding to deal with a dollar sign.
> Get rid of that puppy!
I didn't see any mention of a database in his original post...
> While you are at it, get rid of:
>
> UPS Ground -
If the OP knew how to remove the digits, he'd likely know how to remove the
leading text.
> Remove the $ and UPS Ground - from your
> data base. Neither are needed and only
> present a problem along with a lot of
> unwarranted extra coding for nothing,
> not to mention a messy over-filled
> toy chest data base.
You are again assuming a database.
> >From your data base, $charge = "20.62";
>
> $shipping_sting = join ("", "UPS Ground - ", "\$", $charge);
>
> UPS Ground - $20.62
>
> All done! One old fashion line, no geeksterese!
> You are happy as a dead pig lying in sunshine!
That 'join' seems like overkill.
$shipping_string = "UPS Ground - \$$charge";
Of course, the problem was getting the value of $charge *out* of the string,
not putting it back in.
$string = "UPS Ground - $20.62";
$charge = $1 if ($string =~ /$(\d+\.\d\d)/ ); # Find a dollar sign followed
by one or more digits and a period and two digits
Lauren
------------------------------
Date: Mon, 1 May 2000 18:58:34 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Problem with $ sign in string
Message-Id: <8elcne$mag$1@brokaw.wa.com>
Lauren Smith <lauren_smith13@hotmail.com> wrote in message
news:8elbou$lmk$1@brokaw.wa.com...
>
> $string = "UPS Ground - $20.62";
heh heh... <insert foot>
That should be a single quoted string.
$string = 'UPS Ground - $20.62';
But it makes me wonder why you would be double-quoting it in the first
place.
Lauren
------------------------------
Date: Mon, 01 May 2000 23:21:51 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Problem with $ sign in string
Message-Id: <390E49CF.3433ECD5@attglobal.net>
>
> That 'join' seems like overkill.
Not to swipe a thread, but this leads to a discussion I was
having via email with a more experienced Perl programmer.
Specifically....
does join() use more overhead than the . operator?
Anyone know?
------------------------------
Date: Tue, 02 May 2000 02:23:13 GMT
From: er@matrix.com.br (Lobo)
Subject: Problems with creating a unique key for a script to search. Please help me here.
Message-Id: <390e38c7.3769463@news.matrix.com.br>
Hi there
I'm writing a DB application in Perl, and it's almos ready, but there
is a problem that's making me mad:
I can't create a really UNIQUE key for perl to search for. If a
field contains the number "1", the script will bring all results who
matches this number (1, 11, 21,31, 41, and so on). So, since the data
file - a Pipe Delimited Values TXT - doesn't have a hundred rows yet,
I've made a temporary solution: I've inserted a zero on lines 1 to 9,
so it looks like this:
01|foo
02|foo
.
.
.
.
10|foo
But when the 100ª row appears and I search for the row 10, for an
example, it will bring me 10 AND 100!
I've tried the good old "$key=time();", but it doesn1t worked fine...
Any suggestions?
------------------------------
Date: Tue, 2 May 2000 09:58:18 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: program that prints itself
Message-Id: <8elcpl$s69@netnews.hinet.net>
Philip 'Yes, that's my address' Newton wrote
> My favorite prints itself to STDERR, not STDOUT:
> Create a file called /tmp/quine.pl, containing the following line:
>
> Illegal division by zero at /tmp/quine.pl line 1.
>
> When run, it will produce itself as output.
What astonished me was that
"This is a legal Perl program!!!".
(I noticed that the message is a run-time error.)
perl -c /tmp/quine.pl
/tmp/quine.pl syntax OK
How come? Are those bare words treated as subs (that need
to be autoloaded)? Then the error message should be:
Unquoted string "Illegal" may clash with future reserved word
And those slashes and dots... Are they legal "division",
"string concate" and "decimal point" respectively?
Which function produced the "zero"? tmp? or quine?
Oh, it is quite hard to figure out...
Thank you.
John Lin
------------------------------
Date: Tue, 2 May 2000 10:33:43 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: program that prints itself
Message-Id: <8elerv$1a8@netnews.hinet.net>
Philip 'Yes, that's my address' Newton wrote
> My favorite prints itself to STDERR, not STDOUT:
> Create a file called /tmp/quine.pl, containing the following line:
>
> Illegal division by zero at /tmp/quine.pl line 1.
>
> When run, it will produce itself as output.
What astonished me was that
"This is a legal Perl program!!!".
(I noticed that the message is a run-time error.)
perl -c /tmp/quine.pl
/tmp/quine.pl syntax OK
How come? Are those bare words treated as subs (that need
to be autoloaded)? Then the error message should be:
Unquoted string "Illegal" may clash with future reserved word
And those slashes and dots... Are they legal "division",
"string concate" and "decimal point" respectively?
Which function produced the "zero"? tmp? or quine?
Oh, it is quite hard to figure out...
Thank you.
John Lin
------------------------------
Date: Tue, 02 May 2000 02:30:25 GMT
From: Bob Cunningham <sparky@alt-usage-english.org>
Subject: Puzzled - Please help.
Message-Id: <NTwOOe3CxCFb3=91nZ35=oIHQ6jP@4ax.com>
I've recently installed Perl 5.6 -- I think.
When I run a one-line program consisting of
print $] ;
it tells me '5.006'.
When I type 'perl -v' at the command line, it says I'm running version
5.6, Build 613.
I would be most grateful if someone would tell me if I'm doing
something wrong. Am I using version 5.6 or 5.006?
I think I was using version 5.005 before I installed 5.6. Is '5.006'
another way of saying '5.6'?
------------------------------
Date: Tue, 02 May 2000 11:56:06 +1000
From: Peter Hill <phill@modulus.com.au>
Subject: Re: Puzzled - Please help.
Message-Id: <390E35B6.7233@modulus.com.au>
Bob Cunningham wrote:
>
> I've recently installed Perl 5.6 -- I think.
>
> When I run a one-line program consisting of
>
> print $] ;
>
> it tells me '5.006'.
>
> When I type 'perl -v' at the command line, it says I'm running version
> 5.6, Build 613.
>
> I would be most grateful if someone would tell me if I'm doing
> something wrong. Am I using version 5.6 or 5.006?
5.6. The best definition of the 5.006 which $] returns is that it is the
value which $] returns for perl version 5.6.
--
Peter Hill,
Modulus Pty. Ltd.,
http://www.modulus.com.au/
------------------------------
Date: Mon, 1 May 2000 22:13:43 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Puzzled - Please help.
Message-Id: <slrn8gseen.3ar.tadmc@magna.metronet.com>
On Tue, 02 May 2000 02:30:25 GMT, Bob Cunningham <sparky@alt-usage-english.org> wrote:
>I've recently installed Perl 5.6 -- I think.
Hope the docs got installed too :-)
>When I run a one-line program consisting of
>
> print $] ;
>
>it tells me '5.006'.
>
>When I type 'perl -v' at the command line, it says I'm running version
>5.6, Build 613.
>
>I would be most grateful if someone would tell me if I'm doing
>something wrong. Am I using version 5.6 or 5.006?
cd /somewhere/pod/ # look for "pod/" subdir under @INC dirs
grep '5\.006' *.pod
finds one line, which leads to:
perldelta.pod (note the very end):
--------------------------
=head2 Improved Perl version numbering system
Beginning with Perl version 5.6.0, the version number convention has been
changed to a "dotted integer" scheme that is more commonly found in open
source projects.
Maintenance versions of v5.6.0 will be released as v5.6.1, v5.6.2 etc.
The next development series following v5.6.0 will be numbered v5.7.x,
beginning with v5.7.0, and the next major production release following
v5.6.0 will be v5.8.0.
The English module now sets $PERL_VERSION to $^V (a string value) rather
than C<$]> (a numeric value). (This is a potential incompatibility.
Send us a report via perlbug if you are affected by this.)
The v1.2.3 syntax is also now legal in Perl.
See L<Support for strings represented as a vector of ordinals> for more on that.
To cope with the new versioning system's use of at least three significant
digits for each version component, the method used for incrementing the
subversion number has also changed slightly. We assume that versions older
than v5.6.0 have been incrementing the subversion component in multiples of
10. Versions after v5.6.0 will increment them by 1. Thus, using the new
notation, 5.005_03 is the "same" as v5.5.30, and the first maintenance
version following v5.6.0 will be v5.6.1 (which should be read as being
equivalent to a floating point value of 5.006_001 in the older format,
stored in C<$]>).
--------------------------
>I think I was using version 5.005 before I installed 5.6. Is '5.006'
>another way of saying '5.6'?
If the docs say so, I believe them :-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 1 May 2000 21:30:56 -0500
From: "sjohn" <sjohn92694@kcweb.net>
Subject: Re: resizing an image
Message-Id: <45rP4.10009$Ie5.1838247@news-west.usenetserver.com>
<p align="center"><img border="0" src="your image" width="563" height="86">
</p>
Now what I do, to resize the images, I just change the width="400"
height="50"
and the image will resize on your site.
This works for me, This is not perl, just standard html
<-----snip---->
> I am looking for a script, module or subroutine that can resize images.
> What i want is something like this :
>
> $newimage= &resize($image,newwith,newheight);
>
>
> Thanks
>
>
>
------------------------------
Date: Mon, 1 May 2000 20:33:53 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: resizing an image
Message-Id: <Pine.GSO.4.10.10005012032120.13677-100000@user2.teleport.com>
On Tue, 2 May 2000, qwerty wrote:
> I am looking for a script, module or subroutine that can resize images.
Have you looked on CPAN yet?
http://search.cpan.org/
If you follow the link for "Graphics", you might see some useful modules.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 1 May 2000 20:38:20 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: resizing an image
Message-Id: <Pine.GSO.4.10.10005012034160.13677-100000@user2.teleport.com>
On Mon, 1 May 2000, sjohn wrote:
> <p align="center"><img border="0" src="your image" width="563" height="86">
> </p>
>
> Now what I do, to resize the images, I just change the width="400"
> height="50"
> and the image will resize on your site.
> This works for me, This is not perl, just standard html
Why do you think that the original poster wanted something web-related?
Maybe so, but let's not jump to conclusions. But even if it's for the web,
this is not the correct way to resize images in general. When this method
is used to make thumbnails of images, the result is dumbnails, which take
just as long to download as the original image would, putting just as much
load on the server and network. Oh, well!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 01 May 2000 18:01:34 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: toggling read-only flag for files in win32
Message-Id: <390E28EE.C0B97C00@jpl.nasa.gov>
Ollie Rutherfurd wrote:
> I've written a little script to replicate a directory tree, but the
> File:Copy function 'copy' fails when the destination files already exist and
> are read-only. I've got permission to change this flag, but can this be
> done programatically using perl (so I can incorporate it into the script)?
>
> BTW, I'm using 5.6 on NT 4.0.
The ActiveState FAQS (http://www.activestate.com/ActivePerl/docs)
discuss this question. chmod does the best it can under DOS's limited
file attribute scheme.
Jon
--
Knowledge is that which remains when what is
learned is forgotten. - Mr. King
------------------------------
Date: Tue, 02 May 2000 02:48:15 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Where is it found?
Message-Id: <PlrP4.55825$h01.397697@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <8ehurm$6ld$1@newsflash.concordia.ca>,
nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar) writes:
> Some other options:
(some of them wrong)
># pos gives the position of a m//g match. like index.
> print pos($string), "\n";
Sorry, it does not. From the manual page:
=item pos
Returns the offset of where the last m//g search left off for the variable
is in question ($_ is used when the variable is not specified). May be
modified to change that offset. Such modification will also influence
the \G zero-width assertion in regular expressions. See perlre and
perlop.
For example:
$foo="I am the very model of a modern major-general";
$foo=~m/model/g;
print substr($foo, pos($foo));
Prints " of a modern major-general" as the manual indicates. Be careful
before guessing what perl does. Close enough can be frustrating to
debug.
--
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: Mon, 01 May 2000 23:22:40 -0400
From: Jennifer <webmaster@momsathome.on.ca>
Subject: Re: Which template module? CGI::FastTemplate?
Message-Id: <390E4A00.293B48C9@momsathome.on.ca>
occitan@esperanto.org wrote:
>
> Saluton retanoj!
>
> In article <390A6EC4.77970071@momsathome.on.ca>,
> I'm starting to think about creating a dedicated template style, which
> would give you such options. I.e. <%VARIABLE%> might come from
> $VARIABLE, $foo{VARIABLE} or even in CGI context param( 'VARIABLE' ).
I think I am going to have to create something for myself for
now, but if you are going to create something for more generic
use, here is another option that maybe you should think about.
If the variable is undef then I want <%VARIABLE%> to remain.
Both for having multiple passes at the template and to easily see
which ones didn't get replaced. CGI::FastTemplate does give that
option if you set the strict varibale in the module, but when you
do that it writes warnings to the logs and they fill up pretty
quickly.
I think I am going to adapt CGI::FastTemplate for my own needs.
It works very much like I want except for the delimiters and the
printing of warnings.
Jennifer
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 2919
**************************************