[10576] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4168 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 6 17:07:22 1998

Date: Fri, 6 Nov 98 14:00:25 -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           Fri, 6 Nov 1998     Volume: 8 Number: 4168

Today's topics:
        $a = $a <tbsmith@viper.net>
    Re: $a = $a <jbharvey@auspex.net>
    Re: $a = $a <ludlow@us.ibm.com>
    Re: Beginner needs to know how to set up perl <rootbeer@teleport.com>
    Re: CGI and Server Loads <jbharvey@auspex.net>
        CPAN mirrors using rsync? <derek_sherlock@hp.com>
    Re: Example of subclassing in Perl ?? rohanoberoi@my-dejanews.com
    Re: Form Information <rootbeer@teleport.com>
        fwdport program <rob@happy.com>
    Re: fwdport program (Erik)
    Re: generating binary equivalent <rootbeer@teleport.com>
        Getting a socket program to work. nyceyes@my-dejanews.com
    Re: Getting a socket program to work. <jbharvey@auspex.net>
    Re: Help on version 4 and version 5... (Clinton Pierce)
        Index of an element in a list? (Awrobinson)
        Inheritance weirdness in Perl <rohan.oberoi@TAKETHISOUTcornell.edu>
    Re: Inheritance weirdness in Perl (Sean McAfee)
        MacPerl Help, Please! <estepb@ipix.com>
    Re: magic increment problem <rootbeer@teleport.com>
        need help w/ binary files!!! <waleed@waleed.org>
    Re: OLE and CGI with ActiveState and Apache <rootbeer@teleport.com>
    Re: pass a file directly to stdout? <mcolbert@netgenics.knowspaaaamm.com>
    Re: Pattern matching <rootbeer@teleport.com>
    Re: perldoc dumps core for Date::Calc <rootbeer@teleport.com>
    Re: Perlmenu 4.0 <rootbeer@teleport.com>
    Re: Processing form <due@murray.fordham.edu>
    Re: Relocating Perl Home Directory <rootbeer@teleport.com>
    Re: REMOTE_USER <tbsmith@viper.net>
    Re: Shared CGI.pm from various directories <jbharvey@auspex.net>
        shift in a list context (Awrobinson)
    Re: shift in a list context (Sean McAfee)
    Re: Trouble building latest version... <rootbeer@teleport.com>
    Re: where to find irc - www gateway in perl? <rootbeer@teleport.com>
    Re: Write to an htm field from perl <Allan@due.net>
    Re: Write to an htm field from perl (Clinton Pierce)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Fri, 06 Nov 1998 14:27:05 -0600
From: Todd Smith <tbsmith@viper.net>
Subject: $a = $a
Message-Id: <36435B99.8D8A09DB@viper.net>

if Perl saw this line, would it do some assignment or ignore it like it
would a comment?

$a = $a;


--
-------------------------------------
Todd Smith
Perl Programmer - ITC^DeltaCom
tbsmith@viper.net




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

Date: Fri, 06 Nov 1998 21:12:24 GMT
From: "Justin B. Harvey" <jbharvey@auspex.net>
Subject: Re: $a = $a
Message-Id: <36436639.530C6204@auspex.net>

It would do the assignment.

It would also fail if you're using strict and you haven't defined $a,
but that's neither here or there :>
j

Todd Smith wrote:
> 
> if Perl saw this line, would it do some assignment or ignore it like it
> would a comment?
> 
> $a = $a;
> 
> --
> -------------------------------------
> Todd Smith
> Perl Programmer - ITC^DeltaCom
> tbsmith@viper.net


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

Date: Fri, 06 Nov 1998 15:16:35 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: $a = $a
Message-Id: <36436733.F8193160@us.ibm.com>

Todd Smith wrote:
> 
> if Perl saw this line, would it do some assignment or ignore it like it
> would a comment?
> 
> $a = $a;

#! /usr/bin/perl -w
use Benchmark;
$a = "itself";
$b = "";
timethese (5000000, {
    a => q{
        $a = $a;
    },
    b => q{
        $b = $b;
    },
    comment => q{
        #####
    },
})           

Benchmark: timing 5000000 iterations of a, b, comment...
         a:  2 secs ( 2.37 usr -0.01 sys =  2.36 cpu)
         b:  3 secs ( 2.62 usr  0.03 sys =  2.65 cpu)
   comment:  0 secs ( 0.13 usr -0.05 sys =  0.08 cpu)
            (warning: too few iterations for a reliable count)

It certainly seems to be doing something.  What I don't understand is
why "b" consistently takes more time that "a".

This was run with version 5.004_04 for i386-linux.

-- 
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)


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

Date: Fri, 06 Nov 1998 21:27:48 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Beginner needs to know how to set up perl
Message-Id: <Pine.GSO.4.02A.9811061322220.20411-100000@user2.teleport.com>

On Fri, 6 Nov 1998, Vivian wrote:

> Subject: Beginner needs to know how to set up perl

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

> Beginner needs to know how to set up perl
> e.g how to:
> set world-writable ("chmod a+w <dirname>").
> what does this mean?

This is actually a question about Unix, rather than one about Perl.
Although Perl has a chmod function, you're talking about the Unix chmod
command.

Get a good beginner's book on Unix. Keep reading until you know why you
hardly ever want to make a directory world-writable. Keep obtaining and
reading new books as necessary until you reach that point.

If you have other general questions on Unix, check your system's manpages.
If you have more questions beyond that, check with your local expert or
system administrator. Good luck!

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




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

Date: Fri, 06 Nov 1998 21:21:20 GMT
From: "Justin B. Harvey" <jbharvey@auspex.net>
Subject: Re: CGI and Server Loads
Message-Id: <36436851.1716FC7F@auspex.net>

So less efficient means slower? If so, not according to the mod_perl
stuff on CPAN:

> Using mod_perl and Apache::Registry requires you to be
> more careful, but it also gives new meaning to the work "quick"!

j

MBC wrote:
> 
> no!  mod_perl was designed specifically to make your web server LESS
> efficient, therefore INCREASING your server load.  seriously though,
> mod_perl is an apache module, not a perl module.  you should check with a
> group that talks about apache.  :-)
> 
> gabriel@communitech.net wrote:
> 
> > Does anyone have any experience with the effect of mod_perl
> > on the server loads, especially if the server is handling quite
> > alot of CGI processes?
> >
> > Our server loads are significant and it appears that mod_perl
> > is the answer.  Theoretically, it should help with the load
> > averages.  Can anyone speak for it in practice?
> >
> > Does mod_perl make CGI run more efficiently and reduce the
> > server load averages?
> >
> > Any feedback is appreciated.
> >
> > -----------== Posted via Deja News, The Discussion Network ==----------
> > http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own


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

Date: Fri, 06 Nov 1998 14:28:37 -0700
From: Derek Sherlock <derek_sherlock@hp.com>
Subject: CPAN mirrors using rsync?
Message-Id: <36436A04.7BF26B0F@hp.com>

Hi folks,

Is there a list anywhere of CPAN mirrors that support the rsync
protocol?  Or does anybody know of any in North America?

Derek

--
 ___ __ /___ ___    Derek Sherlock
|   /  /_ _ \   |   Fort Collins Systems Lab (FSL)
|  /  / // / \  |   3404 E. Harmony
|  \ / //_/  /  |   Fort Collins CO 80525
|___\_ /____/___|
      /             Direct: 970-898-7582
  H E W L E T T     Fax:    970-898-7388
  P A C K A R D     Email:  derek_sherlock@hp.com





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

Date: Fri, 06 Nov 1998 21:18:57 GMT
From: rohanoberoi@my-dejanews.com
To: zenin@archive.rhps.org
Subject: Re: Example of subclassing in Perl ??
Message-Id: <71vp41$og2$1@nnrp1.dejanews.com>

Zenin <zenin@bawdycaste.org> wrote:
> Mark S <msaliers@home.com> wrote:
> : Having read over the Camel book, and scanned through the www.perl.com site,
> : I still can't find anyplace where there's a simple example of how to
> : subclass in Perl.  Could someone kindly post an example?
>
> 	package Foo;
> 	sub new { return bless {}, shift }
> 	sub something { stuff }
> 	...more Foo stuff...
>
> 	package Bar;
> 	use base qw(Foo);  ## Subclass of Foo
> 	...Bar stuff...

This doesn't seem to work.  Any idea why?

opal:[~] more Foo.pm
package Foo;
sub foo {
    'qwerty';
}
1;

opal:[~] more Bar.pm
package Bar;
use base qw(Foo);
1;

opal:[~] more foo.pl
#!/usr/local/bin/perl
use lib ".";
use Foo;
print &Foo::foo, "\n";

opal:[~] more bar.pl
#!/usr/local/bin/perl
use lib ".";
use Bar;
print &Bar::foo, "\n";

opal:[~] foo.pl
qwerty

opal:[~] bar.pl
Undefined subroutine &Bar::foo called at bar.pl line 4.

opal:[~]


Regards,
Rohan.


rohan.oberoi@TAKETHISOUTcornell.edu






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


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

Date: Fri, 06 Nov 1998 21:55:34 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Form Information
Message-Id: <Pine.GSO.4.02A.9811061353020.20411-100000@user2.teleport.com>

On Fri, 6 Nov 1998, Aamir Hanif wrote:

> I can put the username and the password into an array using the code below:
> 
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

Use the CGI module to do this. Not only does it do what you want...

