[11706] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5306 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 6 01:06:32 1999

Date: Mon, 5 Apr 99 22:00:22 -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           Mon, 5 Apr 1999     Volume: 8 Number: 5306

Today's topics:
    Re: [Q] Help Needed on map <jdf@pobox.com>
        array of array references <mcantrell@inetnow.net>
    Re: array of array references (Larry Rosler)
    Re: array of array references <jdf@pobox.com>
    Re: array of array references <rick.delaney@home.com>
    Re: Cookies (Abigail)
    Re: Cookies (. .)
        Data encapsulation hemantp@writeme.com
    Re: Data encapsulation <jdf@pobox.com>
    Re: Does anyone know whats wrong with my script? (Larry Rosler)
    Re: Does anyone know whats wrong with my script? <revjack@radix.net>
    Re: Does anyone know whats wrong with my script? (Larry Rosler)
    Re: First CGI/Perl  Program (Abigail)
    Re: First CGI/Perl  Program (Darren Greer)
    Re: First CGI/Perl  Program <ffchopin@worldnet.att.net>
    Re: For web site design, and hosting, come to World Pha <ffchopin@worldnet.att.net>
    Re: greping an associative array <rick.delaney@home.com>
        Help required urgently on CGI Perl <arnab@india.ti.com>
    Re: HELP! How do I pass variables? <ffchopin@worldnet.att.net>
        How to "my" a file handle <pedrogarrett@mediaone.net>
        htpasswd.pl <jonautry@hotmail.com>
    Re: Perl Question for generating HTML trimbleman@hotmail.com
        Pershop Question <arnold@monstermakers.com>
    Re: Pershop Question <erik@rockymountainwebtech.com>
        ppp-connection with perl igor@satsun.sci.kz
    Re: Premature end of script headers <uri@home.sysarch.com>
    Re: PROGRESS Data Base and Perl ? <bill@fccj.org>
        Script to run ftp <rileyr@u.washington.edu>
    Re: Sorting lines. <toddl@SiTeraNOSPAM.com>
    Re: System Info script <bill@fccj.org>
    Re: This proverbial "perldoc". (Larry Rosler)
    Re: Unpack Question <jhisson1@columbus.rr.com>
    Re: Web Mail stephen@netwin.co.nz
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 05 Apr 1999 23:10:10 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: effie@effierover.com (Effie Rover)
Subject: Re: [Q] Help Needed on map
Message-Id: <m3vhfala0d.fsf@joshua.panix.com>

effie@effierover.com (Effie Rover) writes:

> I've looked at my Perl books and at some examples online, and can't
> seem to get my head around the map function.

Have you read the documentation for map()?

  perldoc -f map

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Mon, 05 Apr 1999 22:45:00 -0400
From: Mark Cantrell <mcantrell@inetnow.net>
Subject: array of array references
Message-Id: <3709752C.59FC28CA@inetnow.net>

I have a bit of code that looks something like...

while ($array_ref = get_results()) {

	push (@values,$array_ref);

}

print_results(\@values);


The problem is '@values' contains the correct number of results. However
all the references point to the same place.  So that when I call
print_results(\@values) ,  the same result set is printed , over and
over.

What is going on here?  Have I missed something simple?

thanks
mark


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

Date: Mon, 5 Apr 1999 20:48:24 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: array of array references
Message-Id: <MPG.117323e5bd5ac04b989843@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <3709752C.59FC28CA@inetnow.net> on Mon, 05 Apr 1999 22:45:00 
-0400, Mark Cantrell <mcantrell@inetnow.net >says...
> while ($array_ref = get_results()) {
> 	push (@values,$array_ref);
> }
> print_results(\@values);
> 
> The problem is '@values' contains the correct number of results. However
> all the references point to the same place.  So that when I call
> print_results(\@values) ,  the same result set is printed , over and
> over.
> 
> What is going on here?  Have I missed something simple?

Undoubtedly get_results() is returning a reference to the same array, 
and overwriting it on each call.  One can correct that by using 'my 
@array;' in get_results() (assuming you have access to the code), or by 
copying the array before pushing a reference to it:

  	push @values, [ @$array_ref ];

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 05 Apr 1999 23:19:28 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: Mark Cantrell <mcantrell@inetnow.net>
Subject: Re: array of array references
Message-Id: <m3soael9kv.fsf@joshua.panix.com>

Mark Cantrell <mcantrell@inetnow.net> writes:

> while ($array_ref = get_results()) {
> 	push (@values,$array_ref);
> }
> 

> The problem is '@values' contains the correct number of results. However
> all the references point to the same place.

> What is going on here?  Have I missed something simple?

Who knows?  You left out the only relevant piece of code, namely, the
get_results subroutine where the array ref is constructed.  I'm
guessing that you're returning a reference to a global variable, like

  return \@some_array;

