[10798] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4399 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 10 16:07:17 1998

Date: Thu, 10 Dec 98 13:00:24 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 10 Dec 1998     Volume: 8 Number: 4399

Today's topics:
        Adding commas to Currency Numbers? (Mitch Rosefelt)
        Adding commas to Currency Numbers? (Mitch Rosefelt)
    Re: Ambiguous use of values (Bill Moseley)
    Re: Ambiguous use of values (Bart Lateur)
    Re: anything more robust than GIFgraph? (Ari Jolma)
    Re: array initialisation (Bart Lateur)
        Assigning to dummy variables in split command thst@my-dejanews.com
    Re: Assigning to dummy variables in split command (Craig Berry)
    Re: Assigning to dummy variables in split command (Larry Rosler)
    Re: Decent Editor scott@softbase.com
    Re: encoding URL (umsee)
        FCNTL: Delaying a file read johnvv@hotmail.com
    Re: file locking question (Bill Moseley)
    Re: file locking question (Craig Berry)
    Re: file locking question (Bart Lateur)
        Help wanted: saving remote URL to local file <simsi@hotmail.com.nospam>
        How I redirect standard error from a remote host to a l <rkong@ml.com>
        Info source for Perl for Win32 <pdchapin@unix.amherst.edu>
        interpolation constipation <antony@fabric8_no_spam.com>
        Is there a better database retrieval method?? <tturton@cowboys.anet-dfw.com>
    Re: IS there a difference really? $var and ${var}? Exam <aqumsieh@matrox.com>
    Re: Joined and split arrays dave@mag-sol.com
    Re: Left and right halves of s/// parsed differently? eodjm01@my-dejanews.com
    Re: mail attachment (Sam Curren)
        MIME-tools-4.121: Makefile.PL = coredump                <pdr@humeur.com>
    Re: namespace question (Mark-Jason Dominus)
    Re: Newbie Question dave@mag-sol.com
    Re: Out of memory!?? (Andrew Allen)
    Re: Perl and Y2K (M.J.T. Guy)
        Perl unexec on Solaris dgbialac@wwitch.unl.edu
        Perl unexec (Dave Bialac)
    Re: Perl, ORacle & Linux (John D Groenveld)
    Re: Regular Expressions <aqumsieh@matrox.com>
    Re: Regular Expressions (Larry Rosler)
    Re: take out periods jimbob4334@my-dejanews.com
    Re: Trouble getting started with DBM (Jeffrey R. Drumm)
    Re: Trouble getting started with DBM (Bart Lateur)
    Re: Trouble getting started with DBM (Bart Lateur)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Thu, 10 Dec 1998 12:50:09 -0600
From: mitch@thepixelfarm.com (Mitch Rosefelt)
Subject: Adding commas to Currency Numbers?
Message-Id: <MPG.10d9d3d7a0dfc946989690@news.midplains.net>

Could someone share with me an efficient technique for adding commas to 
currency numbers I.E.  #######.## --> #,###,###.##

Thanks much.

Mitch Rosefelt


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

Date: Thu, 10 Dec 1998 12:50:22 -0600
From: mitch@thepixelfarm.com (Mitch Rosefelt)
Subject: Adding commas to Currency Numbers?
Message-Id: <MPG.10d9d3ec91b78813989691@news.midplains.net>

Could someone share with me an efficient technique for adding commas to 
currency numbers I.E.  #######.## --> #,###,###.##

Thanks much.

Mitch Rosefelt


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

Date: 10 Dec 1998 18:40:47 GMT
From: moseley@best.com (Bill Moseley)
Subject: Re: Ambiguous use of values
Message-Id: <367015af$0$229@nntp1.ba.best.com>

In article <366F4768.48A9F652@home.com>, rick.delaney@home.com says...
>> :     print $query->hidden(-name=>$name,"values"=>$_[0]);
>> 
>> You probably want "-values" or '-values' instead, to keep the hyphen.
>
>Most of the time, yes, but in this case where CGI.pm is obviously being
>used it is unnecessary since it will just be stripped off anyway.

But I'll get the errors if I don't quote.

No sleep and too much coffee made me overlook the obvious that "values"
happens to be a rather commonly used function!  I assume that's what's
happening.

I odd:

I also get that error message about "title" on the method call in my script:

    print $query->start_html(-title=>'title here',
                            -author=>'the author's name',
                            -BGCOLOR=>'#FFFFFF', 
                            -LINK=>'#6633CC',
                            -VLINK=>'#006633');

But I just cut-n-pasted that into a little script and it didn't report the
error.  Oh, unless "title" is in something else I've imported (like Net:SMTP)

Finally:

Perl complains about:

    $CGI::POST_MAX=1024 * 20;   # max 20K posts to prevent flooding or denial of service attacks
    $CGI::DISABLE_UPLOADS = 1;  # no uploads

Name "CGI::DISABLE_UPLOADS" used only once: possible typo at..
Name "CGI::POST_MAX" used only once: possible typo at...