> @pairs = split(/&/, $buffer);
> 
> foreach $pair (@pairs)
> {
> 
>     ($name, $value) = split(/=/, $pair);
> 
>  $value =~ tr/+/ /;
>      $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> 
>  $value =~ s/~!/ ~!/g;
> 
>  $FORM{$name} = $value;
> 
> }

 ...but it does it _correctly_. Cheers!

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



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

Date: Fri, 06 Nov 1998 16:21:51 -0500
From: Rob Conrad <rob@happy.com>
Subject: fwdport program
Message-Id: <3643686F.2D2C463F@happy.com>

I downloaded a copy of fwdport by Tom Christiansen and am trying to
run it with perl 5_004.003 and get the following error "can't call
method 'name' without an object or package reference at line 144"

line 144 has $hostinfo->name

anyone run into this before with this program?
-- 


Rob Conrad                        Email: rob@happy.com
Director, Information Systems	  Web: www.happy.com
Happy Harry's, Inc.		  Phone: 302-366-0335 ext 282
315 Ruthar Dr.                    Fax:   302-283-5200
Newark, De 19711


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

Date: 6 Nov 1998 21:21:36 GMT
From: eln@cyberhighway.net (Erik)
Subject: Re: fwdport program
Message-Id: <71vp90$282$1@news.cyberhighway.net>

In article <3643686F.2D2C463F@happy.com>,
	Rob Conrad <rob@happy.com> writes:
> I downloaded a copy of fwdport by Tom Christiansen and am trying to
> run it with perl 5_004.003 and get the following error "can't call
> method 'name' without an object or package reference at line 144"
> 
> line 144 has $hostinfo->name
> 
> anyone run into this before with this program?

I've never used that program, but I'm going to guess that $hostinfo is
actually a hash reference, so using something like
$hostinfo->{'name'} might work a bit better.

-- 
Erik Nielsen, Cyberhighway Internet Services NOC

#define NULL 0           /* silly thing is, we don't even use this */
             -- Larry Wall in perl.c from the perl source code


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

Date: Fri, 06 Nov 1998 21:04:05 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: generating binary equivalent
Message-Id: <Pine.GSO.4.02A.9811061303460.20411-100000@user2.teleport.com>

On 3 Nov 1998 philchen@vza.Eng.Sun.COM wrote:

> Is there a way to get Perl5 to generate a binary executable
> for my script?  

Have you seen what the FAQ says about this? Hope this helps!

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



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

Date: Fri, 06 Nov 1998 20:07:01 GMT
From: nyceyes@my-dejanews.com
Subject: Getting a socket program to work.
Message-Id: <71vkt5$knv$1@nnrp1.dejanews.com>

Hello all:

Does anyone have a script that implements
a basic telnet session via perl? I would like
to see what the code looks like. I tried creating
a !VERY! basic telnet client based on text book client
socket samples (like the one in chapter 6 of the
Pergramming Perl), but it is not enough. The code
below shows this. This code just hangs at the
"defined(<SOCKET>)" statement when I try to connect
(i.e. it never gets into the while loop).

Please reply to: nyceyes@prodigy.net

TIA all
bye.

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


#! /usr/local/bin/perl

use Socket;

$SERVER = "totty";
chop($CLIENT = `uname -n`);
$PORT = 23;

($d1, $d2, $PROTO) = getprotobyname("tcp");
($d1, $d2, $d3, $d4, $RAWCLIENT) = gethostbyname($CLIENT);
($d1, $d2, $d3, $d4, $RAWSERVER) = gethostbyname($SERVER);

$CLIENTADDR = pack("Sna4x8", 2, 0, $RAWCLIENT);
$SERVERADDR = pack("Sna4x8", 2, $PORT, $RAWSERVER);

socket(SOCKET, 2, 2, $PROTO) || die "socket() call failed: [$!]";
bind(SOCKET, $CLIENTADDR)    || die "bind() call failed: [$!]";
connect(SOCKET, $SERVERADDR) || die "connect() call failed: [$!]";

# Connection is ESTABLISHED as confirmed by
# netstat -a command.

# Prod the connection with some key strokes.
# Does not seem to help.
$TEMP = <STDIN>;
print(SOCKET "$TEMP");

# See what the response is.
# Nothing so far.
while (defined(<SOCKET>))
{
   print ("I never get in here...\n");
   print(STDOUT "$_");
}

print ("I got here after a timeout...\n");
close (SOCKET);
exit;












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


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

Date: Fri, 06 Nov 1998 21:18:17 GMT
From: "Justin B. Harvey" <jbharvey@auspex.net>
Subject: Re: Getting a socket program to work.
Message-Id: <36436799.45003413@auspex.net>

The Net::Telnet module is great, get it on CPAN.  The module has
examples as easy as:

         my($forecast, $t);

         use Net::Telnet ();
         $t = new Net::Telnet;
         $t->open("rainmaker.wunderground.com");

         ## Wait for first prompt and "hit return".
         $t->waitfor('/continue:.*$/');
         $t->print("");

         ## Wait for second prompt and respond with city code.
         $t->waitfor('/city code.*$/');
         $t->print("BRD");

         ## Read and print the first page of forecast.
         ($forecast) = $t->waitfor('/[ \t]+press return to continue/i');
         print $forecast;

         exit;            