when you should really be copying the variable into a new anonymous
array like

  return [ @some_array ]

HTH.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Tue, 06 Apr 1999 04:23:46 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: array of array references
Message-Id: <37098E51.C2F179E8@home.com>

[posted & mailed]

Mark Cantrell wrote:
> 
> I have a bit of code that looks something like...
> 
> while ($array_ref = get_results()) {
> 
>         push (@values,$array_ref);
> 
> }
> 
> print_results(\@values);
> 
> The problem is '@values' contains the correct number of results. 
> However all the references point to the same place.  So that when I 
> call print_results(\@values) ,  the same result set is printed , over 
> and over.
> 
> What is going on here?  Have I missed something simple?

Let's run with that.  Does get_results() return the same thing every
time?  And if not, why not when it doesn't take any arguments?  You're
not using globals, are you?

It's hard to tell what's going on without peeking inside your
subroutines.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 6 Apr 1999 02:23:10 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Cookies
Message-Id: <7ebr6e$10$1@client2.news.psi.net>

TipTup@webtv.net (TipTup@webtv.net) wrote on MMXLIV September MCMXCIII in
<URL:news:20655-370955D9-4@newsd-134.iap.bryant.webtv.net>:
,, Does anyone have any cookie libraries or an example on how to
,, set/retrieve cookies?


I'd go to rec.food and look for the URL of their archives.




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: Mon, 5 Apr 1999 21:30:10 -0600 (MDT)
From: TipTup@webtv.net (. .)
Subject: Re: Cookies
Message-Id: <6252-37097FC2-64@newsd-132.iap.bryant.webtv.net>

Ha ha, that real funny, NOT



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

Date: Tue, 06 Apr 1999 03:53:34 GMT
From: hemantp@writeme.com
Subject: Data encapsulation
Message-Id: <7ec0fr$1g3$1@nnrp1.dejanews.com>

How do I encapsulate data in perl module, which corresponds to a C++ class.

e.g I have a module foo
package foo
$myPrivateName;
sub new     # not defined here
sub setName  # not defined here
sub getName    # not defined here.

In my subroutine setName I am assigning a "name" to $myPrivateName
When I take multiple instances of this package like this:

$instance1 = new foo;
$instance1->setName("xx");
$instance2 = new foo;
$instance2->setName("yy");

But what really happens is that the $myPrivateName variable is same for both
the perl objects $instance1 and $instance2.

My problem is how to associate a different $myPrivateName with each object.

- Hemant


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 05 Apr 1999 23:40:12 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: hemantp@writeme.com
Subject: Re: Data encapsulation
Message-Id: <m3n20ml8mb.fsf@joshua.panix.com>

hemantp@writeme.com writes:

> package foo
> $myPrivateName;

> My problem is how to associate a different $myPrivateName with each
> object.

You need to settle down with a cup of cocoa and the perltoot document.
Here's a brief demonstration of one common technique:

  package foo;

  sub new {
    my $proto = shift;
    my $class = ref($proto) || $proto;  # allow inheritance
    my $self = { private_thingy => undef };
    return bless $self, $class;
  }

  sub set_thingy {
     my ($self, $new_thingy_val) = @_;
     $self->{private_thingy} = $new_thingy_val;
  }

If you absolutely must keep things invisible to the outside world, you
could always maintain a lexically scoped hash

  package foo;
  my %objects;

and then use a blessed reference to the hash key as the object itself:

  use Symbol;
  sub new {
     my $proto = yadda yadda...
     my $key = gensym;
     return bless $key, $class;
  }
  
  sub set_thingy {
    my ($self, $val) = @_;
    $objects{$$self}->{thingy} = $val;
  }

But this strikes me as excessive, and I'm sorry I brought it up*.  Just
read perltoot and its cousins.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf
*not


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

Date: Mon, 5 Apr 1999 18:25:47 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Does anyone know whats wrong with my script?
Message-Id: <MPG.1173026f7ab07855989840@nntp.hpl.hp.com>

In article <MPG.1172f7a1f7a8f57498970f@206.184.139.132> on Mon, 5 Apr 
1999 17:39:46 -0700, Bill Moseley <moseley@best.com >says...
> In article <MPG.1172a424740f309a989830@nntp.hpl.hp.com>, lr@hpl.hp.com 
> says...
> > In article <MPG.117269ad8c19e54198970a@206.184.139.132> on Mon, 5 Apr 
> > 1999 07:33:59 -0700, Bill Moseley <moseley@best.com> says...
> > ...
> > > Passing in a single variable I'd use
> > > 
> > > $Onlydate = $_;
> > 
> > I wouldn't use that, as it has nothing to do with passing variables into 
> > subroutines.
> 
> I was just checking to see if I was in your kill file, Larry ;)  Sorry 
> for the error.