How do I make those errors go away.  Set them twice?
And again, those errors don't show up on my Active State version.


Here's to a clean web error log file!


--------------
Bill Moseley
moseley@best.com



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

Date: Thu, 10 Dec 1998 20:09:01 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Ambiguous use of values
Message-Id: <367229d1.1054175@news.skynet.be>

Bill Moseley wrote:

>But I'll get the errors if I don't quote.
>
>No sleep and too much coffee made me overlook the obvious that "values"
>happens to be a rather commonly used function!  I assume that's what's
>happening.

Somebody please confirm this:

In newer versions of Perl, both "=>" and the unary minus sign are
supposed to quote the word (left of "=>" or following  "-"). So, this
behaviour, and I'm sure you're right about it, should never happen in
future Perl ports.

	Bart.


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

Date: 10 Dec 1998 20:52:48 +0200
From: ajolma@ahti.hut.fi (Ari Jolma)
Subject: Re: anything more robust than GIFgraph?
Message-Id: <74p5a0$fsd$1@ahti.hut.fi>

In article <73pq68$t2$1@news.fas.harvard.edu>,
Michael S Vernal  <vernal@fas.harvard.edu> wrote:
>Hi...  I'm need some kind of package that'll spew out nice looking
>graphs.  It's not for my own personal use--my company wants prettyness,

>Alternatively, do you know of any other program I might be able to use
>to spew out simple but pretty bar graphs?  I want something resembling
>an Excel graph

try jsplot http://gd.tuwien.ac.at/graphics/visual/jsplot/

Ari


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

Date: Thu, 10 Dec 1998 20:11:14 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: array initialisation
Message-Id: <36732aa5.1266350@news.skynet.be>

Larry Rosler wrote:

>As I seem to be taking on the benchmarking burden these days...

Just curious... Do you create the test scripts by hand, or do you have a
(Perl) tool that converts plain code to a benchmark?

	Bart.


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

Date: Thu, 10 Dec 1998 18:33:41 GMT
From: thst@my-dejanews.com
Subject: Assigning to dummy variables in split command
Message-Id: <74p466$pa9$1@nnrp1.dejanews.com>

Is there a way of assigning some chunks of a split result to dummy variables ?
In other words is there something like:

($karl, $paul, ., $suzi, ., ., $other) = split(/ +/,$linein);

where "." is a don't bother variable.

Bye

Thomas

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 10 Dec 1998 19:02:02 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Assigning to dummy variables in split command
Message-Id: <74p5ra$8td$1@marina.cinenet.net>

thst@my-dejanews.com wrote:
: Is there a way of assigning some chunks of a split result to dummy variables ?
: In other words is there something like:
: 
: ($karl, $paul, ., $suzi, ., ., $other) = split(/ +/,$linein);
: 
: where "." is a don't bother variable.

Put 'undef' in the list where you have don't-care variables:

  ($karl, $paul, undef, $suzi, undef, undef, $other) = split / +/, $linein;

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "The hills were burning, and the wind was raging; and the
       clock struck midnight in the Garden of Allah."


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

Date: Thu, 10 Dec 1998 11:08:33 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Assigning to dummy variables in split command
Message-Id: <MPG.10d9bc10a3c1e2419898bb@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <74p466$pa9$1@nnrp1.dejanews.com> on Thu, 10 Dec 1998 
18:33:41 GMT, thst@my-dejanews.com <thst@my-dejanews.com> says...
> Is there a way of assigning some chunks of a split result to dummy variables ?
> In other words is there something like:
> 
> ($karl, $paul, ., $suzi, ., ., $other) = split(/ +/,$linein);
> 
> where "." is a don't bother variable.

There are two ways, equally appropriate.  Using your example:

  ($karl, $paul, undef, $suzi, undef, undef, $other) =
     split(/ +/,$linein);

  ($karl, $paul, $suzi, $other) = (split(/ +/,$linein))[0, 1, 3, 6];

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 10 Dec 1998 18:42:30 GMT
From: scott@softbase.com
Subject: Re: Decent Editor
Message-Id: <36701616.0@news.new-era.net>

Antony McNulty (tony_mc@hotmail.com) wrote:

> I'm on a Windows platform, have access to a UNIX platfom, but prefer to use
> Windows.

> I noticed many editors mentioned were UNIX, any ideas for the PC then ??

Which editors were mentioned that aren't available for Windows?
Emacs is, and it emulates vi very nicely.

If you want a Windows editor that's native to Windows and
has good CUA support and acts like a Windows application,
I can't say enough good things about Multi-Edit 
(www.multiedit.com). It has better than decent Perl support.

Scott


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

Date: Thu, 10 Dec 1998 17:03:55 GMT
From: NOSPAM_umsee@microasia.com (umsee)
Subject: Re: encoding URL
Message-Id: <74ousv$n13$1@canopus.cc.umanitoba.ca>

