[13327] in Perl-Users-Digest
Perl-Users Digest, Issue: 737 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 8 05:07:21 1999
Date: Wed, 8 Sep 1999 02:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 8 Sep 1999 Volume: 9 Number: 737
Today's topics:
addressing multiple columns with sort <corlando@NOTpop.phnx.uswest.net>
Re: addressing multiple columns with sort (Larry Rosler)
Re: Automating Secure Copy using Perl <dl@flygtaxi.se>
Re: Checking type input (Larry Rosler)
Re: Checking type input <agray@infoscience.otago.ac.nz>
Re: converting decimal into fraction? (Larry Rosler)
Day of the week david_2exvia@my-deja.com
Re: Day of the week <dave@dave.org.uk>
Help - Porting code from UNIX to NT <jonathan.hall@nospam.infores.com.au>
Re: help,Newbie save a file <corlando@NOTpop.phnx.uswest.net>
Re: How to compare references? (Larry Rosler)
Re: How to compare references? <uri@sysarch.com>
Re: Inserting data into a file <agray@infoscience.otago.ac.nz>
Re: large dataset problem (Benjamin Franz)
Re: LWP for a secure server pyso@graduate.hku.hk
mod_perl? help! <clavikal@voicenet.com>
OLE.pm HELP NEEDED ! <frederic.descamps@origin-it.com>
Re: Perl & mysql <rhardicr@gw.ford.com>
Re: Perl's underlying implementation of Arrays - Low Pr <larry@wall.org>
proxy-server problem with perl <pruefer@idnet.de>
Re: Referencing another server? (Gyepi SAM)
Re: Removing the formfeed when using a format (Philip 'Yes, that's my address' Newton)
script does not run but is printed on the screen?! lisaseeman@my-deja.com
STL difference - VC vs BCB <pusic.goran@ev.co.yu>
Re: STL difference - VC vs BCB <jshiva@bigfoot.com>
Re: suggestion to revise grep (another Q: reference com (Lars Gregersen)
Re: Sweep several txt files into 1 big txt file....... <agray@infoscience.otago.ac.nz>
Win32::Perflib <neu@adv.magwien.gv.at>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 7 Sep 1999 22:08:08 -0700
From: "rootdog" <corlando@NOTpop.phnx.uswest.net>
Subject: addressing multiple columns with sort
Message-Id: <6amB3.1269$IP5.153029@news.uswest.net>
Given the following data
91246 peach 4
91247 grape 6
91246 apple 7
91248 banana 5
how do i use the sort { $a <=> $b} and its variants to sort on any
of the columns that I wish or how do I construct a subroutine that
given n columns will sort on any combination of the given columns.
In other words I am blocking (sucking) big-time on figuring out complex
sorting with the sort command.
------------------------------
Date: Tue, 7 Sep 1999 22:18:29 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: addressing multiple columns with sort
Message-Id: <MPG.123f917e6ccf7e5e989f2a@nntp.hpl.hp.com>
In article <6amB3.1269$IP5.153029@news.uswest.net> on Tue, 7 Sep 1999
22:08:08 -0700, rootdog <corlando@NOTpop.phnx.uswest.net> says...
> Given the following data
>
> 91246 peach 4
> 91247 grape 6
> 91246 apple 7
> 91248 banana 5
>
> how do i use the sort { $a <=> $b} and its variants to sort on any
> of the columns that I wish or how do I construct a subroutine that
> given n columns will sort on any combination of the given columns.
>
> In other words I am blocking (sucking) big-time on figuring out complex
> sorting with the sort command.
RTFFAQ. perlfaq4: "How do I sort an array by (anything)?"
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 08 Sep 1999 08:18:11 +0200
From: Daniel Lundin <dl@flygtaxi.se>
Subject: Re: Automating Secure Copy using Perl
Message-Id: <37D5FFA3.83620684@flygtaxi.se>
I haven't followed the details of the other answers, but here's a way to
read STDERR:
my $cmd = "/usr/local/bin/scp ...";
open(INPUT, "$cmd 2>&1 1>/dev/null|");
while (<INPUT>)
{
if (/Secure connection to dhcp-019189.scott.af.mil refused/)
[do something else]
}
close(INPUT);
You could of course send STDOUT somewhere else than /dev/null.
/Daniel
------------------------------
Date: Tue, 7 Sep 1999 22:01:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Checking type input
Message-Id: <MPG.123f8d8cb8e81a4989f28@nntp.hpl.hp.com>
In article <slrn7tbkmt.n2g.abigail@alexandra.delanet.com> on 7 Sep 1999
22:04:21 -0500, Abigail <abigail@delanet.com> says...
> Mike (info@counter.w-dt.com) wrote on MMCXCIX September MCMXCIII in
> <URL:news:37D5C9E5.6ACBC720@counter.w-dt.com>:
> ,, How do you check to make sure a variable only has numbers in it.
>
> $var !~ /\D/
>
> Abigail
Impostor! You gave a useful answer instead of a RTFFAQ.
perlfaq4: "How do I determine whether a scalar is a
number/whole/integer/float?"
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 08 Sep 1999 20:08:36 +1200
From: Andrew Gray <agray@infoscience.otago.ac.nz>
Subject: Re: Checking type input
Message-Id: <u1zc9kepn.fsf@infoscience.otago.ac.nz>
Mike <info@counter.w-dt.com> writes:
> How do you check to make sure a variable only has numbers in it. I know
> how to tell if it has number in it but how do you check to make sure it
> doesn have any other characters in it like a , t , $, ^, etc.
If you mean that you need to check that you are dealing with an actual
number see Perlfaq 4 "How do I determine whether a scalar is a
number/whole/integer/float?". You may want to read "perldoc perlre"
first to make sure you understand \d (digit), \D (not a digit),
\. (need to escape), ^ (match start), and $ (match end) at the very
least.
Cheers,
Andrew
------------------------------
Date: Tue, 7 Sep 1999 22:08:55 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: converting decimal into fraction?
Message-Id: <MPG.123f8f44526b5549989f29@nntp.hpl.hp.com>
In article <37D5D0E7.D1498682@ic.sunysb.edu> on Tue, 07 Sep 1999
22:58:47 -0400, Z. Huang <zhuang@ic.sunysb.edu> says...
> Anyone know how to convert a decimal into a fraction: 0.125->1/8?
> Suppose the decimal under consideration are of the form x/y, with y<256.
http://x38.deja.com/getdoc.xp?AN=469210187&search=thread
(April, 1999)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 08 Sep 1999 07:25:19 GMT
From: david_2exvia@my-deja.com
Subject: Day of the week
Message-Id: <7r530o$v93$1@nnrp1.deja.com>
I have a date in string format (mm/dd/yyyy) and I'd like to find the day
of the week (Mon, Tue...)
Can someone help me ?
David
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 08 Sep 1999 09:20:28 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: Day of the week
Message-Id: <DBzWN3VCzRHg1DsZMNgKXznsQDPc@4ax.com>
On Wed, 08 Sep 1999 07:25:19 GMT, david_2exvia@my-deja.com wrote:
>I have a date in string format (mm/dd/yyyy) and I'd like to find the day
>of the week (Mon, Tue...)
>Can someone help me ?
The Perl documentation that came with your copy of Perl can help you.
Look for information about the 'split', 'timelocal' and 'localtime'
functions.
hth,
Dave...
--
Dave Cross <dave@dave.org.uk>
<http://www.dave.org.uk>
------------------------------
Date: Wed, 8 Sep 1999 16:13:47 +1000
From: "Jon Hall" <jonathan.hall@nospam.infores.com.au>
Subject: Help - Porting code from UNIX to NT
Message-Id: <37d60b0b@dnews.tpgi.com.au>
Our company has just changes ISPs and now I've got to port our basic little
PERL scripts to cope with the new environment.
Unfortunatley I've not done much in the way of PERL and NT so I'm running
into pitfalls.
Here's a snippet:-
#!c:\perl\bin\perl.exe
print "Location: http://www.oursite.com/index.html\n\n";
exit;
When I run this I receive "HTTP/1.0 500 Server Error (/scripts/redir.cgi is
not a valid Windows NT application. )"
The ISP tells me the directory is set as executable - have I overlooked
something blatant??
Thanks for your help,
Jon
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Tue, 7 Sep 1999 22:14:27 -0700
From: "rootdog" <corlando@NOTpop.phnx.uswest.net>
Subject: Re: help,Newbie save a file
Message-Id: <2gmB3.1273$IP5.154274@news.uswest.net>
The .pl extension can be useful in windows. Unix extensions are not stictly
necessary unless dealing with a program ( ex. compilers) that look for a
certain extension.
Randy <randys@dowco.com> wrote in message
news:37d59bec.60106045@news.dowco.com...
> Hello,
>
> All I need to know is there an extention I have to put on the end of a
> script file ?
>
> i.e. hello_world.pl " does the " pl " have to be there of
> something else.
>
> thank you very much!
>
------------------------------
Date: Tue, 7 Sep 1999 21:54:13 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to compare references?
Message-Id: <MPG.123f8bc9f9e957c1989f27@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7r4f0n$bkm@netnews.hinet.net> on Wed, 8 Sep 1999 09:46:01
+0800, John Lin <johnlin@chttl.com.tw> says...
...
> Actually, my pratical question is
> "Then, how to compare references?" (it's not documented in perlref)
>
> I guess
>
> grep { $reference eq $_ } @objects
>
> will work because it compares strings like "HASH(0xcb3d80)"
> which is unique for each reference.
>
> But I doubt whether this is the correct way to compare references.
Why not?
> Or we need another op, say "req", eq for references, to put here?
>
> grep { $reference req $_ ) @objects
Why, if 'eq' does what is wanted?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 08 Sep 1999 01:58:06 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: How to compare references?
Message-Id: <x7906indw1.fsf@home.sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> +0800, John Lin <johnlin@chttl.com.tw> says...
>> "Then, how to compare references?" (it's not documented in perlref)
>> grep { $reference eq $_ } @objects
>> But I doubt whether this is the correct way to compare references.
LR> Why not?
>> Or we need another op, say "req", eq for references, to put here?
LR> Why, if 'eq' does what is wanted?
one problem is that eq will stringify the references which slows the
compare down. there is a new way (in 5.005 developement and coming in
5.6 i think) which allows ref compares with == which will do a numeric
compare of the actual addresses in the refs and is much faster.
it also allows for some ugly access to perl guts directly from
perl. there was a very strange recent post to p5p IIR, where a sub
accessed various internal fields of an SV via the ref address and
strange uses of pack/unpack. major black magic allowed a string to be
hidden and retrieved in the SV. the hidden data was inserted before the
real data and the hidden data was "deleted" with a substr. it was
retrieved with a wacky set of unpack expressions.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: 08 Sep 1999 20:16:25 +1200
From: Andrew Gray <agray@infoscience.otago.ac.nz>
Subject: Re: Inserting data into a file
Message-Id: <uyaehizs6.fsf@infoscience.otago.ac.nz>
Please don't send HTML to a news group.
Laurent Cordon <Laurent.Cordon@afp.com> writes:
> I would like to insert data into my file as described below
<SNIP>
> My problem is how to insert amerlino@afp.com at this position and
> not at the top nor bottom of the file
See perlfaq5 "How do I change one line in a file/delete a line in a
file/insert a line in the middle of a file/append to the beginning of
a file?"
If you are still having problems try sending the best program you can
write along with a description of what is going wrong.
Cheers,
Andrew
------------------------------
Date: Wed, 08 Sep 1999 05:29:23 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: large dataset problem
Message-Id: <TumB3.962$2H4.51060@typhoon01.swbell.net>
In article <37d5bb8a_1@newsread3.dircon.co.uk>,
Andrew Whitaker <bigsleep@dircon.co.uk> wrote:
>
>Makarand Kulkarni wrote in message <37D56983.98BDF059@cisco.com>...
>>[ Benjamin Franz wrote:
>>
>>> You want to use a data structure like this:
>>> $data->[$year]->[$month]->[$row]->[$column] = $value;
>>
>>Or else simple file indexing would work. After "freezing" the dataset
>>file, write a script to create an index on the file with the following
>>structure.
>>
>>year, month, row seekpos
>>
>>where seekpos where you would seek() to inside
>>the file to position for (year, month, row)
>
>
>I would definitely rule out importing the whole dataset into memory - far
>too memory intensive.
Depends on your system. I routinely work with larger datasets.
But if you want to avoid memory usage, an easier tack is to
use a tied hash. The modifications are minor in this case.
It could, of course, be improved by converting the columns
and rows to lat and long during the database load.
Untested code yada yada.
#!usr/bin/perl -w
use strict;
my $filename = '/path/to/dataset';
my $db_file = '/path/to/dataset_database_file';
# Only has to be done once.
load_database($filename,$db_file);
my $db_hash = {};
if (not tie (%$db_hash,'SDBM_File',$db_file)) {
die ("Unable to tie $db_file: $!");
}
my $value = $db_hash->{address('1990','1','49N','5W')};
untie %$db_hash;
sub address {
my ($year,$month,$latitude,$longitude) = @_;
my ($hemisphere,$row,$column);
($row,$hemisphere) = $longitude =~ m/^(\d+)(E|W)$/i;
if (not $hemisphere) { die ("Bad longitude\n"); }
if ($hemisphere =~ m/^E$/i) {
$row = 180 + $row;
} else {
$row = 180 - $row;
}
($column,$hemisphere) = $latitude =~ m/^(\d+)(N|S)$/i;
if (not $hemisphere) { die ("Bad latitude\n"); }
if ($hemisphere =~ m/^S$/i) {
$row = 90 + $row;
} else {
$row = 90 - $row;
}
"$year $month $row $column";
}
sub load_database {
my ($file,$db_file) = @_;
my $db_hash = {};
if (not tie (%$db_hash,'SDBM_File',$db_file)) {
die ("Unable to tie $db_file: $!");
}
open (DATASET,$file) || die ("Couldn't open $file: $!\n");
my $done = 0;
until ($done) {
my $date = <DATASET>;
last if (not $date);
chomp $date;
my ($month,$year) = split(/\s+/,$date);
for (my $row = 0; $row < 180; $row++) {
my $data = <DATASET>;
chomp $data;
my @values = split (/\s+/,$data);
for (my $column = 0;$column < @values; $column++) {
$db_hash->{"$year $month $row $column"} = $values[$column];
}
}
}
close (DATASET);
untie %$db_hash;
}
------------------------------
Date: Wed, 08 Sep 1999 08:46:45 GMT
From: pyso@graduate.hku.hk
Subject: Re: LWP for a secure server
Message-Id: <7r57pj$2ao$1@nnrp1.deja.com>
In article <37B19032.B9350673@chaos.wustl.edu>,
elaine@chaos.wustl.edu wrote:
> David Oukrat wrote:
> > i want use a similar function for a 'https' server
> > LWP gives "server down" with a 'https' server
> > this is my function for a 'http' server
>
> http and https use two different protocols on two different ports.
>
> Go get Net::SSLeay from CPAN and view the readme.
In the readme it says the module make the LWP support HTTPS, but never
mention anything on how to use it. Do you have any sample code or
guideline that I can follow? Thanks a lot. Your reply to my mailbox is
welcomed.
Thanks in Advance
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 8 Sep 1999 00:27:39 -0400
From: "clavikal" <clavikal@voicenet.com>
Subject: mod_perl? help!
Message-Id: <VulB3.414$y51.64215@news3.voicenet.com>
I (think) understand mod_perl somehow increases the speed, and lowers the
cpu usage of perl programs because it doesn't spawn a separate process.
The installation documentation at the mod_perl web site really sucks ( to me
anyways ), so if anyone wouldn't mind, could someone please post easy
instructions, and tell me what I should have installed already, etc.
Any help would be greatly appreciated.
Thanks!
------------------------------
Date: Wed, 8 Sep 1999 10:36:03 +0200
From: "Frederic Descamps" <frederic.descamps@origin-it.com>
Subject: OLE.pm HELP NEEDED !
Message-Id: <0E16861EE7BCD111BE9400805FE6841F0B45A873@c1s5x001.cor.srvfarm.origin-it.com>
Hi,
How can I get back the value of a field in MS access USING OLE.pm.
I need to do select with an unique output and get back in my perl script the
value of a field.
Could someone help me ?
Thankx
Fred.
------------------------------
Date: Wed, 08 Sep 1999 08:52:23 +0100
From: Richard H <rhardicr@gw.ford.com>
Subject: Re: Perl & mysql
Message-Id: <37D615B7.8305FC1F@gw.ford.com>
Mike wrote:
>
> How do you select a random result returned from a mysql request?
By counting the number of rows you have returned and using the rand
function on the result, that is if you want a random selection from your
result set.
> This retrieves the info returned from a query $sth->fetchrow_array;
> But what I want to know is how in perl would you select if you had a
> field named account and had a bunch of rows with that same account how
> would you select a random row?
do you mean in the select statement or after you have returned all your
rows?
Richard H
------------------------------
Date: Wed, 08 Sep 1999 08:51:22 GMT
From: Larry Wall <larry@wall.org>
Subject: Re: Perl's underlying implementation of Arrays - Low Priority
Message-Id: <19990908.8512200@kiev.wall.org>
On 9/3/99, 5:34:05 PM, Dan Sugalski <dan@tuatha.sidhe.org> wrote:
> So basically if you unshift on the beginning or push on the end you=20
can
> potentially end up shifting memory, and if you splice in the middle=20
you
> definitely will.
Yes, though it looks to see which end of the array it's closer to, and
shifts as little as possible. (Same goes for substr() within a=20
string.)
> With either one you may trigger a realloc.
>
> If you think this is inefficient, it actually isn't. It works very=20
well
> for the common usage of arrays, which is the way you want it. (The=20
common
> things should be fast. Uncommon or messy things can be slower)
Also, one should bear in mind that even if you have to shift some=20
memory,
you're not actually moving the data, just some pointers to the data,=20
so
it's quite efficient. In a sense, the longer the strings you're=20
processing,
the more efficient it is, relative to how much data you're processing.
On the other hand, this is why we don't view strings as arrays of=20
characters
in Perl. The overhead to store each character would be unacceptable=20
in that
case. Much easier to move the characters themselves than pointers to=20
them.
Larry
------------------------------
Date: Wed, 8 Sep 1999 09:43:21 +0100
From: "Claus Prüfer" <pruefer@idnet.de>
Subject: proxy-server problem with perl
Message-Id: <7r5414$t48$1@news.gigabell.net>
hi m8es!
ive got a big problem.
i did write a shopping system in perl/cgi... the thing is: i use the
$ENV{REMOTE_HOST} ENVIRONMENT-Variable to give every user an own shopping
cart... hm, works fine until the user goes over a proxy-server...
if two users are in over the same proxy he cant devide the ip-adresses...
(because remote_host takes the ip-adress of the proxy)
does someone know how i get an "100%" identifier to open a filename for a
shopping cart or multiple users online?
is there a server-variable i can get over perl/cgi?
thanx!!!
claus prüfer
------------------------------
Date: Wed, 8 Sep 1999 01:45:51 -0400
From: gyepi@magnetic.praxis-sw.com (Gyepi SAM)
Subject: Re: Referencing another server?
Message-Id: <slrn7tbu8k.i02.gyepi@magnetic.praxis-sw.com>
On Tue, 07 Sep 1999 18:12:49 +1700, ScrO <zomzomNOkmSPAM@hotmail.com> wrote:
>Can antone tell me how to reference another server from
I don't know about antone, but I can.
>within a perl script?
>
>ie:
>$mailprog = '/usr/sbin/smail';
>
>but I want to reference a seperate internal server (named
>"rocky" for example).. any ideas?
You'd have to use an smtp library or roll your own in order to
send mail through another machine.
You could use Net::SMTP or other appropriate module.
grep around CPAN.
--
Gyepi Sam --+-- Designer/Programmer --+-- Network/System Administrator
gyepi@praxis-sw.com --+-- http://www.praxis-sw.com/gyepi
The state law of Pennsylvania prohibits singing in the bathtub.
------------------------------
Date: Wed, 08 Sep 1999 04:23:36 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: Removing the formfeed when using a format
Message-Id: <37d5e23b.32220832@news.nikoma.de>
On Mon, 06 Sep 1999 03:31:10 -0700, Rob Rogers <rrogers@naisp.net>
wrote:
>After some searching I found this in perlform:
>
>The string output before each top of page (except the first) is stored
>in $^L ($FORMAT_FORMFEED)
>
>Which is set to \f as a default. I needed to get that out of there
>because the output of this is being opened in a richedit field in a
>Win32::Gui program for reviewing (it's a payroll report) and then after
>any changes the file gets read in and re-output to a different file
>handle with a different format.
>
>Setting $^L to "" keeps the form feed from being printed but I still
>get an extra newline (actualy CRLF on Win32) Can anyone tell me a way to
>avoid this? I tried undef($^L) but that just resulted in a runtime error
>when it hit the end of the first page.
>
>Thank you,
>Rob Rogers
You could set $= ($FORMAT_LINES_PER_PAGE) to something really high
(higher than the number of lines you'll be printing), in which case
you'd never get a formfeed. This would also mean you'd only get
FORMAT_TOP (if you're using it) printed once (at the very beginning)
and not at the start of every page. Or you could fool around with $-
($FORMAT_LINES_LEFT) after every write() so that it never reaches
zero.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.net>
------------------------------
Date: Wed, 08 Sep 1999 07:59:57 GMT
From: lisaseeman@my-deja.com
Subject: script does not run but is printed on the screen?!
Message-Id: <7r551o$m4$1@nnrp1.deja.com>
I was running some nice scripts of my virtual host (NT), when they
“improved” their service. Now my scripts do not run, they are either
downloaded or they are printed on the screen. Does anyone know what is
going on. (needless to say my host doesn’t answer support request.)
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 8 Sep 1999 07:59:09 +0100
From: "Pušiæ Goran" <pusic.goran@ev.co.yu>
Subject: STL difference - VC vs BCB
Message-Id: <7r51oa$tqh$1@Mercury.ev.co.yu>
Can enyone explain to me why thi program compiles and works in BCB 3 and
doesn't compile in VC 5?
#include <Vector>
#include <Memory>
using namespace std;
main()
{
vector<auto_ptr<int> > v;
return 0;
}
VC 5 spits a bunch of messages in xutility don't understand (C2784, C2676)
What I'm trying is to create a container of which "owns" objects it's
pointers point to (something like "indirect container") and it seems to me
that auto_ptr is OK for this. Correct me if I'm wrong, please.
------------------------------
Date: Wed, 08 Sep 1999 00:13:39 -0700
From: Shiva <jshiva@bigfoot.com>
Subject: Re: STL difference - VC vs BCB
Message-Id: <37D60CA3.F789C7F0@bigfoot.com>
"Pušiæ Goran" wrote:
> Can enyone explain to me why thi program compiles and works in BCB 3 and
> doesn't compile in VC 5?
>
> #include <Vector>
#include <vector>
>
> #include <Memory>
#include <memory>
>
>
> using namespace std;
not a good idea to bring everything into the global namespace
>
>
> main()
int main()
implicit return values are not nice.
>
> {
> vector<auto_ptr<int> > v;
It's not a good idea to have a standard container of auto_ptr's.
There are a lot of ownership & copying issues.
Do search on www.deja.com for auto_ptr & you will find the reason
>
> return 0;
> }
>
> VC 5 spits a bunch of messages in xutility don't understand (C2784, C2676)
The standard's people say, that they tried to design the auto_ptr class in
such a way that
a standard container of auto_pts' will not compile.
So, it's good that VC++ doesn't compile it.
> What I'm trying is to create a container of which "owns" objects it's
> pointers point to (something like "indirect container") and it seems to me
> that auto_ptr is OK for this. Correct me if I'm wrong, please.
--
regards,
Shiva
http://members.xoom.com/jshiva
clc++ FAQ -> http://www.cerfnet.com/~mpcline/c++-faq-lite/
P.S. I don't understand why this is cross-posted to a perl newsgroup ?
------------------------------
Date: Wed, 08 Sep 1999 07:27:37 GMT
From: lg@kt.dtu.dk (Lars Gregersen)
Subject: Re: suggestion to revise grep (another Q: reference comparison)
Message-Id: <37d60fca.1378022794@news.dtu.dk>
On Tue, 7 Sep 1999 15:19:36 +0800, "John Lin" <johnlin@chttl.com.tw>
wrote:
>Dear all,
>
>It happened on my careless bug.
>
>@friends=('Johnson','Mary','Tommy');
>$person='Johnson';
>if(grep($person,@friends)) { print "$person is my friend" }
If you need to do this frequently make @friend a hash.
Lars
------------------------------
Lars Gregersen (lg@kt.dtu.dk)
http://www.gbar.dtu.dk/~matlg
------------------------------
Date: 08 Sep 1999 19:59:40 +1200
From: Andrew Gray <agray@infoscience.otago.ac.nz>
Subject: Re: Sweep several txt files into 1 big txt file.......
Message-Id: <u4sh5kf4j.fsf@infoscience.otago.ac.nz>
"HPK" <hanz@chello.nl> writes:
> I'm looking for a cgi script that reads several txt files, and sweeps them
> into one big text file. I tried to program my own script, but it did not
> work.... Anyone where I can get this simple, but effective script?
Perhaps you could post your best attempt at solving this problem and
explain what didn't work the way you wanted it to work. Then we could
help find the problems in your code.
As it stands your question is far too ambiguous to answer---what text
files, are they always the same or selected from a form, do you mean
concatenate them when you say `sweep', how do you want them output if
at all?
Otherwise try "perldoc perlfaq5" which possibly answers your question
somewhere.
Cheers,
Andrew
------------------------------
Date: Wed, 8 Sep 1999 07:09:58 +0200
From: "Jürgen Neustifter" <neu@adv.magwien.gv.at>
Subject: Win32::Perflib
Message-Id: <936767398.956241@mozart.adv.magwien.gv.at>
Does anybody know how to use Win32::Perflib with WinNT?
I can find the counter and the countertype but I don't know how to
interprete.
ie. I want to calculate '% Processor Time' and get the counter 513310904832
and the countertype PERF_100NSEC_TIMER_INV or I want '% Free Space' of my
disks!
--
Regards,
Jürgen Neustifter
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 737
*************************************