In English, 'double positive' means negative, as in "Yeah, yeah!' or 
'Yeah, right!' or 'Yeah, sure!.

> >  I'd use
> > 
> >   $Onlydate = $_[0];
> 
> So, do you like it better than
> 
>     $Onlydate = shift;

Same number of characters to type, so who cares?  :-)

More seriously, if micro-timing is important (which it shouldn't be, 
considering how slow the subroutine calling mechanism is to begin with), 
I imagine (without benchmarking) that accessing an element of the 
argument array is cheaper than accessing it and then shortening the 
array.

The hazard of the $_[0] approach is that it is too easy to be lazy and 
omit it, and simply to refer to the argument array directly within the 
subroutine body.  This loses the documentary value of the receiving 
lexical variables, and risks either inadvertantly modifying an lvalue 
argument or getting a run-time error by trying to modify an rvalue 
argument.

So it comes down to personal or project style, I think.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 6 Apr 1999 01:32:55 GMT
From: Africa Ritter <revjack@radix.net>
Subject: Re: Does anyone know whats wrong with my script?
Message-Id: <7ebo87$dak$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight

In tin, this thread looks like:

3 + Does anyone know whats wrong with my Larry Rosler <lr@hpl.hp.com>


-- 
  /~\  rasp chocolate bronchiole goofy handwrite curfew junky elysian 
 C oo  abscissa dickens Carey Donald invertible restraint imp consumpt
 _( ^) 1 , 0 0 0 , 0 0 0   m o n k e y s   c a n ' t   b e   w r o n g
/___~\ http://3509641275/~revjack  04/05/99 21:31:37 revjack@radix.net


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

Date: Mon, 5 Apr 1999 20:41:07 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Does anyone know whats wrong with my script?
Message-Id: <MPG.11732227d5640a8e989842@nntp.hpl.hp.com>

In article <7ebo87$dak$1@news1.Radix.Net> on 6 Apr 1999 01:32:55 GMT, 
Africa Ritter <revjack@radix.net >says...
> In tin, this thread looks like:
> 
> 3 + Does anyone know whats wrong with my Larry Rosler <lr@hpl.hp.com>

That's what my wife asked.  :-)

I assume 'tin' is a newsreader (though yours is identified in the 
headers as BLARG).  I have no idea what the problem might be.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 6 Apr 1999 02:25:47 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: First CGI/Perl  Program
Message-Id: <7ebrbb$10$2@client2.news.psi.net>

Erik Thompson (erikjt@earthlink.net) wrote on MMXLIII September MCMXCIII
in <URL:news:7ebi32$9f$1@oak.prod.itd.earthlink.net>:
'' I removed all the carriage returns and then typed 'perl helloworld.cgi'
'' again and it seems to work okay.  However when I just type 'helloworld.cgi'
'' I get 'No such file or directory'.

Then perl isn't in /usr/local/bin/perl. Find out where it is, then put
the right place after the #!. And make sure there's no trailing ^M if
you're running it on Unix.



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: Tue, 06 Apr 1999 02:32:33 GMT
From: drgreer@qtiworld.com (Darren Greer)
Subject: Re: First CGI/Perl  Program
Message-Id: <37097212.3424934@news.qgraph.com>

-->I am get an Internal Server Error when I try to run this simple Hello World
-->program from my browser.
-->I have accessed my site from Telnet and when I tried to run it by typing
-->'perl helloworld.cgi' it first said that I had illegal carriage returns at
-->the second line.
-->I removed all the carriage returns and then typed 'perl helloworld.cgi'
-->again and it seems to work okay.  However when I just type 'helloworld.cgi'
-->I get 'No such file or directory'.
You have not set the file to be executable.  Do a 'chmod 755
filename'.  Then try again,

Darren



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

Date: Tue, 6 Apr 1999 00:19:38 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: First CGI/Perl  Program
Message-Id: <7ec2m7$acs$1@bgtnsc02.worldnet.att.net>

> #!/usr/local/bin/perl
> print "Content-type: text/html\n\n";
> print "<html>\n";
> print "<head>\n";
> print "<title>Hello world with Perl</title>\n";
> print "</head>\n";
> print "<body>\n";
> print "<h1>Hello world with Perl</h1>\n";
> print "<p>Howdy, world!</p>\n";
> print "</body>\n";
> print "</html>\n";

Just as a sied note...  Learn the value of using "here docs" for outputting
large blocks of "print" statements.  It will save you from having to type
print before 4.8 billion lines in your code.  Also, for more complex
questions than this, you may want to go to
comp.infosystems.www.authoring.cgi, where your questions will be on-topic
and where you'll find more CGI help.

Jason Simms




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