(example to get the weather for a city from the POD documentation of
Net::Telnet)


nyceyes@my-dejanews.com wrote:
> 
> Hello all:
> 
> Does anyone have a script that implements
> a basic telnet session via perl? I would like
> to see what the code looks like. I tried creating
> a !VERY! basic telnet client based on text book client
> socket samples (like the one in chapter 6 of the
> Pergramming Perl), but it is not enough. The code
> below shows this. This code just hangs at the
> "defined(<SOCKET>)" statement when I try to connect
> (i.e. it never gets into the while loop).
> 
> Please reply to: nyceyes@prodigy.net
> 
> TIA all
> bye.
> 
> ---------------------------------------------------------
> 
> #! /usr/local/bin/perl
> 
> use Socket;
> 
> $SERVER = "totty";
> chop($CLIENT = `uname -n`);
> $PORT = 23;
> 
> ($d1, $d2, $PROTO) = getprotobyname("tcp");
> ($d1, $d2, $d3, $d4, $RAWCLIENT) = gethostbyname($CLIENT);
> ($d1, $d2, $d3, $d4, $RAWSERVER) = gethostbyname($SERVER);
> 
> $CLIENTADDR = pack("Sna4x8", 2, 0, $RAWCLIENT);
> $SERVERADDR = pack("Sna4x8", 2, $PORT, $RAWSERVER);
> 
> socket(SOCKET, 2, 2, $PROTO) || die "socket() call failed: [$!]";
> bind(SOCKET, $CLIENTADDR)    || die "bind() call failed: [$!]";
> connect(SOCKET, $SERVERADDR) || die "connect() call failed: [$!]";
> 
> # Connection is ESTABLISHED as confirmed by
> # netstat -a command.
> 
> # Prod the connection with some key strokes.
> # Does not seem to help.
> $TEMP = <STDIN>;
> print(SOCKET "$TEMP");
> 
> # See what the response is.
> # Nothing so far.
> while (defined(<SOCKET>))
> {
>    print ("I never get in here...\n");
>    print(STDOUT "$_");
> }
> 
> print ("I got here after a timeout...\n");
> close (SOCKET);
> exit;
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own


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

Date: Fri, 06 Nov 1998 19:21:01 GMT
From: cpierce1@mail.ford.com (Clinton Pierce)
Subject: Re: Help on version 4 and version 5...
Message-Id: <36464b92.12550610@news.ford.com>

On Thu, 5 Nov 1998 19:24:41 -0800, "Rusty Williamson"
<rwilliamson@uno.gers.com> wrote:

>Hi!
>I've hit a little problem -- on the dozen or so servers we have at work,
>/usr/bin/perl on some systems is version 5, while on others its version 4
>and version 5 is /usr/bin/perl5.  We have tons of v4 scripts all starting
>out with #!/usr/bin/perl.  What are people doing?

I'm sitting at a desk, how about you?  :-)

If you're fairly sure your perl4 scripts will run under perl5 (and they
probably will), simple rename (or link) perl -> perl5.

Otherwise, to encourage the move to perl5, open up all of your perl4
scripts, and change the #! line to /usr/bin/perl4, and then make 
/usr/bin/perl the Perl v5 executable (possibly leaving a link behind
to /usr/bin/perl5).



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

Date: 6 Nov 1998 21:30:56 GMT
From: awrobinson@aol.com (Awrobinson)
Subject: Index of an element in a list?
Message-Id: <19981106163056.12673.00000184@ng14.aol.com>

Is there a built-in or effiecient way to determine the index of an element in a
list? I used the lindex[] function all the time in tcl, but I cannot find an
equivalent in perl. I know I can build one with a for loop or a foreach loop
and a counter, but that seems inefficient. It would really come in handy for
the project I'm working on now.

Thanks!

Andrew Robinson
Andrew Robinson
---
Disclaimer: The opinions expressed are mine alone and do not represent the
views of America Online


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

Date: 6 Nov 1998 21:40:51 GMT
From: Rohan Oberoi <rohan.oberoi@TAKETHISOUTcornell.edu>
Subject: Inheritance weirdness in Perl
Message-Id: <71vqd3$rl7@newsstand.cit.cornell.edu>

@ISA and "use base "  are driving me up the wall.  I've managed to
derive from a standard library package:

opal:[~] cat Baz.pm
package Baz;
use strict;
use Cwd;
use base 'Cwd';
1;
opal:[~]
opal:[~] cat baz.pl
#!/usr/local/bin/perl -w
use strict;
use lib ".";
use Baz;

print &Baz::cwd, "\n";

opal:[~] baz.pl
/home/rohan
opal:[~]     

