[17039] in Perl-Users-Digest
Perl-Users Digest, Issue: 4451 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 27 21:05:34 2000
Date: Wed, 27 Sep 2000 18:05:20 -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: <970103120-v9-i4451@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 27 Sep 2000 Volume: 9 Number: 4451
Today's topics:
Re: [IGNORE - OFF TOPIC] Re: Controlling line length re <godzilla@stomp.stomp.tokyo>
Re: [IGNORE - OFF TOPIC] Re: Controlling line length re <uri@sysarch.com>
Re: [Q] Perldoc on UNIX?? (Abigail)
Re: [Q] Perldoc on UNIX?? <rick.delaney@home.com>
Re: [Q] Perldoc on UNIX?? (Martien Verbruggen)
Re: accessing global variables in another perl module <nospam@david-steuber.com>
Re: accessing global variables in another perl module <elephant@squirrelgroup.com>
Re: ASAP: How $SCALAR = $LIST (Craig Berry)
Re: ASAP: How $SCALAR = $LIST <ren.maddox@tivoli.com>
Re: ASAP: How $SCALAR = $LIST (Abigail)
Re: ASAP: How $SCALAR = $LIST <elephant@squirrelgroup.com>
Re: ASAP: How $SCALAR = $LIST <elephant@squirrelgroup.com>
Re: Automatic Posting on Forms <muskrat@mindless.com>
Re: Bizarre problem with array ref in OO module <uri@sysarch.com>
Re: Bizarre problem with array ref in OO module <dbohling@newsfactor.com>
Re: Bizarre problem with array ref in OO module <uri@sysarch.com>
Re: Bizarre problem with array ref in OO module <ren.maddox@tivoli.com>
Re: Can't get opendir working in win32 <ren.maddox@tivoli.com>
Re: Can't get opendir working in win32 <elephant@squirrelgroup.com>
Re: Can't get opendir working in win32 <elephant@squirrelgroup.com>
Re: Date Conversion Question <godzilla@stomp.stomp.tokyo>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 27 Sep 2000 15:40:58 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: [IGNORE - OFF TOPIC] Re: Controlling line length read by <>
Message-Id: <39D2777A.5DB3A4D8@stomp.stomp.tokyo>
David Steuber wrote:
> "Godzilla! wrote:
> > Godzilla! wrote:
> > > David Steuber wrote:
> > > > "Godzilla!" <godzilla@stomp.stomp.tokyo> writes:
> ' Oh yes, have you noticed how often this poser's articles
> ' are double posted?
> Pardon my ignorance, but who are you talking about? It looks like you
> are talking about me, but that can't be true.
Truth does not need to packaged and sold. Truth is
self-evident. I have no interest in this type of debate.
My interest is in using and enjoying this newsgroup,
peacefully. So far, a majority of regulars here,
ranging from nobodys to well known authors, will
not allow me to use this group peacefully. Inherently
then, I have a real bad attitude about this newsgroup
and am extracting my pound of flesh, a gram at a time.
Although much better today due to my firm but fair
attitude, due to my aggressively assertive attitude,
there are still serious problems here with some
sociopathic people.
Over time, my family, myself, have been subjected
to constant harassment, stalking, vulgarity, bigotry,
racial slurs, attempts at deleting my articles from
this group, pseudo criminal behavior and outright
crime to a degree we needed to contact law enforcement
to assist us in bringing a halt to our being victimized
by crime perpetrated by regulars here. Are you clear
on this? We had to contact law enforcement due to crimes
perpetrated by regulars within this newsgroup. This is
absolutely idiotic, absolutely beyond belief. Still,
this is reality.
Even as recently as yesterday, a few well known regulars
attempted break-ins at one of my sites trying to get at
my android scripts.
These types of events only serve to strengthen my bad
attitude and, it is highly unlikely my bad attitude
about people here, will ever change. There are few,
if any reasons, to not treat a majority of people here
with contemptuous distain, deserved or not.
Nevertheless, I am not interested in pointless debates
on what is true and what is not. I am interested in
bringing a halt to this abhorrent abuse of which our
family is subjected, at the hands of people here, all
of which is well documented within archived articles.
So my attitude is everyone here is a sociopath or a
criminal, or both, until I personally can prove otherwise,
such as in the case of Mr. Rosler, Mr. Berry and a handful
of others, who are decent people. This attitude is contrary
to our American philosophy of innocent until proven guilty.
However, reality dictates I treat all of you as and, assume
all of you to be sociopathic criminals until shown otherwise.
Reality is a bitch much like myself.
I will not entertain this thread any further.
Kira
------------------------------
Date: Wed, 27 Sep 2000 22:56:34 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: [IGNORE - OFF TOPIC] Re: Controlling line length read by <>
Message-Id: <x766nh8mw1.fsf@home.sysarch.com>
>>>>> "G" == Godzilla! <godzilla@stomp.stomp.tokyo> writes:
G> My interest is in using and enjoying this newsgroup,
G> peacefully. So far, a majority of regulars here,
G> ranging from nobodys to well known authors, will
G> not allow me to use this group peacefully. Inherently
because you are an idiot and not wanted here by anyone. does it mean
anything to you that ALL of the regulars don't want you? oh, well, it
doesn't as you are off your meds. please take them.
G> Over time, my family, myself, have been subjected
G> to constant harassment, stalking, vulgarity, bigotry,
G> racial slurs, attempts at deleting my articles from
G> this group, pseudo criminal behavior and outright
G> crime to a degree we needed to contact law enforcement
G> to assist us in bringing a halt to our being victimized
G> by crime perpetrated by regulars here. Are you clear
G> on this? We had to contact law enforcement due to crimes
G> perpetrated by regulars within this newsgroup. This is
G> absolutely idiotic, absolutely beyond belief. Still,
G> this is reality.
again with this shit. no one here cares about you or your family. we
just want you to leanr python and go bother them.
G> I will not entertain this thread any further.
so go away already. how many times do you have to be told?
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 27 Sep 2000 22:55:57 GMT
From: abigail@foad.org (Abigail)
Subject: Re: [Q] Perldoc on UNIX??
Message-Id: <slrn8t4ulf.lo9.abigail@alexandra.foad.org>
Joe Edgar (jedgar@mail.arc.nasa.gov) wrote on MMDLXXXIV September
MCMXCIII in <URL:news:8qtee5$7c1$1@sun500.nas.nasa.gov>:
|| This is pretty bad I know, but here's the question. How do I use the
|| perldoc command on a UNIX (solaris) system. I know in windows you just go
|| to the perl directory and type perldoc *, but for UNIX do I have to set the
|| "PATH=" variable to something? I'm a Newbie, so be gentle ;-)
Maybe; that depends on your shell. Most shells honour the PATH variable.
But that's not the only way. It is, however, not a Perl issue; you would
do the same if you want to execute any other program.
Perhaps you should consult a Unix newsgroup.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
------------------------------
Date: Wed, 27 Sep 2000 23:44:29 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: [Q] Perldoc on UNIX??
Message-Id: <39D28912.7F53A424@home.com>
[posted & mailed]
Joe Edgar wrote:
>
> I know the perldoc command will always look in the path variable, but where
> would that perldoc 'library' be?
You've already received Unix answers, which is good since this won't
always work. But here is a perl answer:
perl -V:scriptdir
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Wed, 27 Sep 2000 23:45:33 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: [Q] Perldoc on UNIX??
Message-Id: <slrn8t51kq.64u.mgjv@verbruggen.comdyn.com.au>
On Wed, 27 Sep 2000 11:32:13 -0700,
Joe Edgar <jedgar@mail.arc.nasa.gov> wrote:
> This is pretty bad I know, but here's the question. How do I use the
> perldoc command on a UNIX (solaris) system. I know in windows you just go
> to the perl directory and type perldoc *, but for UNIX do I have to set the
> "PATH=" variable to something? I'm a Newbie, so be gentle ;-)
Yes, you need to make sure that perldoc can be found by your shell,
normally by including the directory where it lives in your path.
However, you will have to ask your system administrator to tell you
where that is. Most likely places are /usr/local/bin, /usr/bin and
/opt/perl/bin
If they didn't install it, tell them that I said that their perl
installation is broken, and should be fixed.
Martien
--
Martien Verbruggen |
Interactive Media Division | Hi, John here, what's the root
Commercial Dynamics Pty. Ltd. | password?
NSW, Australia |
------------------------------
Date: Wed, 27 Sep 2000 22:55:26 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: accessing global variables in another perl module
Message-Id: <m31yy5fns2.fsf@solo.david-steuber.com>
use package?
--
David Steuber | Perl apprentice, Apache/mod_perl user, and
NRA Member | general Internet web wannabe.
ICQ# 91465842 (Using Micq 0.4.6 under Linux)
It's time to be free: http://www.harrybrowne2000.org
------------------------------
Date: Thu, 28 Sep 2000 10:20:21 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: accessing global variables in another perl module
Message-Id: <MPG.143d39cfa7b3279d9897d2@localhost>
jason iversen wrote ..
>i am having trouble with accessing a global variable defined in main()
>in a second perl module.
>
>i need the following...
>
> A.pl creates and sets global variable $D, then calls a sub in B.pm
> B.pm accesses $D (perhaps modifying it)
>
>
>how do i do it? i cant figure it out. i have tried "use vars qw($D)" in
>B.pm, but that doesnt work. i have tried using Exporter and have had no
>luck.
you're thinking the wrong way around .. if the variable is defined in
A.pl and A.pl includes B.pm (through a 'use', 'require', 'do' or 'eval')
then the variables in B.pm are available to A.pl *NOT* the other way
around
you should pass $D into the sub call you make to B.pm .. and if you want
to be able to modify the value of $D then you need to pass a reference
to it into the B.pm call .. for EYEWTK about references see the perlref
section of the documentation
perldoc perlref
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 27 Sep 2000 22:51:51 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: ASAP: How $SCALAR = $LIST
Message-Id: <st4ug7g6rup1b3@corp.supernews.com>
Don Vaillancourt (donv@webimpact.com) wrote:
: How to I get the number of elements in a list that is only accessible
: through a reference from a scalar.
[snip]
#!/usr/bin/perl -w
# holsize - demo of obtaining element count in a list inside a ref'd hash.
# Craig Berry (20000927)
use strict;
my $href = {
foo => [ qw(a b c d e) ],
bar => [ qw(x y z) ]
};
print 'Elements in $href->{foo} : ', scalar @{$href->{foo}}, "\n";
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Quidquid latine dictum sit, altum viditur."
|
------------------------------
Date: 27 Sep 2000 16:17:39 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: ASAP: How $SCALAR = $LIST
Message-Id: <m3u2b1pma4.fsf@dhcp11-177.support.tivoli.com>
dougw <dougw@cnation.com> writes:
> Don Vaillancourt wrote:
> >
> > How to I get the number of elements in a list that is only accessible
> > through a reference from a scalar.
> >
> The easiest way I can think of is scalar( @{ $properties=>{'columns'} }
> )
Make that:
scalar @{ $properties->{columns} }
(Note that the "=>" typo in the original does *not* work.)
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 27 Sep 2000 23:57:52 GMT
From: abigail@foad.org (Abigail)
Subject: Re: ASAP: How $SCALAR = $LIST
Message-Id: <slrn8t529i.lo9.abigail@alexandra.foad.org>
Don Vaillancourt (donv@webimpact.com) wrote on MMDLXXXIV September
MCMXCIII in <URL:news:39D259DC.7DE580A8@webimpact.com>:
~~ How to I get the number of elements in a list that is only accessible
~~ through a reference from a scalar.
$#{EXPRESSION YIELDING A REFERENCE TO AN ARRAY}
Abigail
--
perl -wlpe '}{*_=*.}{' file # Count the number of lines.
# A pair of flying
# flies. The Scarlet Pimpernel
# weeping near the beach.
------------------------------
Date: Thu, 28 Sep 2000 11:00:56 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: ASAP: How $SCALAR = $LIST
Message-Id: <MPG.143d434f6a4c0ba79897d4@localhost>
amonotod wrote ..
>In article <39D259DC.7DE580A8@webimpact.com>,
> Don Vaillancourt <donv@webimpact.com> wrote:
>> How to I get the number of elements in a list that is only accessible
>> through a reference from a scalar.
>>
>> I have the following of code:
>>
>> $properties->{columns}=[];
>> $columns=$properties->{columns};
>>
>> $columns->[0]={"name" => "delete",
>> "type" => $NUMBER,
>> "size" => 1,
>> "unique" => $FALSE,
>> "primary_key" => $FALSE,
>> "required" => $TRUE,
>> "allow_null" => $FALSE};
>>
>> How do I find how many elements the list pointed to by
>> $properties->{columns} contains.
>
>You already have... $columns is a scalar value of the number of fields
>in $properties->{columns}, and @columns is an array (with a hash as the
>first field).
look again amonotod .. $properties->{columns} contains a reference to an
empty list .. which is also what $columns contains
>Try :
>print $columns ,"\n";
I think you should try this .. you might see the error of your ways ;)
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Thu, 28 Sep 2000 11:14:19 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: ASAP: How $SCALAR = $LIST
Message-Id: <MPG.143d4673c8e918df9897d6@localhost>
Abigail wrote ..
>Don Vaillancourt (donv@webimpact.com) wrote on MMDLXXXIV September
>MCMXCIII in <URL:news:39D259DC.7DE580A8@webimpact.com>:
>~~ How to I get the number of elements in a list that is only accessible
>~~ through a reference from a scalar.
>
> $#{EXPRESSION YIELDING A REFERENCE TO AN ARRAY}
ahem .. plus one
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Thu, 28 Sep 2000 00:40:32 GMT
From: "Matthew Musgrove" <muskrat@mindless.com>
Subject: Re: Automatic Posting on Forms
Message-Id: <4swA5.4995$H65.10643@typhoon.kc.rr.com>
"Jordan Zommick" <zommick@yahoo.com> wrote in message
news:st45dg1cqug96d@corp.supernews.com...
> I've got an interesting problem that I need help with. I have an
> internal web page form that has a single text box and then the
> text is submitted by the user clicking on the submit button.
> Problem is that I've got to do this manually about 10000 times
> (I've got to enter 10000 names). Does anyone have an idea how I
> can do this automatically via javascript, perl, etc?.. I've been
> told that I can't change the cgi scripts that are called when
> the form is submitted; however, I can change the html page
> itself and add my own scripts.
<form name="NameSubmit" action="path/to/cgi/script" method="POST">
Name: <input type=text size=30 name="name" onblur="this.form.submit()">
</form>
--
Matthew Musgrove
muskrat@mindless.com
http://free.prohosting.com/~musgrove/
------------------------------
Date: Wed, 27 Sep 2000 22:25:14 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Bizarre problem with array ref in OO module
Message-Id: <x7g0ml8oc5.fsf@home.sysarch.com>
>>>>> "DB" == Daniel Bohling <dbohling@newsfactor.com> writes:
DB> while (my $ref = $sth->fetchrow_hashref) {
DB> foreach ( @{ $self->{'rtime'} }, @{ $self->{'rrel'} } ) {
DB> ---- ^^^^first half of list uses correct values,
DB> ---- second half is HASH((0x827.....)
DB> The output from Data::Dumper is what is expected...both items are
DB> anonymous arrays of integers. These are built from the keys of
DB> %$results which which is a my'ed $results = $self->{'results'}.
you dumped the parts of $self. i mean dump $self in the loop above. use
the debugger if you don't want to wade through dump traces. you cay you
see a hash ref but i don't see one here. you may be doing something to
clobber the 'rrel' element later. i bet you are assigning to
$self->{'rrel'} a hash ref and not realizing it clobbers the array ref
you had in there. it is a common mistake. so look for all occurances of
'rrel' and see how you use it. and dump at the point of the error, not
where you build the data.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 27 Sep 2000 19:02:31 -0400
From: Daniel Bohling <dbohling@newsfactor.com>
Subject: Re: Bizarre problem with array ref in OO module
Message-Id: <970096049.447244875@isp-east.usenetserver.com>
>you dumped the parts of $self. i mean dump $self in the loop above. use
>the debugger if you don't want to wade through dump traces. you cay you
>see a hash ref but i don't see one here. you may be doing something to
>clobber the 'rrel' element later. i bet you are assigning to
>$self->{'rrel'} a hash ref and not realizing it clobbers the array ref
>you had in there. it is a common mistake. so look for all occurances of
You're right I sure was assigning it....
while ($ref = $sth->fetchrow_hashref) {
foreach ( @{ $self->{'rtime'} }, @{ $self->{'rrel'} } ) {
#print TEMP "Checking $_...\n";
---> if ($_ = $ref->{id}) { !!!!!!!!!!!!!!!!right here
$_ = $ref;
#print "Yes\n";
}
}
}
Should read if ($_ == $ref->{id}) {
God I need some sleep. And to think I was about to put 'BUG' in the subject.!
Thanks gobs for your help uri. Sorry 'bout the lame problem. Take care.
>'rrel' and see how you use it. and dump at the point of the error, not
>where you build the data.
--
Daniel Bohling
------------------------------
Date: Wed, 27 Sep 2000 23:21:24 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Bizarre problem with array ref in OO module
Message-Id: <x7zokt7762.fsf@home.sysarch.com>
>>>>> "DB" == Daniel Bohling <dbohling@newsfactor.com> writes:
DB> You're right I sure was assigning it....
i just used PSI::ESP to figure it out.
DB> while ($ref = $sth->fetchrow_hashref) {
DB> foreach ( @{ $self->{'rtime'} }, @{ $self->{'rrel'} } ) {
DB> #print TEMP "Checking $_...\n";
---> if ($_ = $ref->{id}) { !!!!!!!!!!!!!!!!right here
DB> $_ = $ref;
oof. overwriting the loop element is ugly IMO. very prone to bugs. i
mean the line above and not the buggy one. also you should be more
consistant in quoting your hash keys. id is not quoted whereas rtime and
rrel are quoted. i favor quoting fixed keys even though it is not
required (if you use a key that is a builtin, you can collide).
DB> Thanks gobs for your help uri. Sorry 'bout the lame problem. Take care.
you're welcome.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 27 Sep 2000 16:09:30 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Bizarre problem with array ref in OO module
Message-Id: <m3wvfxpmnp.fsf@dhcp11-177.support.tivoli.com>
Daniel Bohling <dbohling@newsfactor.com> writes:
> I'm working on a OO module that provides search functions for our website. It
> builds a pair of arrays stored in $self->{'rtime'} and $self->{'rrel'}.
> I've included the relevant code at bottom.
>
> I'm getting bizarre problems when i copy these arrays into another and
> then joining the subsequent array into a concatenated string.
>
> my @idz = (@{$self->{'rrel'}}, @{$self->{'rtime'}});
> print join "\n", @idz; <------works correctly on 34 members
> $statement = "
> SELECT title,id,body
> FROM autostories WHERE id IN ("
> . join ",", @idz .
> ")";
> print "$statement\n";<------doesnt work, prints length "...id IN (34)"
The "." operator is binding tighter than you expect, which puts @idz
in scalar context, which causes it to return its length. Add
parentheses to the join().
>
> And more problems when attempting to subscript them via:
>
> foreach ( @{ $self->{'rtime'} }, @{ $self->{'rrel'} } ) { }
>
> works correctly for the first item, doesn't dereference the second
Not sure why this would be -- probably has something to do with what
is inside the loop.
Oh... more code down here... let's see....
[snip]
> $statement = "
> SELECT title,id,body
> FROM autostories WHERE id IN ("
> . join ",", @idz . ")
. join(",", @idz) . ")
> ";
> print "$statement\n";
> ---- ^^^^print the length of the array "...id IN (34)..."
> ---- wrong, but worked fine by itself above
> my $sth = $dbh->prepare($statement);
> $sth->execute;
>
> while (my $ref = $sth->fetchrow_hashref) {
> foreach ( @{ $self->{'rtime'} }, @{ $self->{'rrel'} } ) {
> ---- ^^^^first half of list uses correct values,
> ---- second half is HASH((0x827.....)
You aren't printing within this loop, so how do you know this?
> if ($_ = $ref->{id}) {
Well, you've got an assignment in the conditional of an if statement
here that doesn't make much sense. Do you mean "==" or "eq"?
> $_ = $ref;
I don't see how it could be changing the second half, but you are
certainly changing the elements as you loop over them.
[rest of code omitted]
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 27 Sep 2000 17:43:40 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Can't get opendir working in win32
Message-Id: <m3lmwdpiar.fsf@dhcp11-177.support.tivoli.com>
"James" <jluongo@SPAMISBADmediaone.net> writes:
[snip]
> "Bad symbol for filehandle at renamer.pl line 8, <STDIN> line 1."
> Here, is my script. What is going on? I am confused
>
> use strict;
>
> print "Which directory?\n";
> my ($dir);
> $dir = <STDIN>;
> chomp ($dir);
> opendir (DIR, $dir) || die "Cannot open $dir:$!\n";
> my @files = readdir($dir);
This should be:
my @files = readdir(DIR);
The error message is actually quite explicit, and pointed to the
correct line and everything.
> print "@files\n";
>
> please respond to me directly, its hard to spot a specific message in the
> newsgroup
Sorry... it's not *that* hard... you even gave a sensible subject to
make it easier.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Thu, 28 Sep 2000 10:39:14 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: Can't get opendir working in win32
Message-Id: <MPG.143d3e3a86283ff9897d3@localhost>
James wrote ..
>This is the beginning of a script I am writing that will change filenames to
>a different format. I am testing now. But I can't even open a directory
>with opendir. I try to open a directory and then get all the files and
>store them in an array.
>
>The script asks for a directory to be input. I input, for example,
>"D:\downloads" and then perl says:
>"Bad symbol for filehandle at renamer.pl line 8, <STDIN> line 1."
the error message tells you everything you need to know .. some problem
with a filehandle on line 8
>Here, is my script. What is going on? I am confused
>
>use strict;
>
>print "Which directory?\n";
>my ($dir);
>$dir = <STDIN>;
>chomp ($dir);
>opendir (DIR, $dir) || die "Cannot open $dir:$!\n";
>my @files = readdir($dir);
boink .. above is line 8 of your script .. where's the only place in the
above line that perl could think you're using a filehandle ? (hint:
check the documentation for readdir)
then - re-read the error message .. "Bad symbol for filehandle" .. so
perl thinks that there's something wrong with the filehandle that you've
used .. connecting the dots left as an exercise for the reader
<OT>
>X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
-
>please respond to me directly, its hard to spot a specific message in the
>newsgroup
then get a better newsreader .. Outlook Express is rubbish .. might I
recommend Gravity .. http://www.microplanet.com/
</OT>
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Thu, 28 Sep 2000 11:05:27 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: Can't get opendir working in win32
Message-Id: <MPG.143d445e953849df9897d5@localhost>
amonotod wrote ..
>In article <mxsA5.29085$pu4.2977039@typhoon.ne.mediaone.net>,
> "James" <jluongo@SPAMISBADmediaone.net> wrote:
>> This is the beginning of a script I am writing that will change
>> filenames to a different format. I am testing now. But I can't even
>> open a directory with opendir. I try to open a directory and then get
>> all the files and store them in an array.
>>
>> The script asks for a directory to be input. I input, for example,
>> "D:\downloads" and then perl says:
>> "Bad symbol for filehandle at renamer.pl line 8, <STDIN> line 1."
>> Here, is my script. What is going on? I am confused
-
>Try using "D:/downloads" as your input. Since perl has already loaded,
>it is not necessary to use MS format on your directory statements.
why should a windows user input a different file separator character
when Perl under Win32 works perfectly well with either ? .. you're
possibly getting confused with when you define literals in your code ..
it's usually better to use forward slashes then because of the special
function of the backslash as an escape character
>> use strict;
>>
>> print "Which directory?\n";
>> my ($dir);
>> $dir = <STDIN>;
-
>You could also change this to
>$dir = $ARGV[0] || "D:/downloads ";
no they couldn't .. that would have different behaviour .. the
originator's code reads the directory from STDIN .. whereas yours reads
it from the command line parameters
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 27 Sep 2000 16:59:52 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Date Conversion Question
Message-Id: <39D289F8.6CC67471@stomp.stomp.tokyo>
Larry Rosler wrote:
> Godzilla! wrote:
> > eT wrote:
(snippage)
> Why does '11', for example, want to become '011'?
> You and Iain Chalmers:
> IC> Note 2: if the sybase date hours *aren't* in 24hr format(which the
> IC> AM at the end suggests), add the line
> IC> $hour+=12 if (substr($frac_sec,-2) eq 'PM');
> IC> between the split and the sprintf lines...
> have each overlooked a critical step in converting from 12-hour to 24-
> hour time notation:
We most certainly have! Check it out Mr. Rosler! My code
is buggy as a flea bitten camel! I will work on this but
first I want to figure out this other problem I mentioned.
I am able to replicate what you pointed out, no problem.
Darn if I can get this other bug to show up, regarding
my double zero versus single zero mentioned last article.
Thank you Mr. Rosler. You are right on target with this!
This time, in the body of my message:
Boss, your input is:
Apr 1 1991 11:00:00:000PM
Mar 15 44BC 10:00:00:000PM
Aug 6 1945 11:10:10:000PM
Aug 9 1945 12:03:23:000AM
Aug 8 1972 11:24:00:000PM
Boss, my output is:
1991-04-01 11:00:00
44BC-03-15 10:00:00
1945-08-06 23:10:10
1945-08-09 012:03:23 <--- there
1972-08-08 23:24:00
###
Boss, your input is:
Apr 1 1991 11:00:00:000AM
Mar 15 44BC 10:00:00:000AM
Aug 6 1945 11:10:10:000AM
Aug 9 1945 12:03:23:000AM
Aug 8 1972 11:24:00:000AM
Boss, my output is:
1991-04-01 11:00:00
44BC-03-15 10:00:00
1945-08-06 011:10:10 <--- all
1945-08-09 012:03:23 <--- three
1972-08-08 011:24:00 <--- here
*smiles*
Kira
------------------------------
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 4451
**************************************