In article <83r9u8w1yv.fsf@vcpc.univie.ac.at>, Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at> wrote:
>Re: encoding URL, umsee <NOSPAM_umsee@microasia.com>
>said:
>
>umsee> I would like to encode a string so that I can
>umsee> pass the string to perl using GET method.
>
>perldoc URI::Escape
>
>and
>
>perldoc LWP
>
>for writing WWW user-agents in perl
>
>hth
>tony

Thanks!!


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

Date: Thu, 10 Dec 1998 17:42:42 GMT
From: johnvv@hotmail.com
Subject: FCNTL: Delaying a file read
Message-Id: <74p16h$mfg$1@nnrp1.dejanews.com>




Hello All,

I am a perl progammer who is uniquely ignorant of the C language and I thought
you might be able to help me.

I have a complex structure dataserver storing data with Storable.pm which runs
multiple processes.  To keep the update functions from clashing with the read
functions, I need to be able to delay the reads until the writes are finished,
and vice versa.

I would be most grateful for any snippits of code to demonstrate how to do
this.

Thanks in advance.

John van Vlaanderen aka Pres CXN, Inc ( my little company )

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 10 Dec 1998 18:53:52 GMT
From: moseley@best.com (Bill Moseley)
Subject: Re: file locking question
Message-Id: <367018c0$0$229@nntp1.ba.best.com>

In article <74oi4d$e2u$2@canopus.cc.umanitoba.ca>, NOSPAM_umsee@microasia.com says...
>Just wanted to add that, normally we use a share lock when we are reading a 
>file and an exclusive lock when we are wrting to a file.

Why is that?  If my programs that WRITE to a file lock it properly, is there
really a need to share lock on programs that just read the file?  And if so,
what does the share lock actually do for me?

And in my programs that write to a number of files, is it enough to only lock
the first file open (as long as all the programs open/lock in the same order)?

Thanks,

--------------
Bill Moseley
moseley@best.com



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

Date: 10 Dec 1998 19:17:51 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: file locking question
Message-Id: <74p6ov$8td$2@marina.cinenet.net>

Bill Moseley (moseley@best.com) wrote:
: In article <74oi4d$e2u$2@canopus.cc.umanitoba.ca>, NOSPAM_umsee@microasia.com says...
: >Just wanted to add that, normally we use a share lock when we are reading a 
: >file and an exclusive lock when we are wrting to a file.
: 
: Why is that?  If my programs that WRITE to a file lock it properly, is there
: really a need to share lock on programs that just read the file?  And if so,
: what does the share lock actually do for me?

Because locking is (on most OSs) voluntary.  In the absence of explicit
locking, anyone may get access to the file, no matter what anyone else
happens to be doing to it.  If you don't want your readers to see weird
partially-written versions of the file, they need to go for a shared lock;
that way, they'll only get it when no writer is at work on the file. 

: And in my programs that write to a number of files, is it enough to only lock
: the first file open (as long as all the programs open/lock in the same order)?

Yes, so long as you can guarantee this behavior.  It's also common to use
a separate file as a sort of "lock sempahore," one with no contents and a
name like 'lockfile', which programs lock to acquire access to a whole set
of related files.  Again, though, this requires *all* programs accessing
the file set to play by the same rules.

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "The hills were burning, and the wind was raging; and the
       clock struck midnight in the Garden of Allah."


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

Date: Thu, 10 Dec 1998 20:05:59 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: file locking question
Message-Id: <36712862.687825@news.skynet.be>

Bill Moseley wrote:

>Why is that?  If my programs that WRITE to a file lock it properly, is there
>really a need to share lock on programs that just read the file?  And if so,
>what does the share lock actually do for me?

Danger, Will Robinson. (I'm not sure where I got that quote. A newsgroup
post, I'm sure.)

If not ALL programs that access a particular file actually lock it, you
might just as well forget about the whole locking thing. It won't work.

Reason: you are able to read from a file while at the same time another
program, that "locked" the file, is writing to it. Since you ignore the
lock, you're bashing in while it is trying to have some privacy.

File locking on Unix (and similar systems) only works if ALL players
abide to the rules.

	Bart.


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

Date: Thu, 10 Dec 1998 19:22:11 GMT
From: "Simmo" <simsi@hotmail.com.nospam>
Subject: Help wanted: saving remote URL to local file
Message-Id: <01be2472$54648ca0$b2c548c2@is>

Hi....a virtual beer for anyone that can give me a simple answer to this
one :)

I want to retrieve the contents of a text file i have created on a remote
server and display it on the local server within a web page (but not AS the
web page) using Perl. Is it possible to:

use "Location: http://blah" to print to a file rather than the screen

or

call the unix 'cat' command to bang it in a file....if so what is the
syntax 'cos i'm more than a little crap with Unix.


Thanks in advance....hope i've been clear :)

Simmo


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

Date: Thu, 10 Dec 1998 14:56:22 -0500
From: Richard Kong <rkong@ml.com>
Subject: How I redirect standard error from a remote host to a local file? *SIMPLE*
Message-Id: <36702765.1F12E0D4@ml.com>

Hi,

I have thess lines in my script:

$logfile "/tmp/stuff";
system ("rsh $remotehost \'vmstat 3 5 > $logfile 2>&1 \'");

Ok, if I run this then the standard error and output get put into that
file
$logfile, BUT on the remote host. How do I get it on the local?

Thanks,
Rich



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

Date: Thu, 10 Dec 1998 13:52:01 -0500
From: "Paul Chapin" <pdchapin@unix.amherst.edu>
Subject: Info source for Perl for Win32
Message-Id: <36701854.0@amhnt2.amherst.edu>

According the the documentation that came with my copy of Perl for Win32,
the FAQ is at www.perl.hip.com and the mailing list is at mail.hip.com.
However, I'm not showing either of these to be valid addresses.  Has this
material moved?  Does it mean that my copy of Perl is out of date?

-----
Paul Chapin
UNIX Manager
Amherst College
413 542-2144
http://www.amherst.edu/~pdchapin




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

Date: Thu, 10 Dec 1998 12:58:18 -0800
From: antony quintal <antony@fabric8_no_spam.com>
Subject: interpolation constipation
Message-Id: <367035EA.4BFF941D@fabric8_no_spam.com>

hi wizards. i consulted the faqs, the cookbook, and the camel...but i
still can't stop myself from posting this silly question:::

here's a snippet from a DBI database call:

$sql =  qq{
	UPDATE Sessions 
	SET Field = '$object->field' 
	WHERE SessionID = '$session_id'};

as you probably know, "$object->field" gets interpolated as
'Package=HASH(0x82c3228)->field'

if i use "$object->{FIELD}" it interpolates correctly (i have AUTOLOAD
accessor methods)
and if i do something like

my $field = $object->field;

before i create the interpolated string, it works too.

but i was wondering how to construct my sql string directly from my
object's method...


thank you for your time,

antony


-- 
   8888
 888  888   
888    888  :::::::::::::::::::::::
 888  888   http://www.fabric8.com
   8888     san francisco
 888  888   415.487.9702
888    888  :::::::::::::::::::::::
 888  888   
   8888


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

Date: Thu, 10 Dec 1998 14:36:48 -0600
From: Tom Turton <tturton@cowboys.anet-dfw.com>
Subject: Is there a better database retrieval method??
Message-Id: <367030E0.389C0940@cowboys.anet-dfw.com>

I am experimenting with using databases in Perl.  I've tried reading
what I can find in my reference books (Programming Perl, Advanced Perl
Programming, Perl Cookbook), but I get the feeling I'm coming in on the
middle of something.

I've started with the MLDBM example in chapter 10 of APP.  Of course,
the example just shows you how to stick things INTO the db; I've played
around in order to learn how to RETRIEVE things in the db and have
managed to get what I want back out  from the code below.

Is there a more elegant way to input and retrieve database data?

If somehow I've overlooked a clear writeup of Perl database usage (from
a beginner's view), please indicate where I can find such a write up.
Thanks much.

---Tom Turton
=================

#!/usr/local/gnu/bin/perl -w
use diagnostics;

unshift (@INC, "/usr/local/gnu/perl5.004_02/lib");
use Fcntl;
use SDBM_File;
use MLDBM qw (SDBM_File);

tie (%h, 'MLDBM', 'bar', O_RDWR|O_CREAT, 0666) || die $!;

$sample = {'burnt'    => 'umber',
           'brownian' => 'motion'};   # sample

$h{pairs}    = $sample;
$next_sample = {'WX' => {'precip' => 'rainy',
                         'Temp'   => '69',
                         'Wind'   => '33015'
                        },
                'Landings' => '2200'};
$h{'19981208'} = $next_sample;

%sample_out = %{$h{pairs}};
while ( ($key_i, $value_i) = each(%sample_out) ) {
    print "\$key_i = $key_i; \$value_i = $value_i\n";
}

%sample2_out = %{$h{19981208}->{WX}};
while ( ($key_j, $value_j) = each(%sample2_out) ) {
    print "\$key_j = $key_j; \$value_j = $value_j\n";
}

%sample3_out = %{$h{19981208}};
print "value for Landings = $sample3_out{Landings}\n";

untie %h;

===============================================
output:

$key_i = brownian; $value_i = motion
$key_i = burnt; $value_i = umber
$key_j = Wind; $value_j = 33015
$key_j = precip; $value_j = rainy
$key_j = Temp; $value_j = 69
value for Landings = 2200








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

Date: Thu, 10 Dec 1998 10:08:35 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: IS there a difference really? $var and ${var}? Example.
Message-Id: <x3yaf0w11kx.fsf@tigre.matrox.com>


Ryan <rich_guy@hotmail.com> writes:

<snip an example>