but I can't seem to derive from a package I write:

opal:[~] cat Foo.pm
package Foo;
sub foo {
    'qwerty';
}
1;
opal:[~] cat Bar.pm
package Bar;
use strict;
use lib ".";
use vars qw(@ISA);
use Foo;
BEGIN { require Foo; @ISA = qw(Foo); }
use base qw(Foo);
1;
opal:[~] cat bar.pl
#!/usr/local/bin/perl
use lib ".";
use Bar;
print &Bar::foo, "\n";

opal:[~] bar.pl
Undefined subroutine &Bar::foo called at bar.pl line 4.
opal:[~]    



Help!!

Rohan.




opal:[~] perl -V
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
  Platform:
    osname=solaris, osvers=2.5.1, archname=sun4-solaris
    uname='sunos opal 5.5.1 generic_103640-08 sun4m sparc
sunw,sparcstation-20 '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O', gccversion=
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-Kpic', lddlflags='-G -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Built under solaris
  Compiled at Dec  4 1997 12:30:00
  @INC:
    /usr/local/lib/perl5/sun4-solaris/5.00404
    /usr/local/lib/perl5
    /usr/local/lib/perl5/site_perl/sun4-solaris
    /usr/local/lib/perl5/site_perl
    /usr/local/lib/perl5/sun4-solaris
    .
opal:[~]


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

Date: Fri, 06 Nov 1998 21:57:54 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Inheritance weirdness in Perl
Message-Id: <ChK02.5469$fS.17743907@news.itd.umich.edu>

In article <71vqd3$rl7@newsstand.cit.cornell.edu>,
Rohan Oberoi  <rohan.oberoi@TAKETHISOUTcornell.edu> wrote:
>@ISA and "use base "  are driving me up the wall.  I've managed to
>derive from a standard library package:

>opal:[~] cat Baz.pm
>package Baz;
>use strict;
>use Cwd;
>use base 'Cwd';
>1;
>opal:[~]
>opal:[~] cat baz.pl
>#!/usr/local/bin/perl -w
>use strict;
>use lib ".";
>use Baz;
>print &Baz::cwd, "\n";
>opal:[~] baz.pl
>/home/rohan

This works not because of inheritance, but because "use Cwd" imports the
cwd function into package Baz's symbol table (ie, it makes Baz::cwd a
synonym for Cwd::cwd).

>but I can't seem to derive from a package I write:

>opal:[~] cat Foo.pm
>package Foo;
>sub foo {
>    'qwerty';
>}
>1;
>opal:[~] cat Bar.pm
>package Bar;
>use strict;
>use lib ".";
>use vars qw(@ISA);
>use Foo;
>BEGIN { require Foo; @ISA = qw(Foo); }
>use base qw(Foo);

(The two above lines are redundant; they make Foo inherit twice from Cwd.)

>1;
>opal:[~] cat bar.pl
>#!/usr/local/bin/perl
>use lib ".";
>use Bar;
>print &Bar::foo, "\n";
>opal:[~] bar.pl
>Undefined subroutine &Bar::foo called at bar.pl line 4.

Inheritance only comes into play if you use one of the two method invocation
syntaxes; in this case, either

print Bar->foo, "\n";

or

print foo Bar, "\n";

will do what you want.  Check the perlobj manual page, under the heading
"Method invocation".

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: Fri, 06 Nov 1998 15:59:53 +0000
From: "Brian Estep" <estepb@ipix.com>
Subject: MacPerl Help, Please!
Message-Id: <71vo0a$tte$1@news3.icx.net>


Hi!  I have written a program that checks to see if a website is down, and
now I need to add functionality to it to page me via email.  However, I
can't seem to get MacPerl to use the standard LIBWWW mail commands (I think
they are more meant for UNIX.)  Has anyone else run into this with MacPerl? 
If so, please help, I'm at a standstill.







Brian Estep
Interactive Pictures
--------------------------------------
DIVX - Watching YOU Watch YOUR Movies!
--------------------------------------


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

Date: Fri, 06 Nov 1998 20:48:44 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: magic increment problem
Message-Id: <Pine.GSO.4.02A.9811061242480.20411-100000@user2.teleport.com>

On Fri, 6 Nov 1998, Stephen Riehm wrote:

> Is there anyone who can give a "reason" why the autoincrement can't
> be done such that:
> 	if it was used in a string context, and matches /^\w*$/ or
> /^[a-zA-Z0-9]*$/ then it gets incremented as a string, otherwise
> it gets the numerical treatment.

There's no reason why it couldn't be done that way in principle. But if it
were changed now, it could break existing programs for no good reason.

If you want your own incrementing routine, you can easily write it
yourself, so it's not as if you can't do what you want in Perl. The
built-in increment routine is merely a short cut for the common case.

> Suddenly getting a number instead of a string because you put a dodgy
> character in your string worries me.

