[12468] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6068 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 20 18:07:17 1999

Date: Sun, 20 Jun 99 15:00:26 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 20 Jun 1999     Volume: 8 Number: 6068

Today's topics:
    Re: Afraid to ask about Y2K! (Lee)
    Re: bug? "Odd number of elements..." <rootbeer@redcat.com>
        Can someone help interpret this code? <marc@infinityinternet.com>
    Re: Can someone help interpret this code? (Eric Bohlman)
        CGI::Push Problem <gehring@politik.uni-mainz.de>
    Re: Cure for document deficiency (Lee)
    Re: Cure for document deficiency <cassell@mail.cor.epa.gov>
    Re: File Processing <cassell@mail.cor.epa.gov>
        Fixed format fields: help needed! <juanriera@mx3.redestb.es>
        Fun with tty's... <portboy@home.com>
        How send a file using perl on a win nt box to an email  <Dariush@sympatico.ca>
    Re: How to remove space <mhc@Eng.Sun.COM>
    Re: how to remove spaces in a line (Marcel Grunauer)
    Re: Language choice for high-volume Oracle CGI interfac <warrens@netcom.com>
    Re: math::Matrix (Ilya Zakharevich)
        Need Professionals <empresa@esoterica.pt>
    Re: Need to edit cgi script using Windows PC, which pro <webmaster@chatbase.com>
    Re: Newbie help on complexity management? <hasant@trabas.co.id>
    Re: Opening a remote file? <webmaster@chatbase.com>
    Re: Pattern Matching Question <webmaster@chatbase.com>
    Re: Perl Script Help <cassell@mail.cor.epa.gov>
    Re: Printing compound variables (explanation) <webmaster@chatbase.com>
    Re: Problem with DB_File <rootbeer@redcat.com>
    Re: Problem with DB_File (Anno Siegel)
        Pursuing Unix:  how valuable would Perl be? (72 Charact (Tony T.)
        Pursuing Unix:  how valuable would Perl be? (Tony T.)
        Questions <no@way.com>
    Re: Questions <tchrist@mox.perl.com>
    Re: Recommend a simple Online database? <gellyfish@gellyfish.com>
    Re: Simple question <webmaster@chatbase.com>
    Re: Simple question <webmaster@chatbase.com>
    Re: Term::ReadLine question... (Ilya Zakharevich)
        Timing out an operation is broken...help. <portboy@home.com>
    Re: Urgent and important : CSV !!! <cassell@mail.cor.epa.gov>
    Re: VERY SIMPLE QUESTION. <webmaster@chatbase.com>
    Re: What is functional difference between .pm and .pl? (Ilya Zakharevich)
        Win32::odbc problem with output <bbgraph@mail2.ee.net>
    Re: Win32::odbc problem with output (Eric Bohlman)
    Re: XS: newSVpv() and malloc (Ilya Zakharevich)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sun, 20 Jun 1999 16:13:59 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: Afraid to ask about Y2K!
Message-Id: <B392C3C796689833D0@204.112.166.88>

In article <3772a9f5.2388358@news.skynet.be>,
bart.lateur@skynet.be (Bart Lateur) wrote:

>I also think that for such short scripts, use of a (largish) module can
>double the total execution time of the scriptlet.

I doubt that module loading has a significant effect on overall execution
time except maybe under the combined influence of mod_perl and an
exceedingly simple script, eg:

#!/usr/bin/perl -w
use strict;
print "Content-type: text/plain\n\n";
if (exists($ENV{'REMOTE_USER'})) {
    print $ENV{'REMOTE_USER'};
    }

But as you say, how to benchmark?

Lee




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

Date: Sun, 20 Jun 1999 13:07:16 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: bug? "Odd number of elements..."
Message-Id: <Pine.GSO.4.02A.9906201305200.20762-100000@user2.teleport.com>

On Sun, 20 Jun 1999, Bill Huston wrote:

>   sub sub_a{};
>   sub sub_b  {
>     my %args = ( @_ ) ;
>     if (defined $args{FOO}) {            # warning on this line! 
>         $args{BOZO} = sub_a{$args{FOO}}  # oops, used a{} not a()!  

Since the parens around the sub's parameters are optional, you are passing
a hash reference as the single parameter to sub_a. You asked to have one
element in the hash - that's an odd number, don't you agree? Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 20 Jun 1999 16:16:00 -0400
From: "Marc" <marc@infinityinternet.com>
Subject: Can someone help interpret this code?
Message-Id: <7kjige$s7m$1@autumn.news.rcn.net>

I have been trying to understand how PERL classes and objects work. I'm not
new to this area in programming in general, but PERL handles them somewhat
foreign to what I'm used to. Take the following example I extracted from my
PERL book:

###############################
package Person;

sub population
{
    return $Body_Count;
}

sub new
{
    $Body_Count++;
    return bless({ }, shift);
}

sub destroy
{
    $Body_Count--;
}

###################################
# New file that uses class
###################################

use Person;

for(1 .. 10)
{
    push @people;
    Person->new();
}

printf "There are %d people alive.\n", Person->population();

#######
# EOF
#######

Now I understand the ideas of object constructures and destructures, but I
am now following what bless and shift are doing (I looked at my command
reference, I know their literal operations but not in this particular case)?
Also, the book said use something like

######
sub my_function()
{
    my $self = shift; # OR use the next line of code
    my $self = attr shift; # what's the difference?
    # And what do one or the other mean?

    # The rest I understand fine....
    if(@_)
    {
        $NAME = shift;
    }
    return $NAME;
}
#######

that to create your own object methods, but again, what if the first $self =
shift, etc. for? This is what I don't understand and the book does a pretty
bad job of trying to explain it.

Thanks






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

Date: Sun, 20 Jun 1999 21:04:02 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Can someone help interpret this code?
Message-Id: <ebohlmanFDn96q.Aur@netcom.com>

Marc (marc@infinityinternet.com) wrote:
: Now I understand the ideas of object constructures and destructures, but I
: am now following what bless and shift are doing (I looked at my command
: reference, I know their literal operations but not in this particular case)?
: Also, the book said use something like

When you call a sub as a method (either 'method class_or_instance list' 
or 'class_or_instance->(list)'), class_or_instance gets passed to it as 
the very first argument.  In the 'new' sub in the example from the book, 
the class name is the first argument, so the purpose of the 'shift' is to 
get it, just like any other subroutine argument.  The reason for getting 
it is that we need to know the class name to use bless.

bless takes a reference to a thingy (in this case, the thingy is the 
anonymous hash created by {}) and the name of a class.  What it does is 
establish (by filling in internal data structures) that the thingy is an 
object belonging to the class.

This may seem strange if you learned OOP in another language, but it's 
necessary because Perl doesn't have a built-in concept of class fields or 
instance variables.  It's up to the programmer to create the appropriate 
data structure to hold them, and therefore it's up to the programmer to 
tell the interpreter which data structure that was.

I've found the OOP explanations in _Advanced Perl Programming_ (the 
Panther book) to be especially clear.



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

Date: Sun, 20 Jun 1999 22:08:50 +0200
From: "Uwe W. Gehring" <gehring@politik.uni-mainz.de>
Subject: CGI::Push Problem
Message-Id: <376D4A52.A1C254C7@politik.uni-mainz.de>

Hi,

I am testing server push with CGI::Push. While NS Comm. (4.x) is
displaying my page correctly, IE (4.x, 5.x) does not. Instead, each new
"page" is appended to the page before, seems IE is ignoring the boundary
info.

Server is IIS 4, Perl is Activestate Perl 5.

Any help appreciated (can anyone point me to a newsgroup where cgi
related topics are being discuss?).

P.S.: The page must be written to conform Comm. as IE (at least).

TIA

Uwe W. Gehring



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

Date: Sun, 20 Jun 1999 16:13:59 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: Cure for document deficiency
Message-Id: <B392C3C796689833A8@204.112.166.88>

In article <MPG.11d6990cc74b2d6b989751@206.184.139.132>,
moseley@best.com (Bill) wrote:

>BTW -- If the documentation is so damn good, then why are those books so 
>popular?  Oh, I guess there is still room in this world for good 
>teachers.

I've been loathe to admit this, but I find on-screen documentation very
hard to follow. If I print it out readability improves, but you just can't
beat a properly typeset and bound book, so long as it has a good index.
(unfortunately, proper indexing is a near-dead art)

Do others find this? Maybe it's something to do with the ADD.

Lee




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

Date: Sun, 20 Jun 1999 14:16:30 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Cure for document deficiency
Message-Id: <376D5A2E.C426A2C9@mail.cor.epa.gov>

Dave Cross wrote:
> [big snip]
> Also it's difficult to read the online docs in the bath or on the
> train.

Hey, that's brilliant!  We suggest that people try taking their
20" monitor with them into the bath to read the docs on their
computer, and.. presto.  A large percentage of clueless posters
cease to.. umm, post.  Dave, you're a genius.  The Kevorkian
of Perlites.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Sun, 20 Jun 1999 14:09:31 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: File Processing
Message-Id: <376D588B.5E8C1015@mail.cor.epa.gov>

Bart Lateur wrote:
> Kai Henningsen wrote:
> > [no attribution to Abigail here, but I'm sticking it in]
> >> But it's even more amazing that this thread doesn't answer the question
> >> originally asked.
> >
> >Well, the first (one article, Bart) subthread I see does.
> 
> Apparently, on-topic threads are boring.

And correct answers without spelling mistakes are doubly so.
So shape up!  At the least, you could put in some grammatical
gaffes.  :-)

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Sun, 20 Jun 1999 23:31:30 +0200
From: "Juan Riera" <juanriera@mx3.redestb.es>
Subject: Fixed format fields: help needed!
Message-Id: <7kjmm7$a5k1@SGI3651ef0>

Hello,
I am new to perl. I need to format several spool files coming from an
AS/400, unhappily the output format shows the minus sign after figures; I
need to move it before the figures, without changing the figures column
position (is a fixed field output). I mean, for example, changing
12     .34-   456.0-   123
to
12    -.34   -456.0    123
I have tried with split and join, but I do not get the result I need.
I will really appreciate any help.
Thank you in advance,
Juan




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

Date: Sun, 20 Jun 1999 20:39:40 GMT
From: Mitch <portboy@home.com>
Subject: Fun with tty's...
Message-Id: <376D5173.665E8170@home.com>

Okay, I'm writing a script that will normally output to tty00, however,
when the script starts up, I want my scripts "prompt" to be on both
tty00 and tty01.  How can I do this?  Currently here's how I have it
setup to work on tty00:

So, when ou startup the script you would do something like:

perl5 script_name (local|tty00|tty01).

$in = shift;
if ($in =~ "local") {
    $tty = "/dev/tty";
} elsif ($in =~ /tty01/i) {
    $tty = "/dev/$in";
} else {
        $tty = "/dev/tty00";
}

open(STDOUT,">$tty");
open(STDERR,">/dev/null");
open(STDIN,"<$tty");

The reason for doing this is because I want both tty's to see what is
going on....Consequently, if i set the baud rate on tty00, i want that
baud rate to also be set for tty01.

Any suggestions?

 .mitch



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

Date: Sun, 20 Jun 1999 21:11:43 GMT
From: "Dariush" <Dariush@sympatico.ca>
Subject: How send a file using perl on a win nt box to an email addr.
Message-Id: <jOcb3.13998$ga.20360@news21.bellglobal.com>

Hi Every one;

How can I email a file automatically with perl on a Windows NT (4.0). to an
email address?

Can you help please?




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

Date: 20 Jun 1999 14:11:05 -0700
From: Mike Coffin <mhc@Eng.Sun.COM>
Subject: Re: How to remove space
Message-Id: <8p6aetur312.fsf@Eng.Sun.COM>

weicai@my-deja.com writes:

> Hi, Friend
> 
> I am wondering if anyone know the right way to
> remove the spaces at the begin of a new line

$line =~ s/^\s+//;


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

Date: Sun, 20 Jun 1999 19:51:08 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: how to remove spaces in a line
Message-Id: <377245e7.36740369@enews.newsguy.com>

On Sun, 20 Jun 1999 18:04:59 GMT it came to pass that weiq@cs.dal.ca
used an obscure tool  and produced 21 lines that required the
following response:

>Hi, Friends
>
>I am wondering if anyone can help me how to remove the spaces in the
>begining of a new line
>
>such as when user entered
>"           there are 11 or more spaces in the front"

You use the answers that were given to you when you asked about 15
spaces a few minutes ago, but replace "15" with "11".

Marcel



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

Date: Sun, 20 Jun 1999 14:37:02 -0700
From: Wade Warrens <warrens@netcom.com>
Subject: Re: Language choice for high-volume Oracle CGI interface?
Message-Id: <376D5EFE.9C0B00C2@netcom.com>

Let's see, 1,000,000 tx per day, figure an 8 hour day, 
comes to 35 transactions per second. Are they omplex transactions?
I'd do a quickie prototype (In pl/sql or C (oci?)) that does:
open connection
for i = 1, 3500 {
   begin transaction
     insert, update, delete, whatever
   commit
}
close connection

Also, try that in perl and Java/JDBC.
See if all solutions take less than 100 seconds.
If so, then try:
for i = 1,3500 {
   open connection
   begin transaction
      insert...
   commit
   close connection
}
I'll bet that opening a connection each time will
destroy your tps goal, in which case you will need
to re-use your connections, perhaps with a connection pool.
I know that's pretty easy with Java servlets, but perhaps
impossible with plain 'ol fork-a-process-each-time CGI.
I've never used mod_perl, so can't comment on that solution.
Personally, I would spec the database (and the transactions)
before doing anything else.  Then I'd consider
client-> HTTP ->servlet-> RMI ->appserver-> JDBC ->database
--wade

Greg McCann wrote:
> 
> We're doing a proposal for a system doing high-volume financial transactions on
> the internet.  We're expecting 10,000 transactions per day at the beginning, up
> to 1,000,000 transactions per day eventually.  The client has specified an
> Oracle database with an NT web server, using SSL for secure communications both
> between the browser client and our server and between remote servers and our
> main server.
> 
> We're debating what language to use for the CGI programming.  C++, Java, Perl,
> ...?  I have some experience using Perl for database access, but not with Oracle
> or on a system as large as this.  Do you have any thoughts on the relative
> merits of these languages for this application?  If possible, we would like to
> follow a path which wouldn't lock us in to a Microsoft platform.
> 
> Thanks,
> 
> Greg


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

Date: 20 Jun 1999 20:38:10 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: math::Matrix
Message-Id: <7kjjfi$t95$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to 
<casey@f5.com>],
who wrote in article <376c75da.133879298@news.semaphore.com>:
> It wasn't a mistake when I said I used Math::Matrix, that is the
> module that I am using.  I probably should be using Math::MatrixReal,
> but I don't want to rewrite all of my code into a different format if
> there is a simple way of getting it to work with the module I am
> currently using.  And I have read perldoc Math::Matrix and there is
> nothing in there about getting the values out, I wanted to know if
> anyone came up with a workaround, because otherwise it is a virtually
> useless module.

NOT AN ANSWER, BUT: in Math::Pari you may use $matrix->[4][0].

Ilya


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

Date: Sun, 20 Jun 1999 22:04:43 +0100
From: "Sirgio Machado" <empresa@esoterica.pt>
Subject: Need Professionals
Message-Id: <7kjl86$vus$1@fenix.maxitel.pt>

Hi...
We are looking for a  professional interested in programing and developing
perl scripts to fit our particular needs.
We are looking for someone that can also give us suport to improve these
scrips in the future.
The candidates must send their resume with examples of scripts made by them
to:
sergio.machado@lidernet.pt
Thank you!




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

Date: Sun, 20 Jun 1999 14:37:14 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
Subject: Re: Need to edit cgi script using Windows PC, which prog to use
Message-Id: <376D5F0A.212AA9A7@chatbase.com>

Mark Austin wrote:
> 
> Actually, I just need to change the baseline (URL) address of a Perl cgi
> script.
> Is it safe to do this in Notepad or Wordpad, I've heard that (if you use the
> wrong progam) it adds some stuff that the Unix box will not like.
> 
> RSVP and thanks
> 
> Mark