Date: Tue, 6 Apr 1999 00:41:38 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: For web site design, and hosting, come to World Phase
Message-Id: <7ec3vj$fge$1@bgtnsc02.worldnet.att.net>

This is the most fascinating, challenging, and enlightening Perl question I
have yet seen in this forum...

Jason Simms

<gabe@worldphase.com> wrote in message
news:7eb284$7n6$1@nnrp1.dejanews.com...
> Come to World Phase for all your Internet needs.
>
>
>
> We are your complete Internet design company.
>                We work with you, to create your custom internet
>                presence.
>
>                Our Business Services Include
>                (select from the links below)
>                - web site design
>                - graphic design
>                - web site marketing
>                - e-commerce
>                - web hosting
>                - site redesign
>                - starter packages
>                - online menu design for restaurants
>                - Our Rates
>
>                If you have a need for web site development,
>                including animations, flash multimedia,
>                animated gifs, image maps, javascript, perl
>                implementation, database integration, and
>                graphic design, Worldphase has the expertise to
>                satisfy you.
> visit us at http://www.worldphase.com
>
> Thanks,
> Gabriel John Cohen
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own




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

Date: Tue, 06 Apr 1999 04:41:45 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: greping an associative array
Message-Id: <37099288.5E869F82@home.com>

[posted & mailed]

Ken Nagorski wrote:
> 
> I am new to perl, and programing for that matter, what I am trying to
> figure out is if you can grep an associative array same as a standard
> array as in grep(/$var/, @array); works, grep(/$var/, %array); does
> not.  Also I am having trouble loading an open file into an 
> associative array,
>     open(FILE,  myfile);
>     @array = <FILE>;   works
> 
>     open(FILE, myfile);
>      %array =  <FILE>; doesn't, what am I missing?