So, don't use Perl's short cut, then; do it the long way. Cheers!

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



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

Date: Fri, 06 Nov 1998 20:47:32 +0000
From: waleed <waleed@waleed.org>
Subject: need help w/ binary files!!!
Message-Id: <36436063.39DF2E96@waleed.org>

Hello,

I have your book "Learning Perl on Win32 System". I have a perl question
and I
would appreciate it alot
if you can help me with it.

I want to read a binary file, process the data (from the binary file)
and
write it to the txt file. I wrote the
following program buit It prints strange numbers.


Myfile.omg contains (45 45 49 41 30 26.....)
I want to read it and say add to 1 to each number and write it in the
txt file
as numbers.

open(INFILE, "myfile.img") or die "open file: $!";
open(OUTFILE, ">a4.txt") or die "open file: $!";
binmode INFILE;

$line=<INFILE>;

while (<INFILE>)
{

read INFILE, $s,2;
$result= unpack("s",$s);
print OUTFILE $result, "\n";
$line<INFILE>;

}

close(INFILE);
close(OUTFILE);

Thanks alot
Oualide



____________________________________________________________________



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

Date: Fri, 06 Nov 1998 21:51:12 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: OLE and CGI with ActiveState and Apache
Message-Id: <Pine.GSO.4.02A.9811061349430.20411-100000@user2.teleport.com>

On Fri, 6 Nov 1998, Roger Kenneth Trussell wrote:

>     I'm having problems with using the OLE libraries inside my CGI
> script. It seems that once I embed references to an Automation
> object's methods and properties in a CGI script, then those references
> fail to work.  (Those same references work just fine in a stand-alone
> perl script.)

Then it's not a Perl problem; maybe your runtime environment is different
than you thought.

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.

   http://www.perl.com/CPAN/
   http://www.perl.org/CPAN/
   http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
   http://www.perl.org/CPAN/doc/manual/html/pod/

Hope this helps!

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



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

Date: Fri, 06 Nov 1998 20:16:56 GMT
From: MBC <mcolbert@netgenics.knowspaaaamm.com>
Subject: Re: pass a file directly to stdout?
Message-Id: <364367F3.2DB0E932@netgenics.knowspaaaamm.com>

Jonathan Feinberg wrote:

> bfenwick@mts.net (Brad Fenwick) writes:
>
> > I am trying to find a way to simply pass a file, unparsed, directly
> > to STDOUT.
>

first...

print "Content-type: text/html\n\n";

then...

>    open(F, '<file') || die "file: $!\n";
>    print <F>;
>    close F;

otherwise, you're server will choke.




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

Date: Fri, 06 Nov 1998 21:39:46 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Pattern matching
Message-Id: <Pine.GSO.4.02A.9811061336080.20411-100000@user2.teleport.com>

On Fri, 6 Nov 1998, Alan Dye wrote:

> Hi, Sorry I forgot to mention that I cannot use modules as the script
> needs to be portable from server to server.

There are some problems that Perl can't solve. One example of such a
problem is convincing someone that installing a module may be a good idea.

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



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

Date: Fri, 06 Nov 1998 21:57:42 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: perldoc dumps core for Date::Calc
Message-Id: <Pine.GSO.4.02A.9811061357170.20411-100000@user2.teleport.com>

On 6 Nov 1998, Charles Skip Hartley wrote:

> i have just installed the Date::Calc module, but when i 
> run perldoc Date::Calc, it dumps core with a seg fault

File a bug report with perlbug. Thanks!

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



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

Date: Fri, 06 Nov 1998 21:34:03 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perlmenu 4.0
Message-Id: <Pine.GSO.4.02A.9811061333360.20411-100000@user2.teleport.com>

On 6 Nov 1998, David Tucker wrote:

> I've tried everything in the INSTALLATION guide to fix the troubles
> that I'm having with this module.

Have you filed a bug report with the module's author? Hope this helps!

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



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

Date: 6 Nov 1998 21:46:25 GMT
From: "Allan M. Due" <due@murray.fordham.edu>
Subject: Re: Processing form
Message-Id: <71vqnh$fuv$0@206.165.167.213>