Notepad will work fine. I use notepad, and if the program gets too
large, I use wordpad. I've never had a problem with it.
-- 
Regards,
Tim Greer: chatmaster@chatbase.com / software@linkworm.com
Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripting in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, Sciences.


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

Date: Sun, 20 Jun 1999 20:03:57 GMT
From: Hasanuddin Tamir <hasant@trabas.co.id>
Subject: Re: Newbie help on complexity management?
Message-Id: <7kjhf8$nu2$1@nnrp1.deja.com>

In article <376d22bd$0$228@nntp1.ba.best.com>,
  John Callender <jbc@shell2.la.best.com> wrote:
> I'm looking for advice on the general subject of managing complexity
> while writing software. I'm talking about very general advice here,
> like choosing good variable names, avoiding namespace pollution, and
> using subroutines with tidy interfaces.

That's all in perlstyle manpage.

HTH,

-hasan-

--
Hasanuddin Tamir       hasant@trabas.co.id
TRABAS                    www.trabas.co.id
==========================================
 ...and the news server screws up again :-(


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Sun, 20 Jun 1999 13:52:55 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
Subject: Re: Opening a remote file?
Message-Id: <376D54A7.FC3CAE42@chatbase.com>

Simon Wistow wrote:
> 
> > use CGI qw(:standard);
> >
> > open(DATA, ">http://www.microsoft.com/index.asp">
> > print DATA header, start_html("Gone"),
> >         "gone for demoronisation", end_html;
> > close(DATA);
> 
<SNIP>

And how is that going to write to a file on Microsoft's server? There's
a big difference between a path to a file, and a URL path. Are you
looking to just print a page on another server in your own script not on
that same server, or are you actually trying to alter a file on another
server? I don't think it's doing what you think it's doing.

-- 
Regards,
Tim Greer: chatmaster@chatbase.com / software@linkworm.com
Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripting in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, Sciences.


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

Date: Sun, 20 Jun 1999 14:11:57 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
Subject: Re: Pattern Matching Question
Message-Id: <376D591D.30975F75@chatbase.com>

Franklin Edward Sadler wrote:
> $Temp == /"James Bond"/ right?

Search operator is "=~", not "==" This is to match numerically. Do you
need double quotes in that database file? Why not just use the pipe to
delimit the fields? I'm just curious about the double quotes I guess?
:-) Further, does it need to search in such a manner, or if you lost the
double quotes, could you just say it either matches the word/title or
not? It would be faster if you could get away with that. Although I
suppose you have other reasons and I'm just wondering.

> I would appreciate any support as the book I am using isnt quite specific.

If your book tells you to search a pattern using "==", then you need to
go to the book store and get your money back immediately, or look for
some errata info, because that's a big time typo that will really make
it difficult for people like you to learn.

Good luck...
-- 
Regards,
Tim Greer: chatmaster@chatbase.com / software@linkworm.com
Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripting in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, Sciences.


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

Date: Sun, 20 Jun 1999 14:50:54 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Corgi-lover <checker@usa.com>
Subject: Re: Perl Script Help
Message-Id: <376D623E.594A8BFF@mail.cor.epa.gov>

[courtesy cc sent to poster]

Corgi-lover wrote:
> 
> I'm using a Perl Script on a new webpage I've created.
> I need to make minor changes (text, webpage URL) to the script.
> I used a Perl editor but whatever small change I implement I get an error

A 'Perl' editor?  Do you mean an editor which can cope with
a Perl program?  Because just about anything will.  Even
Notepad and Wordpad.  But some editors may save the file as
the default type, instead of as straight text.  That could
make your file unreadable to your web server.  So first make
sure you're saving the file as ASCII text.  And if this is
the problem, consider getting another editor.

Then you might be uploading your edited file to your server
using ftp.  If so, make sure to set the mode to ASCII instead
of binary, or you'll have what looks like a slew of ^M 
characters in your file.  Once again the server will gag.

> message from my server.
> As soon as I reinstall the original script everythign works fine again.
> What am I doing wrong???

Well, one thing is that you're not really giving us enough
info to answer your question without making wild guesses
(see above).  Another is that you're not actually asking a
Perl question, but rather a web-authoring-esque question
that looks to you like it's a Perl problem.

> Please email directly if you can help

That's another thing you're doing wrong.  In Usenet, it is
considered impolite to post here but insist on an e-mail
reply, as if indicating the group is not worth your time
to read as long as it fulfills your whims.  It *is* okay
to ask for both e-mail and Usenet replies.  Not doing so
might get you ignored or flamed.  So please, in future,
use Netiquette when on Usenet.

> Thanks
> --
> Meik Bartoschek CPC CPMC
> Executive Director IGPC
> President mbglobaltraining, Inc.
> mbglobal@writeme.com / director@igpc.org
> 
> --
> Meik Bartoschek CPC CPMC
> Executive Director IGPC
> President mbglobaltraining, Inc.
> mbglobal@writeme.com / director@igpc.org

Umm, one more thing...  You might want to fix your
newsreader so it only throws in one copy of your sig.
OTOH, you only posted once (instead of a dozen times),
and your sig is only four lines long.  Good work.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Sun, 20 Jun 1999 13:49:10 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
Subject: Re: Printing compound variables (explanation)
Message-Id: <376D53C6.9082AD53@chatbase.com>

greg@dns.kode.net wrote:
> 
<SNIP>

Sounds like you want to use templates. It opens an HTML template file,
and replaces whatever you tell it to replace with the appropriate
variables.
-- 
Regards,
Tim Greer: chatmaster@chatbase.com / software@linkworm.com
Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripting in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, Sciences.


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

Date: Sun, 20 Jun 1999 13:15:19 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Problem with DB_File
Message-Id: <Pine.GSO.4.02A.9906201311100.20762-100000@user2.teleport.com>

On 20 Jun 1999, Anno Siegel wrote:

> 3)  The function bag_letter( $word) returns a string $bag where
>     vec( $bag, $i, 4) is the number of times the $i'th letter of
>     the alphabet occurs in $word, so $bag essentially contains
>     arbitrary binary data.  

