[16885] in Perl-Users-Digest
Perl-Users Digest, Issue: 4297 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 12 14:05:38 2000
Date: Tue, 12 Sep 2000 11:05:19 -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: <968781919-v9-i4297@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 12 Sep 2000 Volume: 9 Number: 4297
Today's topics:
@variable_list2 <todd@mrnoitall.com>
Re: @variable_list2 <yanick@babyl.sympatico.ca>
Re: @variable_list2 <yanick@babyl.sympatico.ca>
Re: @variable_list2 nobull@mail.com
[Possibly OT] XS question regarding DBD::DB2 <bene@chiark.greenend.org.uk>
build problem <coers@intrinsity.com>
Re: Change Windows Desktop BG <jluongonospam@draper.com>
Re: cwd reporting incorrect directory in ActiveState 61 <scotts@itinet.com>
Re: Date question? Can't display English style? <iltzu@sci.invalid>
DBI/MySQL Question for the WISE desertedge@my-deja.com
Re: DBI/MySQL Question for the WISE <anders@wall.alweb.dk>
Re: DBI/MySQL Question for the WISE <garry@zvolve.com>
Re: Eliminate Duplicates (Tom Christiansen)
Re: Eliminate Duplicates shollins@my-deja.com
Re: Error message <nickco3@yahoo.co.uk>
Get the MAC address from an IP <mmesarch@wcom.net>
hash arrays... <alvaro@arbol-logika.com>
Re: hash arrays... <yanoff@yahoo.com>
Re: How can i install Perl DBI module without the cc co <gellyfish@gellyfish.com>
Re: Incremental HTML output as script is running <news@flish.co.uk>
insert hyphen between variables <gapno@spamnb.net>
Re: insert hyphen between variables <anders@wall.alweb.dk>
Re: insert hyphen between variables <gapno@spamnb.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 12 Sep 2000 10:16:52 -0600
From: Todd Anderson <todd@mrnoitall.com>
Subject: @variable_list2
Message-Id: <39BE567E.87EDB2DC@mrnoitall.com>
Dear Sirs and or Madam,
Thanks for your help. But it still doesn't work. Any ideas?
Thanks in advance for your help.
my %underwritter1_companies = (
AL => [ 'Company1', 'Company2', 'Company3', 'Company4' ]
, AK => [ 'Company1', 'Company2', 'Company3', 'Company4' ]
, AZ => [ 'Company1', 'Company2', 'Company3', 'Company4' ]
, AR => [ 'Company1', 'Company2', 'Company3', 'Company4' ]
, CA => [ 'Company1', 'Company2', 'Company3', 'Company4' ]
, CO => [ 'Company1', 'Company2', 'Company3', 'Company4' ]
, CT => [ 'Company1', 'Company2', 'Company3', 'Company4' ]
, DE => [ 'Company1', 'Company2', 'Company3', 'Company4' ] );
my %underwritter2_companies = (
AL => [ 'Company1', 'Company2', 'Company3', 'Company4' ]
, AK => [ 'Company1', 'Company2', 'Company3', 'Company4' ]
, AZ => [ 'Company1', 'Company2', 'Company3', 'Company4' ]
, AR => [ 'Company1', 'Company2', 'Company3', 'Company4' ]
, CA => [ 'Company1', 'Company2', 'Company3', 'Company4' ]
, CO => [ 'Company1', 'Company2', 'Company3', 'Company4' ]
, CT => [ 'Company1', 'Company2', 'Company3', 'Company4' ]
, DE => [ 'Company1', 'Company2', 'Company3', 'Company4' ] );
print qq~<select name="company">
<option value="" selected>Choose 1~;
foreach my $co ( @{$underwritter1_companies{$form_data{'state'}}} ){
print qq~<option value="underwritter1">$co~;
}
foreach my $co ( @{$underwritter2_companies{$form_data{'state'}}} ){
print qq~<option value="underwritter2">$co~;
}
print qq~</select>
------------------------------
Date: Tue, 12 Sep 2000 16:59:48 GMT
From: Yanick Champoux <yanick@babyl.sympatico.ca>
Subject: Re: @variable_list2
Message-Id: <8itv5.232150$Gh.5318001@news20.bellglobal.com>
Todd Anderson <todd@mrnoitall.com> wrote:
: Dear Sirs and or Madam,
Hullo,
: Thanks for your help. But it still doesn't work. Any ideas?
: Thanks in advance for your help.
<snip code>
May I recommend a perusal of the priceless jewels of Perl lore
that the commands
perldoc perldata
perldoc perldsc
perldoc perllol
will merely pour out on your terminal?
Or, if you already absorbed the wisdom infused in those
ubiquitous but alas so painfulyl rarely consulted and are
only looking at examples to jog your memory...
#!/usr/bin/perl -w
use strict;
my @array = ( 'Y', 'e', 't' );
my @other_array = ( ' ', 'a', 'n', 'o', 't' );
my @array_of_arrays = ( \@array, \@other_array );
my %hash = ( A => 'her ', B => 'Pe', C => 'rl' );
my %hash_of_arrays =
( D => \@array, # one way
E => [ ' h', 'a', 'c', 'k' ] ); # and another
my @array_of_hashes_of_arrays =
( \%hash_of_arrays, # again, two ways of doing the same thing
{ F => \@other_array,
G => [ 'e', 'r', '.' ] } );
# now let's access all those cute puppies
print $array[0],
@{$array_of_arrays[0]}[1,2];
print $array_of_arrays[1]->[$_] for 0..4;
print $hash{ A },
@hash{ 'B', 'C' };
print $hash_of_arrays{E}->[0];
print ${$hash_of_arrays{E}}[1];
print @{$hash_of_arrays{E}}[2..3];
print $array_of_hashes_of_arrays[1]->{G}->[0];
print ${array_of_hashes_of_arrays[1]}{G}->[1];
print ${${array_of_hashes_of_arrays[1]}{G}}[2]; # bleh :-P
__END__
Good luck!
Yanick
--
eval $problem."
require 'yet another Perl hacker' " unless $trivial;
callsys; # surely the sys-admin knows Perl
wait; wait; wait; # why doesn't he answer?
listen PHONE, 0;$@=~s/^.*?(y.*?)in.*$/\u$1/; # argh! line noise!
warn $whine and $curse => "$@$;@_"; # Okay, fine! Plan B, then!
use CPAN;
------------------------------
Date: Tue, 12 Sep 2000 17:09:53 GMT
From: Yanick Champoux <yanick@babyl.sympatico.ca>
Subject: Re: @variable_list2
Message-Id: <Brtv5.232174$Gh.5318001@news20.bellglobal.com>
Yanick Champoux <yanick@babyl.sympatico.ca> wrote:
: May I recommend a perusal of the priceless jewels of Perl lore
: that the commands
: perldoc perldata
: perldoc perldsc
: perldoc perllol
: will merely pour out on your terminal?
^^^^^^
That was supposed to be 'merrily'. To use 'merily' is
to belittle teh importance of those documents, which
is of course a sin. :)
Yanick
--
eval" use 'that poor Yanick' ";
print map{ (sort keys %{{ map({$_=>1}split'',$@) }})[hex] }
qw/8 b 15 1 9 10 11 15 c b 13 1 12 b 13 f 1 c 9 a e b 13 0/;
------------------------------
Date: 12 Sep 2000 18:15:24 +0100
From: nobull@mail.com
Subject: Re: @variable_list2
Message-Id: <u9snr5351v.fsf@wcl-l.bham.ac.uk>
Todd Anderson <todd@mrnoitall.com> writes:
> Subject: Re: @variable_list2
> Dear Sirs and or Madam,
> Thanks for your help. But it still doesn't work. Any ideas?
I have an idea that you meant to post this to an existing thread
rather than starting a new thread with a meaningless subject.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 12 Sep 2000 16:26:01 +0100 (BST)
From: Ben Evans <bene@chiark.greenend.org.uk>
Subject: [Possibly OT] XS question regarding DBD::DB2
Message-Id: <DDf*cl5Bo@news.chiark.greenend.org.uk>
Hi, I'm not sure if XS is considered off-topic in clpm,
but if so, sorry, and could someone please point me in
the right direction.
The following is code taken from the source of DBD::DB2.
I didn't write it, IBM did. :)
[snip]
MODULE = DBD::DB2 PACKAGE = DBD::DB2
...
void
bind_param_inout(sth, param, value_ref, maxlen, attribs=Nullsv)
SV * sth
SV * param
SV * value_ref
IV maxlen
SV * attribs
CODE:
{
IV sql_type = 0;
D_imp_sth(sth);
SV *value;
if (!SvROK(value_ref) || SvTYPE(SvRV(value_ref)) > SVt_PVMG)
croak("bind_param_inout needs a reference to a scalar value");
value = SvRV(value_ref);
if (SvREADONLY(value))
croak("Modification of a read-only value attempted");
if (SvGMAGICAL(value))
mg_get(value);
if (attribs) {
if (SvNIOK(attribs)) {
sql_type = SvIV(attribs);
attribs = Nullsv;
} else {
SV **svp;
DBD_ATTRIBS_CHECK("bind_param_inout", sth, attribs);
/* XXX we should perhaps complain if TYPE is not SvNIOK */
/*DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type);*/
}
}
ST(0) = dbd_bind_ph(sth, imp_sth, param, value, 0, attribs, 1, maxlen)
? &sv_yes : &sv_no;
}
...
The part I don't understand is the if (attribs) { ... } clause.
I had taken the right-most assignment (attribs=Nullsv) in the
function prototype (is that the right word for the
bind_param_inout(sth, param, value_ref, maxlen, attribs=Nullsv)
line ?) to mean that attribs must have a Null scalar value.
If I'm following all this, then what it means is that:
$sth->bind_param_inout($parameter_count, \$bind_value, $maxlen,
$rh_attribs);
works. The part I don't get is whether that attribs=Nullsv
means that any $rh_attribs I try and pass in get silently munched.
It looks to me like it should, but why then should you want
to predicate the longest clause of your glue code on something
which you know is null?
The other part I don't understand is what the SvNIOK(attribs)
check is for. I can see it's checking to see if attribs is a scalar
value of some specific type, and I'm guessing that SvNIOK() checks
to see if its argument is either an IV or an NV (ie an integer SV
or a double SV). But even if attribs is not null, shouldn't it be
the typemap of a hashref (which would be done by checking to see if
SvPOK(attribs) was true (which would tell us that attribs was some
sort of pointer value) and then checking to see if
SVTYPE(attribs) was the constant SVt_PVHV ...
Ummm. Anyway, sorry for the core dump. Anyone got any pointers
for me?
Kitty
--
Kitty (bene@chiark.greenend.org.uk)
"Bad times can make you fall in love with a penguin" -- Laika
------------------------------
Date: Tue, 12 Sep 2000 10:58:51 -0500
From: John Coers <coers@intrinsity.com>
Subject: build problem
Message-Id: <39BE52BB.DC47EA0D@intrinsity.com>
Howdy,
Are sv_yes, sv_no, and sv_undef CORE perl functions? If so, where are they defined? I have poked around
all through where I though they might be, but no joy. I see they are mentioned on the perlguts man, but
the info I need is not included.
My real problem is not being able to build the DBI module 1.14 b/c these (and other) functions are not defined.
I won't go into detail since I think I can solve this problem myself if my above questions are answered...
------------------------------
Date: Tue, 12 Sep 2000 11:12:11 -0400
From: "James M. Luongo" <jluongonospam@draper.com>
Subject: Re: Change Windows Desktop BG
Message-Id: <39BE47CB.C1A86F5E@draper.com>
Where can I find the standard documentation for those modules?
jason wrote:
>
> James M. Luongo <jluongonospam@draper.com> wrote ..
> >How would I use Perl for Windows to randomly change my windows desktop
> >background each time I logged into my computer?
>
> (assuming that you've checked CPAN in case someone's actually written
> this sort of functionality into a module - I have not checked it)
>
> the windows background setting is stored in the Windows registry ..
> there are two modules for adjusting the registry .. both are (now)
> standard modules
>
> Win32::TieRegistry
> Win32API::Registry
>
> see the standard documentation for how to use them
>
> see some Windows resource for which setting it is
>
> --
> jason -- elephant@squirrelgroup.com --
--
------------------------
James M. Luongo x1427
Draper Laboratory Room 4207
------------------------
------------------------------
Date: Tue, 12 Sep 2000 11:32:14 -0500
From: "Scott Schaumann" <scotts@itinet.com>
Subject: Re: cwd reporting incorrect directory in ActiveState 613?
Message-Id: <iVsv5.10$q13.9271@nnrp3.sbc.net>
Thanks--works like a charm! (And it's sooo simple!)
-Scott
"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:87og1uo7lw.fsf@limey.hpcc.uh.edu...
>
> [ please put original first, then add your reply to the
> relevant portions of the text ]
>
> >> On Mon, 11 Sep 2000 17:59:28 -0500,
> >> "Scott Schaumann" <scotts@itinet.com> said:
>
> > You are probably right. Unfortunately that doesn;t solve
> > my problem. My original problem was that if ( - e
> > filename) is failing in this directory. Is there a way
> > to get if(-e...) to correctly determine the directory
> > the perl script is running in?
>
> Carpe diem. Use chdir() to change directory to where you
> want to be. Then it's easy: you're in "." :-)
>
> hth
> t
> --
> WWNKD?
>
------------------------------
Date: 12 Sep 2000 16:57:42 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Date question? Can't display English style?
Message-Id: <968777553.20117@itz.pp.sci.fi>
In article <39b9eea1.1165503@news.alphalink.com.au>, Ivan Lee wrote:
>the day, why is that? moreover, in both case I display the
>year is "100"
>is that normal?
No, not really. For most of the time since Perl (and C before it) has
had the localtime() function, the year has not been 100. The current
state is just a temporary aberration, and is likely to change in about
three or four months. The next year is expected to be 101.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla | "By promoting postconditions to
and its pseudonyms - | preconditions, algorithms become
do not feed the troll. | remarkably simple." -- Abigail
------------------------------
Date: Tue, 12 Sep 2000 17:03:58 GMT
From: desertedge@my-deja.com
Subject: DBI/MySQL Question for the WISE
Message-Id: <8plnlc$t98$1@nnrp1.deja.com>
As I add a record to the MySQL database, I have an auto-incremented
number assigned to the first field within the table. When the record
is created (with the code below), I would like to then instantly
retrieve the new auto-incremented number. I've thrown FETCH commands
in, but it doesn't seem to work. Is there a way to do this easily,
without generating a new query????
MY EXAMPLE CODE:
use DBI ;
$query = "INSERT INTO appls (NETappID,
clienID,
CEappID_
VALUES ('blahblah','etc', 'etc')";
$sth = $dbh->prepare ( $query ) or
&dieerror ("Error Code<p>$DBI::errstr");
$sth->execute or
&dieerror ("Error Code2<p>$DBI::errstr");
######HERE IS WHERE I WOULD LIKE TO FETCH THE ID OF THE RECORD ##
$sth->finish;
$dbh->disconnect;
Thanks in advance.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 12 Sep 2000 17:29:00 GMT
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: DBI/MySQL Question for the WISE
Message-Id: <wJtv5.688$Oh1.8422@news000.worldonline.dk>
desertedge@my-deja.com wrote:
> As I add a record to the MySQL database, I have an auto-incremented
> number assigned to the first field within the table. When the record
> is created (with the code below), I would like to then instantly
> retrieve the new auto-incremented number. I've thrown FETCH commands
> in, but it doesn't seem to work. Is there a way to do this easily,
> without generating a new query????
>
> MY EXAMPLE CODE:
> use DBI ;
> $query = "INSERT INTO appls (NETappID,
> clienID,
> CEappID_
> VALUES ('blahblah','etc', 'etc')";
>
> $sth = $dbh->prepare ( $query ) or
> &dieerror ("Error Code<p>$DBI::errstr");
> $sth->execute or
> &dieerror ("Error Code2<p>$DBI::errstr");
>
> ######HERE IS WHERE I WOULD LIKE TO FETCH THE ID OF THE RECORD ##
$sql = $dbh->prepare("select auto_col from table_name sort by auto_col desc
limit 1");
die "DB ERROR: $DBI::errstr\n" unless ($sth = $dbh->prepare($sql) &&
$sth->execute);
$new_rec_id = ($sth->fetchrow)[0];
$sth->finish;
> ## not needed for insert ## $sth->finish;
> $dbh->disconnect;
>
>
> Thanks in advance.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
-anders
--
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]
------------------------------
Date: Tue, 12 Sep 2000 13:58:03 -0400
From: "Garry T. Williams" <garry@zvolve.com>
Subject: Re: DBI/MySQL Question for the WISE
Message-Id: <Pine.SOL.4.21.0009121343001.26378-100000@ifr>
On Tue, 12 Sep 2000, Anders Lund wrote:
> desertedge@my-deja.com wrote:
> > ######HERE IS WHERE I WOULD LIKE TO FETCH THE ID OF THE RECORD ##
>
> $sql = $dbh->prepare("select auto_col from table_name sort by auto_col desc
> limit 1");
> die "DB ERROR: $DBI::errstr\n" unless ($sth = $dbh->prepare($sql) &&
> $sth->execute);
> $new_rec_id = ($sth->fetchrow)[0];
> $sth->finish;
So how is it that you *know* that the highest number in this table is the
row just inserted by *you*? Is it possible that another insert by another
client is now the row you are retrieving?
I think the original poster wants an "atomic" operation that both
instantiates a new row with an automatically incremented column *and*
returns the value of that column.
Your suggestion creates a race condition.
Then, of course there is the problem of MySql not accepting the query. It
is syntactically incorrect and will raise an exception. The word `sort'
should be `order'. But why would you go to all the trouble of saying it
that way when you could say:
select max(auto_col) from table_name
instead. (You still have created a race condition.)
-Garry Williams
------------------------------
Date: 12 Sep 2000 09:09:10 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: Eliminate Duplicates
Message-Id: <39be4716@cs.colorado.edu>
In article <8plfci$ids$1@nnrp1.deja.com>, <shollins@my-deja.com> wrote:
>I am writing a perl program that will convert a
>text file into a .dbf file. However, there are
>duplicate fields in the text file. How can a
>eliminate duplicates and only pull in unique
>fields?
Precisely what part of "man perlfaq | grep duplicate" don't you
understand? Word to the would-be wise: Asking FAQs will just get
you a lot of harrassment, because it's a way of telling the world
that you are very lazy, but that you expect others to do all your
work for you rather than doing the barest minimum of self-directed
research.
Using my new perlman tool (which will replace the embarrassingly
stupid "perldoc" atrocity):
% perlfaq duplicate
perlfaq4 chunk 255
How can I remove duplicate elements from a list or array?
There are several possible ways, depending on whether the array is
ordered and whether you wish to preserve the ordering.
a) If @in is sorted, and you want @out to be sorted: (this assumes all
true values in the array)
$prev = 'nonesuch';
@out = grep($_ ne $prev && ($prev = $_), @in);
This is nice in that it doesn't use much extra memory, simulating
uniq(1)'s behavior of removing only adjacent duplicates. It's less
nice in that it won't work with false values like undef, 0, or "";
"0 but true" is OK, though.
b) If you don't know whether @in is sorted:
undef %saw;
@out = grep(!$saw{$_}++, @in);
c) Like (b), but @in contains only small integers:
@out = grep(!$saw[$_]++, @in);
d) A way to do (b) without any loops or greps:
undef %saw;
@saw{@in} = ();
@out = sort keys %saw; # remove sort if undesired
e) Like (d), but @in contains only small positive integers:
undef @ary;
@ary[@in] = @in;
@out = grep {defined} @ary;
But perhaps you should have been using a hash all along, eh?
Here's a tip for you. Whenever you hear, especially if used in
conjunction with the notion of an array or list, any of the words
"in", "unique", "record", "node", "structure", "first", or "duplicate",
you should in a flurry of Pavlovian salivation, free-associate
immediately to
+------------------------------------------------+
| <DING, DING, DING> |
| <DING, DING, DING> <DING, DING, DING> |
| |
| A hash! I should be using a hash for this! |
| |
| <DING, DING, DING> <DING, DING, DING> |
| <DING, DING, DING> |
+------------------------------------------------+
--tom
------------------------------
Date: Tue, 12 Sep 2000 17:20:37 GMT
From: shollins@my-deja.com
Subject: Re: Eliminate Duplicates
Message-Id: <8ploka$uml$1@nnrp1.deja.com>
Thanks Tom for your sarcastic remarks. However since you mentioned it,
I did go to the FAQ page at www.perl.com and found your answer. I will
remember to go there first before I ask a SIMPLE question, since I
don’t know very much about Perl.
Thanks Anyway!
In article <39be4716@cs.colorado.edu>,
tchrist@perl.com (Tom Christiansen) wrote:
> In article <8plfci$ids$1@nnrp1.deja.com>, <shollins@my-deja.com>
wrote:
> >I am writing a perl program that will convert a
> >text file into a .dbf file. However, there are
> >duplicate fields in the text file. How can a
> >eliminate duplicates and only pull in unique
> >fields?
>
> Precisely what part of "man perlfaq | grep duplicate" don't you
> understand? Word to the would-be wise: Asking FAQs will just get
> you a lot of harrassment, because it's a way of telling the world
> that you are very lazy, but that you expect others to do all your
> work for you rather than doing the barest minimum of self-directed
> research.
>
> Using my new perlman tool (which will replace the embarrassingly
> stupid "perldoc" atrocity):
>
> % perlfaq duplicate
> perlfaq4 chunk 255
> How can I remove duplicate elements from a list or array?
>
> There are several possible ways, depending on whether the array
is
> ordered and whether you wish to preserve the ordering.
>
> a) If @in is sorted, and you want @out to be sorted: (this
assumes all
> true values in the array)
> $prev = 'nonesuch';
> @out = grep($_ ne $prev && ($prev = $_), @in);
>
> This is nice in that it doesn't use much extra memory,
simulating
> uniq(1)'s behavior of removing only adjacent duplicates.
It's less
> nice in that it won't work with false values like undef, 0,
or "";
> "0 but true" is OK, though.
>
> b) If you don't know whether @in is sorted:
> undef %saw;
> @out = grep(!$saw{$_}++, @in);
>
> c) Like (b), but @in contains only small integers:
> @out = grep(!$saw[$_]++, @in);
>
> d) A way to do (b) without any loops or greps:
> undef %saw;
> @saw{@in} = ();
> @out = sort keys %saw; # remove sort if undesired
>
> e) Like (d), but @in contains only small positive integers:
> undef @ary;
> @ary[@in] = @in;
> @out = grep {defined} @ary;
>
> But perhaps you should have been using a hash all along, eh?
>
> Here's a tip for you. Whenever you hear, especially if used in
> conjunction with the notion of an array or list, any of the words
> "in", "unique", "record", "node", "structure", "first",
or "duplicate",
> you should in a flurry of Pavlovian salivation, free-associate
> immediately to
>
> +------------------------------------------------+
> | <DING, DING, DING> |
> | <DING, DING, DING> <DING, DING, DING> |
> | |
> | A hash! I should be using a hash for this! |
> | |
> | <DING, DING, DING> <DING, DING, DING> |
> | <DING, DING, DING> |
> +------------------------------------------------+
>
> --tom
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 12 Sep 2000 17:04:12 +0100
From: Nick Condon <nickco3@yahoo.co.uk>
Subject: Re: Error message
Message-Id: <39BE53FC.6010C217@yahoo.co.uk>
Abel Almazan wrote:
> Hi,
>
> I use ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> gmtime(time);
but you haven't declared them. Try this:
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time);
Also, you don't need gmtime(time), that's the default value for gmtime:
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime;
------------------------------
Date: Tue, 12 Sep 2000 13:40:22 -0400
From: "Mike Mesarch" <mmesarch@wcom.net>
Subject: Get the MAC address from an IP
Message-Id: <8plpr6$ard$1@sshuraac-i-1.production.compuserve.com>
Is their a way to get a MAC address associated with an IP address?
-Mike
------------------------------
Date: Tue, 12 Sep 2000 13:06:51 -0400
From: "Alvaro Bahamondes V." <alvaro@arbol-logika.com>
Subject: hash arrays...
Message-Id: <39be62a6$1@dnewserver.firstcom.cl>
Hello all,
I need to create a big hash from a string, for example:
#this is the string and may be a big one (I can change the
#format of the string without a problem).
$r="1, a, 2, b, 3, c";
#and I create the hash like this:
%t = split(",",$r);
Is there a way to crate it without doing a "split" ? (I think a split can be
slow)
thanks in advance
Alvaro
------------------------------
Date: Tue, 12 Sep 2000 12:44:01 -0500
From: Scott Yanoff <yanoff@yahoo.com>
To: "Alvaro Bahamondes V." <alvaro@arbol-logika.com>
Subject: Re: hash arrays...
Message-Id: <39BE6B61.A800AC1D@yahoo.com>
"Alvaro Bahamondes V." wrote:
>
> Hello all,
>
> I need to create a big hash from a string, for example:
>
> #this is the string and may be a big one (I can change the
> #format of the string without a problem).
> $r="1, a, 2, b, 3, c";
> #and I create the hash like this:
> %t = split(",",$r);
Can't you just create a hash as follows:
%t = qw(1, a, 2, b, 3, c);
Good luck,
-Scott
------------------------------
Date: Tue, 12 Sep 2000 15:18:23 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How can i install Perl DBI module without the cc compiler
Message-Id: <3Prv5.15$3a.1960@news.dircon.co.uk>
On Tue, 12 Sep 2000 11:55:30 +0800, kam ho Wrote:
> hi all,
>
> i am now running a SCO-UNIX-5.0.5 open server and only get gcc compiler,
> once i want to install Perl DBI module, it generate the following error,
>
> cc -c -U M_XENIX -D PERL_SCO -D
> PERL_SCO5 -w0 -belf -I/usr/local/include -Od -DVERSION=\"1.13\" -DXS_VERS
> ION=\"1.13\" -Kpic -I/usr/local/lib/perl5/5.00503/i386-sco/CORE -DDBI_NO_THR
> EADS Perl.c
> make: cc: Command not found
> make: *** [Perl.o] Error 127
>
> i guess it is because i don't get the cc compiler, i want to ask how can i
> install the module with only gcc, can i do it by editing the Makefile? i
> have tried to edit Makefile by setting CC=gcc, but the following error
> message appears
>
> gcc: unrecognized option `-w0'
> gcc: unrecognized option `-Kpic'
> cpp: -lang-c: linker input file unused since linking not done
> gcc: installation problem, cannot exec `cc1': No such file or directory
> gcc: file path prefix `/usr/local/lib/gcc-lib/elf/2.95.1/' never used
> make: *** [Perl.o] Error 1
>
You will need to edit Config.pm appropriately and the run Makefile.PL to
recreate the Makefile - however you might find it better to completely
rebuild Perl from scratch using gcc as you are bound to find other problems.
/J\
------------------------------
Date: Tue, 12 Sep 2000 19:04:31 +0100
From: Andy Flisher <news@flish.co.uk>
Subject: Re: Incremental HTML output as script is running
Message-Id: <MPG.142880869191d76598968a@alt-news.gradwell.net>
On perusing <8pkord$skq1@intranews.bank.dresdner.net>,
Peter.Dintelmann@dresdner-bank.com was heard to mumble...
> The webserver may delay sending data to the client
> until the script finished.
Yeah, it is.
> I have seen a CGI::Push module (but not yet tried out
> myself) which might help you.
Cheers for the tip, I had a hunt today and managed to find a lot of
copies of the same syntax and usage doc (but unfortunately no live
examples :-( ) so I rigged it up, and again it works a treat offline, but
doen't appear to generate ANY valid browser output.
I tried using the header and start_html, alongside my normal practice of
printing the content type and body text by hand, but no browser output.
Offline it looks spot on with the full headers, http 200 response, and
nicely looping throught the push subroutine, but still no go on the
browser.
If there's anyone that can tell me which vital component I'm missing, or
better still a working source example I'd appreciate it.
Failing that it's the backup plan of execing the script in the background
and emailing the final status to the customer. Less pretty but
functionsl
--
Andy Flisher
'All postings are a reflection of my state of mind,
and not necessarily of any worthwhile opinion'
news@flish.co.uk http://www.flish.co.uk
------------------------------
Date: Tue, 12 Sep 2000 13:43:03 -0400
From: Gary <gapno@spamnb.net>
Subject: insert hyphen between variables
Message-Id: <39BE6B2A.AF7F2D6F@spamnb.net>
In a table that contains 3 columns, idnumber-state abbreviation-state
name:
I am trying to get a hyphen between the 2 variables on one side of the
hash.
i cant single quote or escape it to get it to work.
$sth->bind_columns(undef, \$sidnum, \$name, \$fname);
$numstates = 0;
while ($sth->fetchrow_arrayref)
{
$states{$sidnum} = ("$nameHYPHEN$fname"); OR $states{$sidnum} =
$nameHYPHEN$fname;
$numstates++;
}
Thanks for any help
------------------------------
Date: Tue, 12 Sep 2000 17:48:05 GMT
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: insert hyphen between variables
Message-Id: <p%tv5.621$Tn3.12985@news010.worldonline.dk>
Gary wrote:
> In a table that contains 3 columns, idnumber-state abbreviation-state
> name:
>
> I am trying to get a hyphen between the 2 variables on one side of the
> hash.
> i cant single quote or escape it to get it to work.
>
>
> $sth->bind_columns(undef, \$sidnum, \$name, \$fname);
>
> $numstates = 0;
> while ($sth->fetchrow_arrayref)
> {
> $states{$sidnum} = ("$nameHYPHEN$fname"); OR $states{$sidnum} =
> $nameHYPHEN$fname;
> $numstates++;
> }
>
> Thanks for any help
>
How about using the concatenation operator, . (dot)
-anders
--
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]
------------------------------
Date: Tue, 12 Sep 2000 13:52:10 -0400
From: Gary <gapno@spamnb.net>
Subject: Re: insert hyphen between variables
Message-Id: <39BE6D4E.54CF4700@spamnb.net>
This one seems to work, thanks Mr Lund
$states{$sidnum} = $name.'-'.$fname;
Anders Lund wrote:
>
>
> How about using the concatenation operator, . (dot)
>
> -anders
------------------------------
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 4297
**************************************