AmD wrote in message <71viu5$ja5$1@camel21.mindspring.com>...
>
>Brent Michalski wrote in message <36432CDE.D0A486B1@technologist.com>...
>>Larry Rosler posted a response to this thread.  I am responding to it
>>_before_ it got to the group because I have it up on my e-mail and the
>>code is in front of me.
>>
>>He stated:
>>
>>Is it __that__simple really?  Isn't there a problem here with barewords
>>that '-w' would complain about?
>>
>>I am testing on an NT box, but just for proof that __My__ example works
>>on __my__ system, here is my code:
>>
>>#!/usr/bin/perl -w
>>
>> use CGI qw /:standard/;
>> $email = param(email);
>> $msg   = param(message);
>> $subj  = param(subject);
>>
>>print header;
>>
>>print "<PRE>";
>>print "E-mail: $email\n";
>>print "Msg:    $msg\n";
>>print "Subj:   $subj\n";
>>
>>#### END OF CODE
>>
>>And here is the output I get:
>>
>>E-mail: e-mail here
>>Msg:    this is the message
>>Subj:   and I am the subject
>>
>>I know that the output, etc. is not pretty, I was just checking to make
>>sure it worked...
>>
>>Sooooo, since it seems to work without any errors or warnings, I can
>>safely say that my original post was correct __on NT systems__.
>>
>>Anynone have a unix system to test this on?  I can't test it on UNIX
>>until I get home...
>>
>
>
>Errors under Windows 95 Perl 5.0004_02, the latest version I have until I
>return home:
>

And now that I am home Windows 95 Perl 5.005_002 same error messages.

Lets check FreeBSD...... Hmm Perl 5004_04 and the same error messages.  Must
be a problem somewhere.

AmD



>Unquoted string "email" may clash with future reserved word at C:\EDIT7.PL
>line 4.
>Unquoted string "message" may clash with future reserved word at
C:\EDIT7.PL
>line 5.
>Unquoted string "subject" may clash with future reserved word at
C:\EDIT7.PL
>line 6.
>
>AmD
>
>




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

Date: Fri, 06 Nov 1998 21:44:53 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Relocating Perl Home Directory
Message-Id: <Pine.GSO.4.02A.9811061343040.20411-100000@user2.teleport.com>

On 6 Nov 1998, Rich Sy wrote:

> Can anyone suggest the easiest way to relocate Perl's home directory?  
> Is it as simple as changing some perl config or do I have to rebuild?

Unless you have a very simple case, you probably want to rebuild it.
Fortunately, that doesn't take long on any reasonably-fast machine. Good
luck!

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



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

Date: Fri, 06 Nov 1998 14:29:42 -0600
From: Todd Smith <tbsmith@viper.net>
Subject: Re: REMOTE_USER
Message-Id: <36435C36.877BE659@viper.net>



> while (($key, $val) = each %ENV) {
>         print "$key = $val<BR>\n";
> }

nah, do this:

print map {"$_ is $ENV{$_}<br>\n"} keys %ENV;

--
-------------------------------------
Todd Smith
Perl Programmer - ITC^DeltaCom
tbsmith@viper.net




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

Date: Fri, 06 Nov 1998 21:27:16 GMT
From: "Justin B. Harvey" <jbharvey@auspex.net>
Subject: Re: Shared CGI.pm from various directories
Message-Id: <364369B4.4DF0C3BC@auspex.net>

One way to do it...

Let's say CGI.pm is located in /home/bilbo/lib/perl/CGI.pm, you could in
every script:

use '/home/bilbo/lib/perl';
use CGI;

Voila, it should work.  Also for running stuff outta command line you
can setenv PERLLIB /home/bilbo/lib/perl.  When downloading modules you
can run their makefiles and install them into your lib directory by:

perl Makefile.PL PREFIX=/home/bilbo/ INSTALLSITELIB=/home/bilbo/lib/perl

bill_mcintyre@my-dejanews.com wrote:
> 
> I know this is probably simple but I have a brain lock on it.
> 
> i have quite a few scripts that use the CGI.pm module. To increase security
> and orderliness I have created subdirectories in CGI-BIN to store different
> types of scripts. My problem is that I can't figure out how to call CGI.pm
> from different locations. When I "USE CGI" CGI.pm seems to only work in the
> same directory as the script that is calling it. How can I have just one copy
> of CGI.pm and call it from differnet scripts in differnet directories.
> 
> TIA.
> 
> Bill McIntyre (bill_mcintyre@hotmail.com)
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own


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

Date: 6 Nov 1998 21:33:44 GMT
From: awrobinson@aol.com (Awrobinson)
Subject: shift in a list context
Message-Id: <19981106163344.12673.00000190@ng14.aol.com>