> sub bag_letters {
>   local $_ = lc shift;
>   tr/abcdefghijklmnopqrstuvwxyz/\0\1\2\3\4\5\6\7\10\11\12\13\14\15\16\17\21\22\23\24\25\26\27\31/;

One of us is having trouble counting today. Twenty-six letters on the
left, twenty five replacements on the right. Hmmm...

>   my $bag = '';
>   foreach my $l ( split '' ) {
>     vec( $bag, ord( $l), 4)++;

Now, you know what this will do with characters other than a-z, right?

>   }
>   $bag;
> }

Good luck with it!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 20 Jun 1999 20:30:44 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Problem with DB_File
Message-Id: <7kjj1k$2m6$1@lublin.zrz.tu-berlin.de>

Tom Phoenix  <rootbeer@redcat.com> wrote in comp.lang.perl.misc:
>On 20 Jun 1999, Anno Siegel wrote:
>
>> 3)  The function bag_letter( $word) returns a string $bag where
>>     vec( $bag, $i, 4) is the number of times the $i'th letter of
>>     the alphabet occurs in $word, so $bag essentially contains
>>     arbitrary binary data.  
>
>> sub bag_letters {
>>   local $_ = lc shift;
>>   tr/abcdefghijklmnopqrstuvwxyz/\0\1\2\3\4\5\6\7\10\11\12\13\14\15\16\17\21\22\23\24\25\26\27\31/;

Oh dear... where did that \32 go?

>One of us is having trouble counting today. Twenty-six letters on the
>left, twenty five replacements on the right. Hmmm...
>
>>   my $bag = '';
>>   foreach my $l ( split '' ) {
>>     vec( $bag, ord( $l), 4)++;
>
>Now, you know what this will do with characters other than a-z, right?

Well, there's an lc up there somewhere, so A-Z are okay.  But yes, the
original version has a tr///d taking care of out of bound characters.

Apparently I munged that bag_letters pretty badly while boiling it
down to something short.  But it still does demonstrate the effect
I'm talking of.

Anno


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

Date: Sun, 20 Jun 1999 21:50:50 GMT
From: quickt@execpc.com (Tony T.)
Subject: Pursuing Unix:  how valuable would Perl be? (72 Character LL)
Message-Id: <7kjndo$hma@newsops.execpc.com>

<note: after angry letter from the  Perl AutoFAQ program : " Your
message with lines that were too long" I changed the line length to 72
per the request).

Hi all,

I am interested in opinions on persuing Unix as a career to supplement
my networking skills. I have been working with Netware 3.x / 4.x for a
few years now, and DOS/WIN workstations for about 7 years. I have always
had an interest in Unix, being the command line freak that I am, and I
have setup Linux a few times at home. 

I am thinking of actively persuing Perl, as it has been recommended as a
good beginner language to learn. 

So what is my question? I guess I am interested in real life examples of
what could be gained by being proficient in Perl, and the more one is
willing to divulge the more grateful I would be (i.e. what's a typical
day in the life? Dare I ask about salaries??) FWIW, I do have basic
programming skills, I used a variant of BASIC for a CAD program, so I
understand the concepts, enough to realize that most languages do
similar things with different syntax.

I hope no one takes this the wrong way, I am not trolling here or trying
to start any holy wars, I am just at a cross roads in my career and am
genuinely interested in "views from the trench", so to speak. 

Thanks,

Tony

 
--
System halted: hit any user to continue.


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

Date: Sun, 20 Jun 1999 21:10:37 GMT
From: quickt@execpc.com (Tony T.)
Subject: Pursuing Unix:  how valuable would Perl be?
Message-Id: <7kjl2b$hls@newsops.execpc.com>

Hi all,

I am interested in opinions on persuing Unix as a career to supplement my networking skills. I have
been working with Netware 3.x / 4.x for a few years now, and DOS/WIN workstations for about 7 years.
I have always had an interest in Unix, being the command line freak that I am, and I have setup
Linux a few times at home. 

I am thinking of actively persuing Perl, as it has been recommended as a good beginner language to
learn. 

So what is my question? I guess I am interested in real life examples of what could be gained by
being proficient in Perl, and the more one is willing to divulge the more grateful I would be (i.e.
what's a typical day in the life? Dare I ask about salaries??) FWIW, I do have basic programming
skills, I used a variant of BASIC for a CAD program, so I understand the concepts, enough to realize
that most languages do similar things with different syntax.

I hope no one takes this the wrong way, I am not trolling here or trying to start any holy wars, I
am just at a cross roads in my career and am genuinely interested in "views from the trench", so to
speak. 

Thanks,

Tony

 


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

Date: Sun, 20 Jun 1999 05:43:52 -0400
From: "news.wizard.net" <no@way.com>
Subject: Questions
Message-Id: <7kjn1p$146$1@remarQ.com>

chop removes the last character of a string but supose I want to remove the
first caracter?

What is the easiest way to remove say the first 5 elements of an array?
Makeing the 6 the first.






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

Date: 20 Jun 1999 15:49:02 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Questions
Message-Id: <376d61ce@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    "news.wizard.net" <no@way.com> writes:
:chop removes the last character of a string but supose I want to remove the
:first caracter?
:
:What is the easiest way to remove say the first 5 elements of an array?
:Makeing the 6 the first.

Because the answer could be found in the standard documentation
included with Perl, I only sent it to you via private mail
so as not to clog the newsgroup with something you could have
looked up on your own.

Enjoy.

--tom
-- 
"You're only young once, but you can always be immature. "
				- Dave Barry


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

Date: 20 Jun 1999 21:09:43 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Recommend a simple Online database?
Message-Id: <7kjlan$6b6$1@gellyfish.btinternet.com>

On Sun, 20 Jun 1999 08:50:32 GMT Bart Lateur wrote:
> David Cassell wrote:
> 
>>I like to kick the network connection loose with my back foot
>>while executing a perfect tour jete.  Very graceful, IIDSSM.
> 
> You have a back foot? You have a front foot too? Eewk.
> 
> Maybe you just walk like a crab.
> 

O I do like to be beside the seaside ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 20 Jun 1999 14:52:09 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
To: Taswar Bhatti <taswar@DONTSPAMcs.ualberta.ca>
Subject: Re: Simple question
Message-Id: <376D6289.C9D23B4E@chatbase.com>

Taswar Bhatti wrote:
> 
> I have a little problem in my cgi script.
> All I want to do is get the user domain name. When
> I use $ENV{'REMOTE_HOST'} what it returns to me
> is a NULL string but I could get the IP address
> of the user from $ENV{'REMOTE_ADDR'}.
> What I really want is not their IP but
> their domain name like www.yourdomain.com or
> even the machine they are on like proxy2.rdc1.ab.wave.home.com
> Could someone tell me what I am doing incorrect or do I have
> to use nslookup to find out their domain name.
> Could it also be that there is some kind of
> server configuration that is not allowing me to get their
> domain name from REMOTE_HOST???
> 
<SNIP>

Your web server probably has the host name lookups off.. It's faster for
the web server if it has them off, as it doesn't have to resolve the
name address each time someone sends a request to the web server. You're
going to have to do the lookup yourself. Just remember that there's a
*lot* of addresses that will not resolve to a host name and will still
only remain as an IP address.
-- 
Regards,
Tim Greer: chatmaster@chatbase.com / software@linkworm.com
Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripting in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, Sciences.


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

Date: Sun, 20 Jun 1999 14:55:47 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
To: taswar@cs.ualberta.ca
Subject: Re: Simple question
Message-Id: <376D6363.49229293@chatbase.com>

Please put a "note" somewhere in your posting to inform the people
replying to you, that they'll need to "remove" something from your email
address when offering help to you, because I don't enjoy bounces because
I don't take the time to look close enough at every email address of the
poster I'm replying to.
My post is below:

TRG Software : Tim Greer wrote:
> 
> Taswar Bhatti wrote:
> >
> > I have a little problem in my cgi script.
> > All I want to do is get the user domain name. When
> > I use $ENV{'REMOTE_HOST'} what it returns to me
> > is a NULL string but I could get the IP address
> > of the user from $ENV{'REMOTE_ADDR'}.
> > What I really want is not their IP but
> > their domain name like www.yourdomain.com or
> > even the machine they are on like proxy2.rdc1.ab.wave.home.com
> > Could someone tell me what I am doing incorrect or do I have
> > to use nslookup to find out their domain name.
> > Could it also be that there is some kind of
> > server configuration that is not allowing me to get their
> > domain name from REMOTE_HOST???
> >
> <SNIP>
> 
> Your web server probably has the host name lookups off.. It's faster for
> the web server if it has them off, as it doesn't have to resolve the
> name address each time someone sends a request to the web server. You're
> going to have to do the lookup yourself. Just remember that there's a
> *lot* of addresses that will not resolve to a host name and will still
> only remain as an IP address.
> --
> Regards,
> Tim Greer: chatmaster@chatbase.com / software@linkworm.com
> Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
> TRG Software: http://www.linkworm.com | CGI scripting in Perl/C, & more.
> Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
> Freelance Programming & Consulting, Musician, Martial Arts, Sciences.


-- 
Regards,
Tim Greer: chatmaster@chatbase.com / software@linkworm.com
Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripting in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, Sciences.


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

Date: 20 Jun 1999 20:41:29 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Term::ReadLine question...
Message-Id: <7kjjlp$15$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Mitch 
<portboy@home.com>],
who wrote in article <376C9D14.2C21202E@home.com>:
> Okay, I went and downloaded (and installed) the latest Term::ReadLine
> module from CPAN.

Term::ReadLine is standard from 5.002 or around.  Thus what is on CPAN
should be a remnant of pre-5.002 days.  You probably want
Term::ReadLine::Perl or Term::ReadLine::Gnu.

Ilya


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

Date: Sun, 20 Jun 1999 21:46:30 GMT
From: Mitch <portboy@home.com>
Subject: Timing out an operation is broken...help.
Message-Id: <376D611D.11FE48FD@home.com>

Okay, when my script start up, it provides you with a prompt requiring
you to enter your password.  Assuming the password is valid, it then
sends you to a command prompt.  prompt>  What I'm to do is, if they are
at the prompt for say 5 seconds, and they haven't entered anything...I
want to call a subroutine that will log them out.  When they are logged
out, they are returned back to my password prompt where it can sit there
for forever.

I've been trying to work from the example shown in the Perl Cookbook,
and it works to some degree, but I'm still having trouble.  The trouble
is, when they get to the "prompt>" it will sit there for five seconds
and then log the user out, however, when I try to type a command at my
"prompt>" it immediately exits the script.  Can someone explain to me
why this is happening?

Here's the jist of my code:

$SIG{ALRM} = sub { die "timeout" };

sub commands {
        while (1)
        {
                &timer;  # The commented lines below is how I used to
show the prompt.  the &out subroutine is nothing more than a "print
shift" statement.
                # ($delta == 1) {
                #&out(&prompt2);
                #} else {
                #&out(&prompt);
                #}
                #my($an) = &get_line;
                #($cmd, @args) = split(/\s+/, $an);


                # all lines below here at nothing more than a call to
the various command subroutines.

                        &{$command{sub}}(@args);

        }
    }


sub timer
{
        eval {
                alarm(5);
                if ($delta == 1) {
                        &show(&prompt2);
                } else {
                        &show(&prompt);
                }
                my ($an) = &get_line;
                ($cmd, @args) = split(/\s+/, $an);
                alarm(0);
        };
        if ($@ =~ /timeout/) {
                &logout;  # returns the user to the password prompt.
        } else {
                alarm(0);
                die;
        }
}


So, what am I doing wrong?



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

Date: Sun, 20 Jun 1999 14:25:28 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Urgent and important : CSV !!!
Message-Id: <376D5C48.DE67FB93@mail.cor.epa.gov>

Lamarck Pauline wrote:
> [snip]
> Anyone ever tempted to give *bad* advice to these pleas,
> just to break the monotony?
> 
> #!/bin/sh /usr/local/bin/perl -c
> $filename = '$filename';chomp $$filename;
> `cat file.csv > temp.doc` && die;
> pop @INC;
> use DBI;
> open (<FILENAME>, join(
>    .
>    .
>    .
> 
> I can't go on.

Oh come on, admit it.  You just copied this out of one 
of Matt's Scripts, didn't you?  :-)

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Sun, 20 Jun 1999 14:29:43 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
Subject: Re: VERY SIMPLE QUESTION.
Message-Id: <376D5D47.19F37D09@chatbase.com>

xacto@my-deja.com wrote:
> 
> Hello all,
> 
> I am very unfamiliar with Perl in CGI but have been assigned the task
> of transferring Perl based CGI files from a Apache Server to a WinNT
> Server and still have the CGI function properly.  I've installed
> ActivePerl and it seems like I'm on my way but I do have a question.
> I've noticed that most files end with the .cgi extension.  Is there a
> reason why Perl based files are named .cgi verus .pl?  Are they two
> different file types altogether?  Any help would be great.

Some web servers are set up to only use the .cgi extension, don't ask me
why? Also, some web servers are set up to execute any file with a .cgi
extension anywhere in the document root, and not just a script aliased
directory. Most servers that do that also allow any files with the .pl
extension to do the same. It's nothing to be concerned with, and if you
need to associate a .pl extension to have them work on your NT system,
then just rename them, that won't have any negative effects or matter in
that aspect.
-- 
Regards,
Tim Greer: chatmaster@chatbase.com / software@linkworm.com
Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripting in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, Sciences.


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

Date: 20 Jun 1999 20:34:43 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: What is functional difference between .pm and .pl?
Message-Id: <7kjj93$t7t$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Abigail
<abigail@delanet.com>],
who wrote in article <slrn7mngl1.lri.abigail@alexandra.delanet.com>:
>				    I don't need syntax highlighting, I
> already know Perl.

Judging my most of your signatures, you do need them.  Most of them
lose all the charm with the highlighted syntax.

Ilya


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

Date: Sun, 20 Jun 1999 16:36:23 -0400
From: "Bob Stickel" <bbgraph@mail2.ee.net>
Subject: Win32::odbc problem with output
Message-Id: <7kjjra$e7v$1@news2.ee.net>

I have a good dsn and table and the routine runs to the error point in the
browser and stops with:

CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:

my routine is quite simple (it's the sample script from Roth.net page):

use Win32::ODBC;
$DSN = "northwind";
if (!($db = new Win32::ODBC($DSN))){
    print "Error connecting to $DSN\n";
    print "Error: " . Win32::ODBC::Error() . "\n";
    exit;
}
$SqlStatement = "SELECT * FROM employees";
if ($db->Sql($SqlStatement)){
    print "SQL failed.\n";
    print "Error: " . $db->Error() . "\n";
    $db->Close();
    exit;
}
while($db->FetchRow()){
    undef %Data;
    %Data = $db->DataHash();
}
$db->Close();

can someone point me in the right direction to get the output displayed?

Thanks

Bob






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

Date: Sun, 20 Jun 1999 21:08:10 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Win32::odbc problem with output
Message-Id: <ebohlmanFDn9DM.B27@netcom.com>

Bob Stickel (bbgraph@mail2.ee.net) wrote:
: I have a good dsn and table and the routine runs to the error point in the
: browser and stops with:
: 
: CGI Error
: The specified CGI application misbehaved by not returning a complete set of
: HTTP headers. The headers it did return are:
: 
: my routine is quite simple (it's the sample script from Roth.net page):

Was there really nothing after "the headers it did return are:" or did 
you just snip them?  If there was something, it would probably give you a 
good idea of where the problem was.  Without it, the error message means 
no more than "my program didn't run" which isn't very informative.

[snip script]

I saw nothing in your script that would actually print any CGI headers, 
so maybe you didn't snip anything above.  Try actually printing some 
(preferably by using CGI.pm).



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

Date: 20 Jun 1999 20:30:21 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: XS: newSVpv() and malloc
Message-Id: <7kjj0t$t5n$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to David Coles 
<david@s-mart.demon.co.uk>],
who wrote in article <376B69B7.D80D5EAF@s-mart.demon.co.uk>:
> My question seems related to this, so I hope you don't mind me hijacking
> the thread ;)
> 
> I'm new to XSUB, and I was wondering if anyone could help me with
> clarification of something. I want to use XSUB to create a perl
> interface to a C library we have for our database system. The data
> I get back from calls to this can contain nulls in the returned record
> so I can't just treat it as a string - it would just get terminated at
> the first null. Is there some way I can retrieve arbitrary length
> binary data from a call to an XSUB? What kind of typemap rules would I
> have to use.

It is not *easy* to do the *other* way around.  Perl string have
nothing to do with '\0'.  If you can state your question clearer, you
have a better change to get an answer.  Generally, you use *sv*pvn() for
"C-char-arrays to Perl" translation, and SvPV() for the opposite direction.

Ilya


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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 6068
**************************************

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