You are missing your definition of "works".  What do you expect to
happen?  grep is really not something that you would want to use on
hashes (associative arrays) very often.  The whole purpose of a hash is
to search.

    if ( grep(/$var/, %hash) ) {

will tell you if any of the keys or values of %hash match the pattern
/$var/ but you should set up your data structures so that you can use
easier and more sensible operations.  Assign your hash so you can do
tests like

    if (exists $hash{$var}) {

Since you are very new to Perl, you might want to get the O'Reilly book
_Learning Perl_.  You will also want to read the excellent manual that
comes with perl.

perldoc perl

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Mon, 05 Apr 1999 23:46:38 -0500
From: Arnab Guin <arnab@india.ti.com>
Subject: Help required urgently on CGI Perl
Message-Id: <370991AE.789928EF@india.ti.com>

All ,

I have created a homepage which uses forms extensively .All my scripts
are in Perl and they work from my directory .However , when I tried to
upload all my files to Tripod[homepage builder] , I am facing grave
problems because I do not know about the Perl location there .Can anyone
advise me what to do about this ?
One solution is convert all Perl scripts to Javascript but this hardly
is a solution I think .

Any help is greatly appreciated .

--

Thanks and Regards ,

Arnab .





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

Date: Tue, 6 Apr 1999 00:31:19 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: HELP! How do I pass variables?
Message-Id: <7ec3c6$dav$1@bgtnsc02.worldnet.att.net>

>    I know how to pass perl variables at the command line  but I don't know
how
> from a web page.  I have the following code in my link on my web page:
>
> <TR>
>         <TD><A HREF="../../cgi-bin/index.cgi
> /u1/network/data/omcr1_cbsc1/monsey_reports" TARGET="main"><FONT
> COLOR="#0000A0">Daily Cdl Analysis</FONT></A></TD>
> </TR>

Whoops!  Looks like you're calling it wrong...  I would assume you want to
call the CGI program with a variable that points to the file you want it to
parse?  The short advice is, read the chapter on CGI in the updated Learning
Perl, and then read the Official Guide to Programming with CGI.pm, and then
take your questions to comp.infosystems.www.authoring.cgi.  Also, good HTML
books will explain the two methods of passing values between pages: GET and
POST.  It is then up to the CGI (or other) program to decode and handle them
correctly.  The books will explain it perfectly.

> And the following code in my cgi-bin:
>
> #!/usr/local/bin/perl $report_directory = $ARGV[0];
> chdir("$report_directory"); @directorylisting = `ls -1`; foreach $file
> (@directorylisting)  { $dirlisting= "$dirlisting <a href=
> $report_directory/$file TARGET=newwin>$title $file</a><br>"; } print
> "Content-type: text/html\n\n"; print "<title>Index of directory</title>
<body
> bgcolor=ffffff text=0080FF> <center><big><big><font face=arial>Select a
> Report From the Following...</big></big></font><br> <hr><br> <hr><br>
> $report_directory<br> $dirlisting<br> <hr>\n"; exit;

Man, if you're gonna post this unformatted code, don't bother.  Though this
is fairly simplistic to follow, it is still a pain that many people don't
want to deal with.  Anyway, buy the books, learn how to pass the variables
using FORM values, and then learn how to use CGI.pm.  It's easy and it's
free, and if you've got Perl then you've got it already.  Once passed
properly, you're code won't need that much reformatting.  Instead of
$report_directory = $ARGV[0], it would look something like this:
$report_directory = param("dir");, where dir is the name of a passed
parameter containing the URL-encoded value of the directory.

> Everytime I run this it only gives me a directory listing of my cgi-bin.
Can
> anyone tell or show me how to pass my variables from my link to my cgi
script?
> Thanks in advance...

Ooops!  A listing of the cgi-bin directory?  Change the settings, friend...
Major security problem.

Jason Simms




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

Date: Mon, 5 Apr 1999 21:58:40 -0700
From: "Pedro Garrett" <pedrogarrett@mediaone.net>
Subject: How to "my" a file handle
Message-Id: <1wgO2.2240$Sc.1787@typhoon.la.rr.com>

I read the FAQ on how to "local" a file handle, but how do I "my" one?  Or
is there maybe no reason to do this?

Thanks,

--Pedro




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

Date: Mon, 5 Apr 1999 23:55:00 -0400
From: "Jon" <jonautry@hotmail.com>
Subject: htpasswd.pl
Message-Id: <VFfO2.204$Bs3.28083@news20.ispnews.com>

Hello all!

I have been banging my head against a wall for the past few days and I am
hoping that someone here can shed some light on a problem I am having.

Here's my problem:

I have a section of my site that I need to password protect and I am using
the .htaccess file to get it done. I know how to add new user names and
passwords to the .htpasswd using Telnet, but I really need a script that
will do this for me.

I have the "Special Edition Using CGI" book copyright 96, that provides a
script to do just this, but even though I have set everything up right its
unable to write to the .htpasswd file. The Script can read the .htpasswd
file, I know that much, because it will tell you if you enter a username
that is already taken. But It will not write to the .htpasswd file no matter
how I set the permissions!

Is there a security issue that has changed since the book was released that
will not allow a script to make changes to the .htpasswd that I am unaware
of? Or am I just setting the permissions wrong? I get no errors, it even
takes me to the conformation page to tell me that the user name and password
has been added. But when you try to enter using the password/username its
unable to find either...

Any help would be GREATLY appreciated :)

Thanks!
Jon



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

Date: Tue, 06 Apr 1999 03:11:01 GMT
From: trimbleman@hotmail.com
Subject: Re: Perl Question for generating HTML
Message-Id: <7ebu00$vgf$1@nnrp1.dejanews.com>


> : >    Whitespace is "folded" in the presentation of HTML (it is
> : >    ignored by the browser), so getting things lined up in
> : >    pretty columns is unneeded work, since the browser will
> : >    undo the work anyway.
> : Is this true if you are passing the data into HTML Borders
> : with cells and rows ??
>    I dunno.
>    That is not a Perl question.
>    There is another newsgroup for discussing HTML:
>-   comp.infosystems.www.authoring.html
thanks..i will cross post there..
>    But if whitespace in HTML does matter, I'm still fairly
>    certain you can get what you want without formats.
> : >    print() with a here-doc is handy for outputting a block
> : >    of text, such as the head/tail of the HTML output:
> : >
> : > print <<'ENDHTML';
> : > Content-Type: text/html
> : >
> : > <html>
> : > <head>
> : >    <title>My Web Page</title>
> : > </head>
> : > <body>
> : > ENDHTML
> : So this produces the headers portion of each html document ??
>    Type it in.  Run it.
>    See what it does.
>    No need to post such questions...
> : then you would use another print <<
> : for the body ??
> : and a third for the ending ??
>    You use what is appropriate for the job.
>    here-docs are just another form of quoting like single/double quotes.
>    Go read about it if you want to know about it.
Where do i go to read about it ??




-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 05 Apr 1999 21:08:07 -0400
From: Arnold Goldman <arnold@monstermakers.com>
Subject: Pershop Question
Message-Id: <37095E6F.D04@monstermakers.com>

Hello Perl Guru's:

I have a question regarding a Perlshop problem that has cropped up. I've
had this great free program installed on my website and running
flawlessly for 5 months when suddenly it went down, inexplicably,
without any changes to the set-up on my part. The server, 9netave out of
N.J. says that many people have been encountering the same error, out of
the blue, which reads: 

"Invalid Transmission #3 received from: xxx.xxx.xxx.xx If your
connection was interrupted, you must Enter the shop from the beginning
again."

Unfortunately the creator of this program is unavailable or unwilling to
provide the fix if indeed one exists. Lots of store fronts are biting
the dust and no one seems to have the answer. Is there anyone out there
that has experienced this problem and has the fix? 

arnold@monstermakers.com


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

Date: Mon, 05 Apr 1999 19:09:02 -0700
From: Erik Boles <erik@rockymountainwebtech.com>
Subject: Re: Pershop Question
Message-Id: <37096CBE.B8C721AF@rockymountainwebtech.com>

Have you possibly upgraded to the new version of perlshop and then this
happened or is this the same version with literally no intervention from you
when it started acting up??

Arnold Goldman wrote:

> Hello Perl Guru's:
>
> I have a question regarding a Perlshop problem that has cropped up. I've
> had this great free program installed on my website and running
> flawlessly for 5 months when suddenly it went down, inexplicably,
> without any changes to the set-up on my part. The server, 9netave out of
> N.J. says that many people have been encountering the same error, out of
> the blue, which reads:
>
> "Invalid Transmission #3 received from: xxx.xxx.xxx.xx If your
> connection was interrupted, you must Enter the shop from the beginning
> again."
>
> Unfortunately the creator of this program is unavailable or unwilling to
> provide the fix if indeed one exists. Lots of store fronts are biting
> the dust and no one seems to have the answer. Is there anyone out there
> that has experienced this problem and has the fix?
>
> arnold@monstermakers.com

--
Erik Boles
Rocky Mountain Web Tech
360.425.0952
http://www.rockymountainwebtech.com
erik@rockymountainwebtech.com
ICQ 1346492




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

Date: Tue, 06 Apr 1999 02:53:25 GMT
From: igor@satsun.sci.kz
Subject: ppp-connection with perl
Message-Id: <7ebsv3$uiv$1@nnrp1.dejanews.com>

Hi,

Who knows how to write a perl-script to establish ppp-connection with my
ppp-server ( with login, password etc).Both my computer and server run under
Red Hat Linux.

Thanks in advance.

Igor Khromushin

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 05 Apr 1999 23:53:22 -0400
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: Premature end of script headers
Message-Id: <x7pv5itnf1.fsf@home.sysarch.com>

>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:

  LR> "A retronym is a word which was coined because of another
  LR> similar word... well it's hard to explain. Here are some
  LR> examples: HARD-COVER BOOK used to be called "book" before
  LR> paperback books were invented. Also, ACOUSTIC GUITAR came
  LR> from guitar once electric guitars were invented."

  LR> Here's another example:  "snow skiing" vs. "skiing".

  LR> That's why I called things like Basic 'retro-acronyms' in my response to 
  LR> Randal.

a favorite of mine is analog watch after digital watches came out.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Mon, 05 Apr 1999 23:18:54 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: PROGRESS Data Base and Perl ?
Message-Id: <37097d27.0@usenet.fccj.cc.fl.us>

[Mailed and Posted]

In article <7e4gmc$onf$1@front6.grolier.fr>, "Patrick Fichou"
<fichou@club-internet.fr> wrote:


> Hi,
>
> I currently work on a Unix/Progress environment and discovered Perl
> recently... but really like this language !!!
> I would like to know if someone knows how to acces a Progress DB with Perl.
> Just reading the files would be enough to make some CGI package !
> I use HP/UX 10.20 and Progress 6.3.
> Thank you !
>
> Patrick
>
>


Good question!  :]

I asked Progress Software this question over a year ago and
they basically said you would need to access it via SQL calls.

Barring that, you would need to come up with a binary
schema reader - not a happy project to say the least.

To do what you want to do would require:

1.  Learn how Progress's 3GL (HLI/C) Interface Guide works...
2.  Learn how to write an XS function(s) to expand Perl's ability.
3.  Write a new perl module to access Progress as if you were
    using the HLI/C interface thereby tricking Progress 4GL RDBMS.

It does sound harder than I think it is.  I've done this in
C under CTOS for version 6, but once I changed jobs I basically
stopped using Progress just before V8...

It's possible,  If you would like to collaborate,
I would be interested in helping.  I have a complete
Progress 4GL development system for SVR4 (Unisys) Unix and
CTOS (both version 6) and a development set for Windows 3.11
(version 7 for Workgroups  ...  See how long ago it's been?!)

Anyways, Good luck!
-Sneex-  :]
________________________________________________________________________
Bill Jones  |  FCCJ Webmaster  |  http://www.fccj.org/cgi/mail?webmaster
FCCJ  |  501 W State St  |  Jacksonville, FL 32202  |  1 (904) 632-3089

         Jacksonville Perl Mongers
         http://jacksonville.pm.org
         jax@jacksonville.pm.org


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

Date: Mon, 5 Apr 1999 21:18:55 -0700
From: "R. Riley" <rileyr@u.washington.edu>
Subject: Script to run ftp
Message-Id: <Pine.A41.4.10.9904052116250.16652-100000@dante04.u.washington.edu>

Does anyone have any perl scripts to run ftp (for downloading multiple
files) on unix? Thanks.
R.



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

Date: Mon, 05 Apr 1999 20:33:04 -0600
From: Todd LaWall <toddl@SiTeraNOSPAM.com>
Subject: Re: Sorting lines.
Message-Id: <3709725F.71B6BCDF@SiTeraNOSPAM.com>

jambutter@my-dejanews.com wrote:
> 
> I want to sort the lines of a file, is there anyway to do this 
> without using an array?

Probably.  But since it's the end of the day, and I'm a little fried,
I'm not going to try to think about it.  I'll just answer you're
question below instead...

> I've assumed so and am trying to use an array. Each element of the 
> array will be something like "abc.def". I want to sort on everything
> after the '.' (if equal, ideally, I'd like to then search on 
> everything before the '.').
> 
> This is what I've tried so far:
> 
> @array = sort by_afterdot @array.
> 
> sub by_afterdot
> {
>         $a =~ /\./;
>         $a = $';
>         $aa = $`;
> 
>         $b =~ /\./;
>         $b = $';
>         $bb = $`;
> 
>         ($a cmp $b) || ($aa cmp $bb);
> }
> 
> Unfortunately, I do not seem to get anywhere near the result I want 
> when I do a print.
> 
> What am I doing wrong?

Well, for starters, I'm going to take a stab at saying that you've done 
something to sabotage your sort: you've modified the actual data you're
trying to sort.  The book states that $a and $b should not be modified
because they are passed in by reference, so I'm going to suggest that
you change the temp variables you use to avoid problems.  If I were to
rewrite your code, I might do something like (and yes, I tested it):

sub by_afterdot {
        $a =~ /\./;
        $temp_a = $';
        $temp_aa = $`;

        $b =~ /\./;
        $temp_b = $';
        $temp_bb = $`;

        ($temp_a cmp $temp_b) || ($temp_aa cmp $temp_bb);
}


> Also, if I am trying to get everything after the . of a string, is 
> the method I've used best?  Or should I use split?

It works, so change it only if you wish.  I suspect it might increase
your run time, due to an extra function call, but that's only 
speculation.

HTH,
Todd
--
use Disclaimer qw(This is my own opinion not my employers);


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

Date: Mon, 05 Apr 1999 23:01:36 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: System Info script
Message-Id: <37097920.0@usenet.fccj.cc.fl.us>

[Posted and Mailed]

In article <3708B50F.99B7378C@ssa.gov>, scott kelsey <scott.kelsey@ssa.gov>
wrote:


> Greetings -- Does anyone have an example of a perl script that will
> check a server for system information?  I would like to come in in the
> morning and have an e-mail that shows me: uptime, df-k, processes
> running, etc.on a specific server.
>
> What I would eventually want is to have one e-mail that tells me the
> system information of 5 or 6 different servers that we have running.
> This might be a problem from a security standpoint.  Unless you can get
> a perl scripts to send e-mail to one server and tie all the e-mails
> together and send it the e-mail out  in the morning.
>
> Thanks in advance,
>
> Scott Kelsey
> scott.kelsey@ssa.gov
>


OK.  Here is something to get you started:

#!/usr/bin/perl -w

#
# SysAdmin-eMailer.pl...  Mails Systems Status Info, regularly via CRON...
# Written by Bill Jones, FCCJ Webmaster; 16 May 1998 @ 20:45...
#

use Mail;
use strict;

my $myMail = Mail::new;

$myMail->{from} = 'you@your.host.org';
$myMail->{reply} = 'you@your.host.org';
$myMail->{to} = 'whoever';
$myMail->{subject} = "Update at @{[scalar localtime]}";
$myMail->{server} = "your.mailsrv.org";
#$myMail->{message} = qq{System Info for @{[`hostname` =~ /(.*)/]}:
$myMail->{message} = qq{System Info for @{[`hostname`]}:

Summary of Disk Free Space [df -ka]:
@{[`df -ka`]}

____________________________________________________________
Users Currently Logged-in [who]:
@{[`who`]}

System & Users Up-time [w]:
@{[`w`]}

Last 50 Accesses:
@{[`last -50`]}

____________________________________________________________
Current SECURE file:
@{[`cat /var/log/secure`]}

____________________________________________________________
Network Status [-r option]:
@{[`netstat -r`]}

Network Statistics (TCP, UDP, etc; plus UU, Serial, PPP, & others) -
nstat:
@{[`nstat`]}

mailstats:
@{[`mailstats`]}

statserial:
@{[`statserial -n`]}

uustat:
@{[`uustat`]}

vmstat:
@{[`vmstat`]}

PPP Statistics:
@{[`/usr/sbin/pppstats -v`]}

____________________________________________________________
Printer(s) Status:
@{[`/usr/sbin/lpc status`]}

____________________________________________________________
Process Status:
@{[`ps ax ; ps ex`]}

____________________________________________________________
And finally, your Fortune:
@{[`/usr/games/fortune`]}

____________________ END of Report _________________________
};

# How many copies to send?  Will always send at least 1...
my $nctr = 1;

while (1) {
my $retcode = Mail::send;
#   print "$retcode\n";

   last if ($nctr++ > -1);
}
# End of script...


The above works great under Solaris 2.5.1; but you should
be able to port it to just about anything.

Also, adding the code to have it travel around to
each server in turn to collect data is no biggie.

HTH,
-Sneex-  :]
________________________________________________________________________
Bill Jones  |  FCCJ Webmaster  |  http://www.fccj.org/cgi/mail?webmaster
FCCJ  |  501 W State St  |  Jacksonville, FL 32202  |  1 (904) 632-3089

         Jacksonville Perl Mongers
         http://jacksonville.pm.org
         jax@jacksonville.pm.org


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