I haven't seen this stated anywhere, so I thought I would ask. Can I use a
single shift() operation to retrieve more than one element? If I coded
something like:

   sub mysub {
       ( $first, $second ) = shift;

would I get the first two elements of @_?

Thanks!


Andrew Robinson
---
Disclaimer: The opinions expressed are mine alone and do not represent the
views of America Online


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

Date: Fri, 06 Nov 1998 21:43:44 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: shift in a list context
Message-Id: <k4K02.5467$fS.17737690@news.itd.umich.edu>

In article <19981106163344.12673.00000190@ng14.aol.com>,
Awrobinson <awrobinson@aol.com> wrote:
>I haven't seen this stated anywhere, so I thought I would ask. Can I use a
>single shift() operation to retrieve more than one element? If I coded
>something like:

>   sub mysub {
>       ( $first, $second ) = shift;

>would I get the first two elements of @_?

Empiricism is dead, it seems...

Try it and see.  It'll take all of two minutes--much less time than waiting
for an answer on Usenet.  Alternately, read the "shift" entry in the
perlfunc manual page.  Either way, you'll get a definitive answer.

>Disclaimer: The opinions expressed are mine alone and do not represent the
>views of America Online

 ...Must...control...gratuitous...AOL...comment...

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: Fri, 06 Nov 1998 20:55:55 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Trouble building latest version...
Message-Id: <Pine.GSO.4.02A.9811061253090.20411-100000@user2.teleport.com>

On Thu, 5 Nov 1998, Steve Foley wrote:

> Subject: Trouble building latest version...
> 
> I'm trying to build 5.005.50 

1. That's an experimental version which should be compiled only by people
who don't need to ask for help with it. :-)  If you're not in that group,
you probably want either 5.004_04 or 5.005_02.

2. There's a newer experimental version than 5.005_50, if you really want
to be on the bleeding edge. Maybe whatever troubles you're having are
fixed in that one.

Hope this helps!

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



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

Date: Fri, 06 Nov 1998 21:47:39 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: where to find irc - www gateway in perl?
Message-Id: <Pine.GSO.4.02A.9811061347140.20411-100000@user2.teleport.com>

On 6 Nov 1998, Filipp Anthony Sapienza wrote:

> I am looking for a free Perl WWW script

If you're wishing merely to _find_ (as opposed to write) programs,
this newsgroup may not be the best resource for you. There are many
freeware and shareware archives which you can find by searching Yahoo
or a similar service. Hope this helps!

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




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

Date: Fri, 6 Nov 1998 15:06:59 -0500
From: "AmD" <Allan@due.net>
Subject: Re: Write to an htm field from perl
Message-Id: <71vkl5$k6k$1@camel21.mindspring.com>


Billsterz wrote in message <71vajf$9hs$1@nntp.erinet.com>...
>Hi all,
>
>I realize I haven't made my question very clear. Please bear with me as I
>have very little (almost no) knowledge of perl.
>
>Here's what I want to do.
>Have passdata.cgi pass a variable $form{whatever} to a field in an htm form
>it opens and displays to the user.
>The value $form{whatever}  in the form must not be static as different
>people use it.
>Now, here's the tricky part (for me):
>
>
>###### Using (abbreviated) #####
>if ($line =~ /<!--passme-->/)
>print FILE "<!--login-->$form{whatever} \n";
>
>this works...sorta...it replaces the WHOLE Line the tag is on in the htm
>file. I just want to put a variable in a text box.
>
>Please don't think I haven't tried to find this info...Oh, Lord knows I've
>tried. I'm just drawing a blank.


I would just have the script create the HTML on the fly, but that's probably
just me.  If you are processing cgi forms:  get thee CGI.pm, your problems
will be solved and your teeth will be brighter.

That being said, have you checked out your old friend the s/// operator
(perl ref)?  As you probably know it does substitutions, thus something
like:

if ($line =~ /<!--passme-->/) {
  $line =~ s/tobereplaced/$form{replacement}/;
  print $line;
}

would probably work.  You can probably make it a bit prettier too but just
trying to be pedantic.

HTH

AmD




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

Date: Fri, 06 Nov 1998 19:17:12 GMT
From: cpierce1@mail.ford.com (Clinton Pierce)
Subject: Re: Write to an htm field from perl
Message-Id: <36454940.11956854@news.ford.com>

[courtesy cc sent by E-Mail]

On Fri, 6 Nov 1998 13:04:37 -0500, "Billsterz" <bill@sterzenbach.com>
wrote:
>Hi all,
>
>I realize I haven't made my question very clear. Please bear with me as I
>have very little (almost no) knowledge of perl.

Then you probably don't need to be here asking questions.  Have you 
read the FAQ's yet?  Probably not.  Go check them out, and check out
the "Please Don't Be Offended By The Name, Idiots Guide to Perl-CGI".

>###### Using (abbreviated) #####
>if ($line =~ /<!--passme-->/)
>print FILE "<!--login-->$form{whatever} \n";
>
>this works...sorta...it replaces the WHOLE Line the tag is on in the htm
>file. I just want to put a variable in a text box.

Please don't abbreviate.  What you posted isn't Perl at all.  It 
doesn't parse.  It doesn't make sense.  Your explanation isn't too
clear either.  Spend less time groveling, and more time explaining your
problem clearly.  AFTER YOU'VE READ THE FAQ's.

>Please don't think I haven't tried to find this info...Oh, Lord knows I've
>tried. I'm just drawing a blank.

Fill in your blank: www.perl.com Click on FAQ.

>This is the last thing keeping me from completing this script.

Then your script probably has a lot of other problems.  Check out the
aforementioned FAQ's and THINK about this for a bit.  Get a copy of 
The Perl Cookbook.  Use the CGI module.


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

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

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