[10566] in Perl-Users-Digest
Perl-Users Digest, Issue: 4158 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 5 13:08:38 1998
Date: Thu, 5 Nov 98 10:01:43 -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, 5 Nov 1998 Volume: 8 Number: 4158
Today's topics:
OO Question (Lee Mulleady)
Re: OO Question <tchrist@mox.perl.com>
Re: Pattern matching droby@copyright.com
Re: Pattern matching (clay irving)
Re: PC parallel to Solaris serial <philh@asptech.com>
PERL -> SQL -> Procedure ->PERL -> HTML (John Hardy)
Re: PERL -> SQL -> Procedure ->PERL -> HTML (John Hardy)
Re: Perl Programming Workshop (clay irving)
Re: perl questions PLEASE HELP ASAP! <J.D.Gilbey@qmw.ac.uk>
perl source browser <M.Sillence@ftel.co.uk>
Re: perl source browser <aichner@ecf.teradyne.com>
Re: Perl string manipulation (Joergen W. Lang)
Re: perl&cgi question <kjetil@balder.no>
Re: perl&cgi question <kjetil@balder.no>
Re: perl&cgi question droby@copyright.com
Re: perl&cgi question <rootbeer@teleport.com>
Re: pointer question (Joergen W. Lang)
Re: pointer question (Larry Wall)
Printing in NT <glauber@iws-irms.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 5 Nov 1998 14:03:30 GMT
From: lemull@unx.sas.com (Lee Mulleady)
Subject: OO Question
Message-Id: <3641ad4c.1386422484@newshost.unx.sas.com>
A simple OO question:
With the following code,
package MyClass;
sub new {
my $this = {};
bless $this;
$this->{'myvar'} = "somevalue";
return $this;
}
sub DESTROY {
print "myvar = ???? \n";
}
If I wanted to reference "myvar" in some external code I would use the
following syntax:
use MyClass;
$q = new MyClass;
print "myvar = $q->{'myvar'}\n";
but, how can I reference the instance variable "myvar" (for this
instance) in the DESTROY method of this class?
Thanks for any help,
-Lee
lemull@wnt.sas.com
------------------------------
Date: 5 Nov 1998 14:40:29 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: OO Question
Message-Id: <71sdct$6bp$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, lemull@unx.sas.com writes:
:If I wanted to reference "myvar" in some external code I would use the
:following syntax:
:
:use MyClass;
:$q = new MyClass;
:print "myvar = $q->{'myvar'}\n";
Oh my! Why are you having something outside the class poke at its
private bits? That's wicked.
You need accessor methods:
sub myvar {
my $self = shift;
$self->{'myvar'} = shift if @_;
return $self->{'myvar'};
}
:but, how can I reference the instance variable "myvar" (for this
:instance) in the DESTROY method of this class?
DESTROY is a method, and has its self reference sitting there
at the front of @_ waiting for you to snag, as I did above.
--tom
--
The secretaries don't understand me. --Rob Pike
------------------------------
Date: Thu, 05 Nov 1998 15:43:15 GMT
From: droby@copyright.com
Subject: Re: Pattern matching
Message-Id: <71sh2j$djs$1@nnrp1.dejanews.com>
In article <uMcCseGC#GA.255@upnetnews02.moswest.msn.net>,
"Jeff Lovell" <jalovel@email.msn.com> wrote:
> I hate to sound stupid here, but is this how you answer all questions on
> this newsgroup Tom? I probably shouldn't have asked, you will tell me to
> read the FAQ or RTFM.
>
> Thanks.
>
> Jeff
>
Perhaps you should read the fine meta-FAQ at
ftp://rtfm.mit.edu/pub/usenet-by-hierarchy/news/newusers/questions/FAQs_about
_FAQs
--
Don Roby
droby@copyright.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 5 Nov 1998 11:45:04 -0500
From: clay@panix.com (clay irving)
Subject: Re: Pattern matching
Message-Id: <71skmg$m20@panix.com>
In <364091e8.549241667@news.theplanet.net> alan@ciborg.demon.co.uk writes:
>Help!
>I am trying to split a .csv file which uses a <,> for a delimiter.
>As some of the fields contain a <,> these fields are quoted using <">
>so what I want to do is split each value except those included in
>double quotes, I have tried:
>($Id, $SizeSQ, $SizeSM, $AnnualRent, $RentSQ, $Comments,
>$Address,$Agent, $Duplicate)=split(/([^".*?"]|,)/,$_);
>I am sure I am making a stupid mistake, but any help would be
>appeciated.
Perl Modules are your friend. You can do something like this with the
Text::CSV module:
#!/usr/local/bin/perl -w
use Text::CSV;
my $file = "foo.csv";
$csv = Text::CSV->new();
open FILE, "$file" or die "Can't open $file: $!\n";
while (defined ($line = <FILE>)) {
chomp $line;
$status = $csv->parse($line);
($Id, $SizeSQ, $SizeSM, $AnnualRent, $RentSQ, $Comments, $Address,$Agent, $Duplicate) = $csv->fields();
}
--
Clay Irving
clay@panix.com
------------------------------
Date: Thu, 05 Nov 1998 09:11:43 -0800
From: Phil Hutchinson <philh@asptech.com>
Subject: Re: PC parallel to Solaris serial
Message-Id: <3641DC4F.1C61@asptech.com>
eric.wai@bcs.org.uk wrote:
>
> Hi,
SNIP
>
> As expected, "hello world" is captured by my program. However, the PC keeps
> sending the newline character (ascii 10) to the SUN. If I keep the set
> up/program running, my SUN will end up crashed with error message
> "output_echo_char: out of blocks" appears on the console.
>
> Can anyone tell me why the PC keeps sending out the newline character after
> "hello world", and how could I stop it.
>
> Thanks in advance.
>
> Eric.
Eric,
Is the PC parallel port (and underlying driver code) prompting for or
some
kind of printer status information or perhaps responding to something
that
the serial/parallel converter is putting on the parallel side of the
connection? Protocol analyzer time.
--
=================================================================
Phil
------------------------------
Date: Thu, 05 Nov 1998 16:06:23 GMT
From: jhardy@cins.com (John Hardy)
Subject: PERL -> SQL -> Procedure ->PERL -> HTML
Message-Id: <32k02.22$_i2.44842@198.235.216.4>
Can anyone point me in the right direction to find Documents, FAQ's, or GOOD
EASY examples dealing with WIN32::OLE to communicate with MsSql.
I have searched everywhere I can think of, I have read all the PERL FAQ's I
could find, including the ODBC FAQ's and whatever OLE FAQ's that are out there.
I do not want to use DBI - DBD
I have found many examples using OLE with Excel, Acces and Word but not one
good example for MsSQL. I just started using SQL so I need something that any
idiot could understand. I have been to several Computer book stores and cannot
find anything directly related to the subject. Of course there is nothing
related to PERL in the MsSQL online books.
What I am trying to do is really quite simple but I have been trying to figure
it out for so long I think I have developed some kind of Mental block !!!
any help would be extremely appreciated.
Tom , you seem to know where all documentation sit's, you must know where I can
find some on this subject. :-)
Thanks
------------------------------
Date: Thu, 05 Nov 1998 16:12:49 GMT
From: jhardy@cins.com (John Hardy)
Subject: Re: PERL -> SQL -> Procedure ->PERL -> HTML
Message-Id: <58k02.24$_i2.44842@198.235.216.4>
Forgot to mention I am running on IIS 4.0 and WINNT Server 4
ActiveState 5.005_02 build 504
In article <32k02.22$_i2.44842@198.235.216.4>, jhardy@cins.com says...
>
>
>Can anyone point me in the right direction to find Documents, FAQ's, or GOOD
>EASY examples dealing with WIN32::OLE to communicate with MsSql.
>
>I have searched everywhere I can think of, I have read all the PERL FAQ's I
>could find, including the ODBC FAQ's and whatever OLE FAQ's that are out
there.
>
>I do not want to use DBI - DBD
>
>I have found many examples using OLE with Excel, Acces and Word but not one
>good example for MsSQL. I just started using SQL so I need something that any
>idiot could understand. I have been to several Computer book stores and cannot
>find anything directly related to the subject. Of course there is nothing
>related to PERL in the MsSQL online books.
>
>What I am trying to do is really quite simple but I have been trying to figure
>it out for so long I think I have developed some kind of Mental block !!!
>
>any help would be extremely appreciated.
>
>
>Tom , you seem to know where all documentation sit's, you must know where I
can
>find some on this subject. :-)
>
>
>Thanks
>
------------------------------
Date: 5 Nov 1998 10:35:27 -0500
From: clay@panix.com (clay irving)
Subject: Re: Perl Programming Workshop
Message-Id: <71sgjv$edk@panix.com>
In <01be0805$018e3c30$cf98c9d0@debhome> "Deborah Murray" <dmurray@dgesolutions.com> writes:
>UniForum Technology Training Institute Presents:
>Accelerated Perl Workshop
>January 28-29, 1999
>San Jose, CA
>Space is limited to 15 attendees.
>For more information, call 1-800-333-8649 or visit the Web @
>www.uniforum.org/web/education/perlworkshop.html
Er, I think you meant:
http://www.uniforum.org/web/education/PerlWorkshop.html
--
Clay Irving
clay@panix.com
------------------------------
Date: Thu, 05 Nov 1998 16:32:59 +0000
From: Julian Gilbey <J.D.Gilbey@qmw.ac.uk>
Subject: Re: perl questions PLEASE HELP ASAP!
Message-Id: <3641D33B.33CBD260@qmw.ac.uk>
jcl wrote:
>
> Hey everyone,
> I do not like to go to newsgroups for my programming problems, but
> this has to be done my tomorow afternoon, and i don't know what else
> to do. The program has to simulte the part of a network layer and i
> have most of it done with two main problems.
>
> 1)
> I need to search in a string for five ones, and if so replace it
> with a five ones and a zero i.e.
>
> 11111 would become 111110
>
> and 111111011111101110111111 would become :
> 111110101111101011101111101
> and so on,
> i tried using : s/11111/111110/ and with the g option, but the
> program just waits or freezes, it can't tell but ctrl+c stops it. It
> works as s/1111/11110/ and s/111111/1111101/ but not the way i need it
> to.
s/11111/111110/g; should work fine.
> 2)
> I also would like to know away, to thorw away the current input.
> What i mean is, i'm reading from stdio, and i sometime just wan't to
> toss the current string and read the next one, there's probably a real
> simple way to do this, but i don't know, (BTW i'm using a while to get
> data from stdio).
You could use the continue command.
HTH,
Julian
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Julian Gilbey Email: J.D.Gilbey@qmw.ac.uk
Dept of Mathematical Sciences, Queen Mary & Westfield College,
Mile End Road, London E1 4NS, ENGLAND
-*- Finger jdg@goedel.maths.qmw.ac.uk for my PGP public key. -*-
------------------------------
Date: Thu, 05 Nov 1998 14:07:58 +0000
From: Martin Sillence <M.Sillence@ftel.co.uk>
Subject: perl source browser
Message-Id: <3641B13E.385D9368@ftel.co.uk>
Hi,
Is there any perl source browser such as global is to C.
Preferably able to show the object tree and calls.
Or in fact any automatic documentation tools.
Thanks,
Martin
------------------------------
Date: 05 Nov 1998 15:33:06 +0100
From: Adrian Aichner <aichner@ecf.teradyne.com>
Subject: Re: perl source browser
Message-Id: <uu30eus4c.fsf@ecf.teradyne.com>
>>>>> "Martin" == Martin Sillence <M.Sillence@ftel.co.uk> writes:
Martin> Hi, Is there any perl source browser such as global is to
Martin> C. Preferably able to show the object tree and calls. Or
I don't know of one.
Martin> in fact any automatic documentation tools.
See
perldoc perlpod
for a way to embed documentation in perl scripts (or modules).
A short quote from the perlpod documentation:
Translators exist for pod2man (that's for nroff(1) and troff(1)),
pod2html, pod2latex, and pod2fm.
Regards,
Adrian
Martin> Thanks, Martin
--
Adrian Aichner
Applications Engineer
Teradyne GmbH
Semiconductor Test Group Telephone +49/89/41861(0)-208
Dingolfinger Strasse 2 Fax +49/89/41861-217
D-81673 MUENCHEN E-mail adrian.aichner@teradyne.com
------------------------------
Date: Thu, 5 Nov 1998 16:16:23 +0100
From: jwl@_munged_worldmusic.de (Joergen W. Lang)
Subject: Re: Perl string manipulation
Message-Id: <1di0zjr.1st5dzk1u7m6g5N@host010-210.seicom.net>
J Barlow <Jim_Barlow@bc.sympatico.ca> wrote:
> Is there any site that explains this very well? i.e. all of the various
> syntax and what it does. I can understand the simple expressions eg. $x =~
> s/blah//i; but not the more complex things...
>
> Thanks
If you do not have the Perl Documentation (which seems very strange,
since it usually comes together with your perl) you can look it up on
the Perl Website.
Try:
http://www.perl.com/CPAN-local/doc/manual/html/pod/perltoc.html
...as a starting point and look for "regular expression"(s) and the
"perlre" page.
hth,
Joergen
--
To reply by email please remove _munged_ from address Thanks !
-------------------------------------------------------------------
"Everything is possible - even sometimes the impossible"
HOELDERLIN EXPRESS - "Touch the void"
------------------------------
Date: Thu, 05 Nov 1998 15:25:50 +0100
From: Kjetil Svendsberget <kjetil@balder.no>
Subject: Re: perl&cgi question
Message-Id: <3641B56E.282C8E66@balder.no>
Sam Holden wrote:
>
> On Thu, 05 Nov 1998 07:38:29 GMT, jbharvey@auspex.net <jbharvey@auspex.net>
> wrote:
> >Then how do you explain it working in Netscape and not IE?
>
> Because IE is set up wrong...
>
> However, IEs set up can not decide whether a server runs a script or outputs
> a program. The original post implied that the server was not running the
> CGI script, but returning the text. That is a server thing not a browser
> thing.
I did not imply that did i? I said that on the same machine the script
displays correctly in Netscape, but on the IE it insist on downloading
it. How can this be a server problem?
------------------------------
Date: Thu, 05 Nov 1998 15:28:45 +0100
From: Kjetil Svendsberget <kjetil@balder.no>
Subject: Re: perl&cgi question
Message-Id: <3641B61D.6DE9B9D8@balder.no>
Sam Holden wrote:
>
> On Thu, 05 Nov 1998 02:14:32 GMT, jbharvey@auspex.net <jbharvey@auspex.net>
> wrote:
> >No, it is NOT a server thing, his browser has to understand how to interpret
> >what type of document he has and what to do with it. You have to change the
> >pl associate or MIME: application/x-perl to run it within the browser and not
> >to save it as a file. One of his browsers, I can't remember which is doing
> >this fine, he needs to do it on the other one.
>
> You are completely wrong here. By definition a CGI program does not
> run in the browser, but on the server. Since the server couldn't care less
> about the browser's MIME setup changing it won't help...
So explain this: At first the script insisted on dowloading on all
browsers
on that perticular machine. (all other machines displays it)
I then removed the .pl assosiacations within the windows-explorer
(view->options
->file types). Now it suddenly works in Netscape, but IE still insist on
downloading it.
> The server needs to know the .pl is a valid extension for CGI scripts and thus
> execute the script and pass on the ouput, instead of just outputting the
> contents of the file (as it would normally do).
And it does that since all other machines displays it correctly.
Im still lost here why it doesnt work on that single machine.
Kjetil
------------------------------
Date: Thu, 05 Nov 1998 16:12:46 GMT
From: droby@copyright.com
Subject: Re: perl&cgi question
Message-Id: <71sipt$g62$1@nnrp1.dejanews.com>
In article <71re8n$46v$1@nnrp1.dejanews.com>,
jbharvey@auspex.net wrote:
> I was only trying to help, I'm not disputing whether it's appropriate for this
> newsgroup or not.
>
We'd have had a shorter and more accurate off-topic thread had you not tried
to help.
> (and yes, it /is/ a browser thing. if it works on one browser and not in the
> other.)
>
And no. It is a server thing. CGI scripts run at the server.
If a browser's config can influence whether a file on the server is run as a
CGI or downloaded then the server is incorrectly configured and the browser
is incorrectly designed.
--
Don Roby
droby@copyright.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 05 Nov 1998 17:38:50 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: perl&cgi question
Message-Id: <Pine.GSO.4.02A.9811050938100.3759-100000@user2.teleport.com>
On Thu, 5 Nov 1998 jbharvey@auspex.net wrote:
> Then how do you explain it working in Netscape and not IE?
If I were to explain it at all, I'd explain it in a newsgroup about
browsers, not one about Perl.
If you're following the proper protocol but some browser or server doesn't
cooperate, then it's the other program's fault. If you're not following
the protocol, then it's your fault. If you aren't sure about the protocol,
you should read the protocol specification. If you've read it and you're
still not sure, you should ask in a newsgroup about the protocol.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 5 Nov 1998 16:16:26 +0100
From: jwl@_munged_worldmusic.de (Joergen W. Lang)
Subject: Re: pointer question
Message-Id: <1di101v.18dnzm6bheto0N@host010-210.seicom.net>
<dave@mag-sol.com> wrote:
> In article <71roqr$25k$1@cscnews.csc.calpoly.edu>,
> "Raj Singh" <rsingh@polymail.calpoly.edu> wrote:
> > When I run the following code:
> >
> > $a = 2;
> > $b = /$a;
> > print $b;
> >
> > This is supposed to print the value of $a b/c $b is a reference to it.
> > However, my compiler outputs the error:
> >
> > Spurious backslash ignored at ...
> >
> > I would greatly appreciate any suggestions. I am new to the language.
>
> Go back and reread perlref, paying particular attention to the directopn of
> the slash character.
>
> $b = \$a;
"print $b;" still won't print the value of $a, as intented. To get to
the value of the varaible that is dereferenced by $b say:
print ${ $b };
Joergen
--
To reply by email please remove _munged_ from address Thanks !
-------------------------------------------------------------------
"Everything is possible - even sometimes the impossible"
HOELDERLIN EXPRESS - "Touch the void"
------------------------------
Date: 5 Nov 1998 08:48:22 -0800
From: larry@kiev.wall.org (Larry Wall)
Subject: Re: pointer question
Message-Id: <71sksm$403@kiev.wall.org>
In article <71roqr$25k$1@cscnews.csc.calpoly.edu>,
Raj Singh <rsingh@polymail.calpoly.edu> wrote:
>When I run the following code:
>
>$a = 2;
>$b = /$a;
>print $b;
>
>This is supposed to print the value of $a b/c $b is a reference to it.
>However, my compiler outputs the error:
>
>Spurious backslash ignored at ...
This is a Perl 4 message. I'd suggest using Perl 5 instead.
Larry
------------------------------
Date: Thu, 05 Nov 1998 09:50:28 -0500
From: Glauber Ribeiro <glauber@iws-irms.com>
Subject: Printing in NT
Message-Id: <3641BB34.306DB71E@iws-irms.com>
Hello,
What is the Right Way to print to a NT printer in Perl?
The situation is: i have files that are already formatted, ready for the
printer. I would like to just send the data straight to the Windows NT
print queue, without any translation. How do i do it?
Thanks for any ideas or pointers!
Glauber
--
Glauber Ribeiro --- IWS
mailto:glauber@iws-irms.com
http://www.iws-irms.com
------------------------------
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 4158
**************************************