Date: Mon, 5 Apr 1999 18:33:11 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: This proverbial "perldoc".
Message-Id: <MPG.11730436ae925377989841@nntp.hpl.hp.com>

In article <7eblks$s1e$2@client2.news.psi.net> on 6 Apr 1999 00:48:28 
GMT, Abigail <abigail@fnx.com >says...
> Bob Trieger (sowmaster@juicepigs.com) wrote on MMXLIII September MCMXCIII
> in <URL:news:7ebb64$l0e$1@fir.prod.itd.earthlink.net>:
 ...
> :: On you *nix machine, type "which perl" go to the directory it gives you and 
> :: try it there.
> 
> So, this should work?
> 
>     `which perl`doc `which perl`doc
> 
> :: It is most likely there but the directory it resides in is not in your path.
> 
> If it isn't in your path, and perl resides in the same directory, you
> aren't likely to run perl either..... Of course, if it isn't in your
> path, which won't find it....

But `whereis perl` might find it.  It doesn't use your path, looks in a 
list of standard places, and takes a lot longer than `which`.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 05 Apr 1999 21:39:36 -0400
From: Jason Hissong <jhisson1@columbus.rr.com>
Subject: Re: Unpack Question
Message-Id: <370965D8.B2657D11@columbus.rr.com>