> So, is there any other reason to use the ${var}, except when you can't
> break up a string without bothering to do a concatenation? (not that i

<snip some examples>

>  Should I bother with the brace identifier in all areas of my script
> such as this?? Or is it only to be really used rarely?

<snip some more examples>

> It is always a good idea to use it? Or is it really a waste of time?
> (other then when characters immediately follow it (well, aplha-numeric
> one's anyway!)

<snip yet another example>

> curiosity. Is it really even worth bothering about?

This issue is really bothering you isn't it?? ;-)

You only need to use ${var} instead of $var when there is a chance
that Perl would get confused. Usually Perl is very good at guessing
your intentions. Variables names can only contain characters, digits
and underscores (\w). So if a variable is followed by a character of
one of the above classes, then you'll need those braces, else you can
drop 'em.

HTH,
Ala



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

Date: Thu, 10 Dec 1998 17:47:17 GMT
From: dave@mag-sol.com
Subject: Re: Joined and split arrays
Message-Id: <74p1f5$ml6$1@nnrp1.dejanews.com>

In article <366FE7C1.8FBFF8C1@Axom.com>,
  Brad McBride <Brad.McBride@Axom.com> wrote:
> Hello all,
>
>    I've just run into a problem that I'm not too sure how to fix.
> According to my documentation, this should work. I have an array called
> @openticketlist which is full of information (any number of rows) from
> an oracle database. I have joined all of the information from the
> database in this array using ':' as the delimiter. I then am trying to
> get each individule piece of information out of that array by putting it
> into another array called @opentickets. Here is how I am doing it:
>
> @opentickets = split(/:/, @openticketlist);
>
> When I print out the contents of @openticketlist, I see all of my
> information, nicely seperated by :s. When I print out my split array,
> instead of seeing the same information formated differently, I get the
> number 6. That's it, just the number 6. Is there something I am screwing
> up with the split function or am I going about this all the wrong way?

split takes a regular expression followed by a scalar. You're passing it an
array as the second parameter. Evaluating an array in a scalar context gives
the number of elements in the array (I'm guessing that's six).

When you use join you give it an array and it returns a scalar. split reverses
that operation.

I think you're probably misunderstanding something.

Dave...

--
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 10 Dec 1998 20:06:47 GMT
From: eodjm01@my-dejanews.com
Subject: Re: Left and right halves of s/// parsed differently?
Message-Id: <74p9kl$u8u$1@nnrp1.dejanews.com>

In article <comdog-ya02408000R0912981507300001@news.panix.com>,
  comdog@computerdog.com (brian d foy) wrote:
> > If I do that, it prints:
> >
> >   clowns\have\large\\eyes\here
>
> it does that because that is what \Q is supposed to do.  compare:
>
>    $\ = "\n";
>    print "this is a \\slash";
>    print "\Qthis is a \\slash";
>    print quotemeta("this is a \\slash");
>
> see the docs on these for more details.

But I'm still not sure why \Q and quotemeta have been designed to work in this
way.  For example:

#!/usr/local/bin/perl -w

$\ = "\n";
$string = "\t";

print "this is a tab\taaaa";
print "\Qthis is a tab\taaaa";
print quotemeta("this is a tab\taaaa");
print "this is a tab\\taaaa";
print "this is a tab${string}aaaa";
print "\Qthis is a tab${string}aaaa";
print quotemeta("this is a tab${string}aaaa");
print "this is a tab".quotemeta($string)."aaaa";


I get the following output:

this is a tab   aaaa
this\ is\ a\ tab\   aaaa
this\ is\ a\ tab\   aaaa
this is a tab\taaaa
this is a tab   aaaa
this\ is\ a\ tab\   aaaa
this\ is\ a\ tab\   aaaa
this is a tab\  aaaa

So neither \Q nor quotemeta lets me see the two characters \t in the output.
They do seem to be behaving as described in the book: "This function returns
the value of EXPR ... with all regular-expression metacharacters backslashed"
in that they are putting backslashes in front of the tab metacharacters, but
I thought the point of backslashing something was that its behaviour would
then change - ie. it would no longer appear as some whitespace, but as \t -
which does seem to be the way it works on the left hand side of s///.

Just wondering
David.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 10 Dec 1998 12:03:17 -0800
From: samc@empirewest.com (Sam Curren)
Subject: Re: mail attachment
Message-Id: <MPG.10d9c8dc3ac5a24a9896b3@news.sonic.net>

I'm working on similar projects. Check out MIME::Base64 for extended 
features, or the easier MIME::Lite for most common operations.

Both Work Great.

-Sam

In article <366FFEFD.AE7@lndn.tensor.pgs.com>, 
michaelr@lndn.tensor.pgs.com says...
> does anyone know how to send a file as an attachment in perl.
> i normally just open a pipe to the filehandle and print
> all the lines to the file (im sure most of us do that) but
> now i want something different, any ideas ???
> 
> thanx
> 
> Mike
> 


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

Date: Thu, 10 Dec 1998 13:30:38 -0500
From: Paul de Repentigny <pdr@humeur.com>
Subject: MIME-tools-4.121: Makefile.PL = coredump                   (HPUX 10.10)
Message-Id: <3670134B.54739E17@humeur.com>

Hi,

When I try to compile MIME-tools-4.121, under HPUX 10.10, all I get is a
2373084 bytes coredump. I have perl version 5.004_04 built for PA-RISC1.1
built with gcc 2.7.2.3. 

How can I fix this? Any idea anyone?

# perl Makefile.PL
Checking if your kit is complete...
Looks good
Bus error(coredump)
#

Thanks,

Paul de Repentigny


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

Date: 10 Dec 1998 13:18:06 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: namespace question
Message-Id: <74p38u$nj2$1@monet.op.net>

In article <366FE9AF.276FBFCD@sig.net>,
Alexander Bibighaus  <alexb@sig.net> wrote:
>------------------------------
>package Manager;
>use CGI qw(:standard);
>------------------------------
>
>Are the CGI functions now part of the Manager package?

Yes.

>-----------------------------------------
>package Director;
>use vars qw(@ISA);
>@ISA = qw(Manager);
>use CGI qw(:standard);
>-------------------------------------
>What happens now that I have inherited from manager?
>Are they defined twice?

What `use' does typically is to give new names to the *same* functions.

If you do

	package Manager;
	use CGI;

then the function in package CGI that used to be named CGI::param now
has a new name, Manager::param.  It's still only *defined* once, but
it has two names.

Now you do

	package Directory;
	use CGI;

and add a third name, Director::param, for the same function.

Functions are not normally inherited.  Only methods are inherited, and
the way they are inherited is not related to the importation
mechanism.  When you say

	package Director;
	@ISA = qw(Manager);

no importation is done. The way inheritance works is that if you have
an object that was blessed into package `Director', and you ask for

	$object->f

then Perl first looks for a method named Director::f; if it doesn't
find one it looks for Manager::f instead.  (I omitted some unimportant
details here.)  

Now, suppose you did

	$object->param

wher `object' was a `Director' object.  Two things would happen.
First, Perl would look for Director::param, and it would find it, and
call the function that you imported from CGI.  And second, the
imported `param' method would probably get really confused because you
called it on a Director object instead of on a CGI object.  But it
wouldn't have a chance to call the `inherited' method in `Manager'
because it only does that if it can't find the method in the object's
own package first.

>thanks in advance,

I hope this is what you were looking for.



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

Date: Thu, 10 Dec 1998 17:30:03 GMT
From: dave@mag-sol.com
Subject: Re: Newbie Question
Message-Id: <74p0en$lj4$1@nnrp1.dejanews.com>

In article <366fd998.151024211@wv-proxy>,
  jcasey@workingventures.ca (John Casey) wrote:
> Hi all,
>
> It is my first time in this news group so bear with me. I have been a
> VB programmer for years now. My boss just came up to me and asked me
> to learn CGI by yesterday.........AGHHHHHHH!!! I do not want to do the
> shell acount thing with my ISP. So my question is I have a web server
> at home running Omnicron HTTPd version 1.6. I know it supports
> CGI/Perl, but I do not believe the interpreter comes with it. Does any
> one know where to get a simple shareware CGI/Perl interpreter that
> will work with the above mentioned software. Ummmmm and any good
> CGI/Perl tutorial pages that you would reccomend.

The first place to go for all Perl stuff is <http://www.perl.com>
The second place to go for all PC Perl stuff is <http://www.activestate.com>

hth,

Dave...

--
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 10 Dec 1998 17:27:31 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: Out of memory!??
Message-Id: <74p0a3$li1@fcnews.fc.hp.com>

Silver CHEN (sansil@pchome.com.tw) wrote:
: Dear sir:

:   I've a FreeBSD w/ 32M memory and very very big swap (about 200M+)

:   but when I run a data-comsuming perl program, it told me "Out of Memory!"
:   and quit.

:   I do sure the swap is large enough for this program, but why I got this
:   message still? 

How do you know this? Have you run "gnutime" or "top" or some other
memory-monitoring program? Perl can be a memory hog, especially with
associate arrays.

:   is there anything that can't be put in swap for perl? or something I missed?

:   However, I can run this program on a solaris 2.6 w/ 512M RAM smoothly.

Try running "gnutime" or another memory monitor and checking the max
memory usage. I'd _assume_ perl on FreeBSD would use a similar amount
of memory. From your description, I would guess your program is using
between 200M and 512M of memory. On a long shot, it might be requiring
more than 32M resident (but that seems unlikely-- you can almost
always page-as-needed).

Andrew


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

Date: 10 Dec 1998 18:58:52 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Perl and Y2K
Message-Id: <74p5lc$1q9$1@pegasus.csx.cam.ac.uk>

In article <1vk147.am6.ln@flash.net>, Tad McClellan <tadmc@flash.net> wrote:
>John W. Edl Jr. (edl@lucent.com) wrote:
>
>: I was asked if this version of perl is Y2K compliant.  Anyone know for sure?
>
>
>   Yes, anyone who has searched for '2000' in the documentation
>   that shipped with perl knows for sure...

Err..  not in the documentation for perl5.003.   :-(

>   (that version is NOT free of CERT security advisories though...)

 ... so the original question is irrelevant  -  that version should have been
replaced by a more secure version long before Jan 1st, 2000.


Mike Guy


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

Date: Thu, 10 Dec 1998 20:13:55 GMT
From: dgbialac@wwitch.unl.edu
Subject: Perl unexec on Solaris
Message-Id: <74pa21$ulp$1@nnrp1.dejanews.com>

I got this to work for the most part, but I seem to be running into the
following quirks (I'm using 5.003 due to the standards at our organization):

First, I noticed that unexec is now void, and perl checks for a return value
(this is the case with the elf version anyway, I haven't looked into the a.out
verion).  I patched perl to eliminate the meaningless warning message this
creates (perl.c:1262):
void
my_unexec()
{
#ifdef UNEXEC
    int    status = 0;
    extern int etext;

    sprintf (buf, "%s.perldump", origfilename);
    sprintf (tokenbuf, "%s/perl", BIN);

  /* Unexec no longer returns a value */  unexec(buf, tokenbuf, &etext,
sbrk(0), 0); /*  if (status)  fprintf(stderr, "unexec of %s into %s failed!
(%d)\n", tokenbuf, buf, st atus); */  exit(status); #else #  ifdef VMS # 
include <lib$routines.h>  lib$signal(SS$_DEBUG);  /* ssdef.h #included from
vmsish.h */ #else  ABORT();  /* for use with undump */ #endif #endif }

For a little more efficiency, status can be removed all together and
exit(status) can be changed to exit(0), but the compiler should be smart
enough to do that already ;).

Next Quirk:
It seems that certain compiled perl programs will core dump if some statement
(any will do) is not executed prior to the first "use" statement.  Anyone else
encountered this?

And finally, is there any way to get the executables to resume where they were
left off at when a "dump" is called?  This could be useful for having a preset
environment with standard code pre-run, variables pre-initialized, etc.

David Bialac


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 10 Dec 1998 19:26:06 GMT
From: dbialac@inetnebr.com (Dave Bialac)
Subject: Perl unexec
Message-Id: <74p78e$qg3$1@owl.inetnebr.com>

I've gotten this feature to work on Solaris 2.6, however I experience the
following problems/issues (perl 5.003 which we must use due to our current
standardization):

After dumping the executable, perl gives a (false) error message claiming
that the dump failed.  This seems to be related to the fact that unexec for
ELF executables has a return type of void (and hence doesn't return
anything).  If this is truly a bug, it should probably be fixed in future
versions (if it hasn't already).

It seems that certain programs don't work properly with "use" unless some
statement is placed prior to the first "use".  Ideas on the cause?

Is there some way to resume execution when using dump where you dumped?  This
could be useful because code inside of modules can be pre-executed rather
than post-executed.  On the other hand, it may not be that much of a jump in
speed but might fix the previously mentioned problem.

BTW: on our web server preliminary tests indicate speed increases of at least
three-fold.

Dave
--
David Bialac                                               Chicago Bulls
dbialac_@_inetnebr.com                                     1991-1993,1996-1998
UN Cornhuskers - National Champions                        World Champions
1971,1972,1994,1995,1997                                   Repeat Three-peat


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

Date: 10 Dec 1998 15:51:44 -0500
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Perl, ORacle & Linux
Message-Id: <74pc90$1i5$1@tholian.cse.psu.edu>

In article <74mvv7$vhm$1@nnrp1.dejanews.com>,  <brewer@avanticorp.com> wrote:
>I can say that finding information on Oracle, Linux, and Perl is not easy.  I
>have spent most of the day looking myself.
http://www.dejanews.com, your posting host, shows several posts
about Oracle on Linux. Oracle's website has some information as well.
Once you get Oracle, fetch DBI/DBD::Oracle from http://www.cpan.org
and read the instructions. 
John
groenveld@acm.org


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

Date: Thu, 10 Dec 1998 09:22:42 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Regular Expressions
Message-Id: <x3ybtlc13pc.fsf@tigre.matrox.com>


"Troy D. Olson" <barcode@ice.net> writes:

> Example:
>     P123456-ab Ready_Rod
>     Q12345-ab Tank
> 
> Ultimate Solution:
>     123456-ab Ready_Rod
>     12345-ab Tank
> 

s/^(?:P|Q)//;



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

Date: Thu, 10 Dec 1998 12:25:36 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Regular Expressions
Message-Id: <MPG.10d9ce16e350b8f69898bc@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <x3ybtlc13pc.fsf@tigre.matrox.com> on Thu, 10 Dec 1998 
09:22:42 -0500, Ala Qumsieh <aqumsieh@matrox.com> says...
> 
> s/^(?:P|Q)//;

You *really* want to do alternation on single characters using a 
character class.  *Really* you do.  Always.

Benchmark it yourself; I'm tired.

As before:

  s/^[PQ]//;

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 10 Dec 1998 17:15:25 GMT
From: jimbob4334@my-dejanews.com
Subject: Re: take out periods
Message-Id: <74ovjb$kuc$1@nnrp1.dejanews.com>

Hi Sam,

I did check the documentation - but had problems knowing
where to look.

I will check the FAQ for guidance.

I finally got it to work using

s/\W/$1/g;

I have a problem understanding back refs and was thinking that using
tr was the answer.

So, which doc should of I have started with?

tia,

Jim



In article <slrn76vekp.5p8.sholden@pgrad.cs.usyd.edu.au>,
  sholden@cs.usyd.edu.au wrote:
> On Thu, 10 Dec 1998 11:35:50 GMT, adcoment@my-dejanews.com
> 	<adcoment@my-dejanews.com> wrote:
> >
> >
> >> How do I take the "."'s out of the variable
> >> $release =  "2.9.0"
> >> and assign 290 to $rls_name?
> >>
> >> TIA,
> >>
> >> Jim
> >
> >First, not to be critical, check the manuals at CPAN perl.com, as this is
> >quite routine.
> >
> >$release = "2.9.0";
> >$release =~ s/.//g;
> >$rls_name = $release;
>
> You could at least think about what your code does, testing it would be good
> too.
>
> Another reason why reading documentation is better than asking in clpm.
> Don't even think about using the above code, as probably everyone else here
> would know '.' is a little special in a regex.
>
> The above 'solution' firstly obliterates the value of $release which I would
> expect you don't want, and gives the completely wrong answer anyway.
>
> So Jim, ignore this answer and look up the documentation that comes with perl.
>
> --
> Sam
>
> Even if you aren't in doubt, consider the mental welfare of the person
> who has to maintain the code after you, and who will probably put parens
> in the wrong place.	--Larry Wall
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 10 Dec 1998 17:51:20 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Trouble getting started with DBM
Message-Id: <36700883.597416619@news.mmc.org>

[ posted to comp.lang.perl.misc and a courtesy copy was mailed to the cited
author ]

On Thu, 10 Dec 1998 14:30:00 GMT, bart.lateur@skynet.be (Bart Lateur) wrote:

>Jeffrey R. Drumm wrote:
>
>>>  use SDBM_File;
>
>>   use Fcntl;         # exports constants such as O_RDRW and O_CREAT
>
>>>  tie %hash, 'SDBM_File', 'test.db', O_RDWR|O_CREAT, 0644;
>
>Great! This is apparently missing in the documentation for SDBM_File.
>Here is it:
>
>=head1 SYNOPSIS
>
> use SDBM_File;
>
> tie(%h, 'SDBM_File', 'Op.dbmx', O_RDWR|O_CREAT, 0640);
>
> untie %h;
>
>Not one mention about Fcntl.
>
>This addition solved the O_SVWST mistery; it probably was a bitwise
>orring of the strings.
>
>Unfortunatly, the code still doesn't work. After changing the tieing
>code to 
>
>	tie(...) or die "Cannot tie: $!";
>
>the code dies with a "Cannot tie: file does not exist" message. Damnit.
>I thought that that was what the O_CREAT was for? (Strange sentence,
>that last one. It looks like a mere collection of loose words to me.)
>
>	Bart.

Hmm. Don't know . . . I tested your snippet on my system (AIX 4.2.1, Perl
5.004_04) and it worked as expected (well, once I added "use Fcntl;"). Perhaps
the constants aren't the same on your system? Check fcntl.h for your system's
values, maybe?

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: Thu, 10 Dec 1998 20:24:22 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Trouble getting started with DBM
Message-Id: <36742c62.1711243@news.skynet.be>

Jeffrey R. Drumm wrote:

>Hmm. Don't know . . . I tested your snippet on my system (AIX 4.2.1, Perl
>5.004_04) and it worked as expected (well, once I added "use Fcntl;"). Perhaps
>the constants aren't the same on your system? Check fcntl.h for your system's
>values, maybe?

Thank you.

I've tried to run it on MacPerl, and originally it didn't work because
"SDBM_File.pm" isn't found. (What do you mean, SDBM is included with the
Perl source? IT "should" workj on any system? Hah!)

I changed every instance of "SDBM_File" with "AnyDBM_file" (this answers
my originally last question: yes, when using AnyDBM_File, "AnyDBM_File"
is a good choice for the second parameter for tie). And it works. It
looks like I got the concepts right: the second time it runs, I can see
the data save the first time.

I guess I'll have to contact the people that did the port (DJGPP binary
DOS port, late '97). It looks like they did something wrong. It also
looks like nobody tried to use it before. :-)

	Bart.


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

Date: Thu, 10 Dec 1998 20:27:54 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Trouble getting started with DBM
Message-Id: <36752e3c.2185630@news.skynet.be>

Tad McClellan wrote:

>   But there is this in perl5004delta.pod about a different,
>   yet similar module:
>
>---------------
>Made DB_File automatically import the open() constants (O_RDWR,
>O_CREAT etc.) from Fcntl, if available.
>---------------

That was what I initially assumed. If you always need them anyway, it
seems sensible to me that any DBM module automatically use-s FCntl, so
that you don't have to worry about it.

	Bart.


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 4399
**************************************

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