David Delikat wrote:

> using unpack to comunicate with C can be stessfull.
>
> I spend a day trying to get my data to transfer successfully.
> ( 30 some fields. )  essentially if all you have is those
> three, yopu only need to determine how each is truely being
> stored.  a sizeof(_example) will give you a few clues, like
> is the compiler padding the structure.  also take a look at the
> binary data that perl is getting.  this should be some simple
> detective-work.  however, if your structure is more complicated
> ( has different sized integers, floats, and strings ) I recommend
> re-organizing.  chances are your compiler is trying to optimize
> the structure ( if you can turn it off, try that too. )  the best
> organization I found was numeric itens first ordered largets bit
> count to smallest.  followed by all strings in any particualr order.
>
> basically something like this:
>
> double a,b,c;
> long d,e,f;
> int g,h,i;
> char j,k,l;
> char m[32],n[10],o[16];
>
> that will make the required detective work much more basic,
> because all of the padding ~should~ be concentrated into the points
> between the various types.
>
> good luck
>
> -dav
>
> --
> <((((><
> Consultant: Internet, Database, Business Systems
> Unix/Linux, Windows95/NT
> mailto:david-delikat@usa.net / http://obj.webjump.com/

David,

Thanks for your information.  Assuming that the first 16 bits are the first
unsigned short, and the next 32 bits were the long in my example structure,
how would I access the sub-elements of that unsigned short?  i.e., I only
want the first 5 bits in a scaler, the next 5 in another scaler, and then
the last 6 bits in another scalar.  These bits are numbers:

00011  00010 000111

The first set would be the number 3
The second set would be the number 2
The third set would be the number 7

I am wondering if I need to unpack them as binary bits:

"b5 b5 b6"

and then pack them somehow into something meaningful...

Your right, it can be stressful  :)

thanks

Jason



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

Date: Tue, 06 Apr 1999 01:37:47 GMT
From: stephen@netwin.co.nz
Subject: Re: Web Mail
Message-Id: <7eboha$qvf$1@nnrp1.dejanews.com>

 > Does anyone have Perl script for making Web mail under FreeBSD? Or
 where to > find it?
>
 > Thanks.

Netwin provide some good programs for adding web mail that work with any
standard mail server. For info http://netwinsite.com

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

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

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