[22582] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4803 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 2 00:06:03 2003

Date: Tue, 1 Apr 2003 21:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 1 Apr 2003     Volume: 10 Number: 4803

Today's topics:
    Re: CGI::ContactForm 1.03 - Feedback request <tore@aursand.no>
    Re: modules using modules - shared objects <nwzmattXX@XXnetscape.net>
    Re: MSWin32 Active State Perl Question <kalinabears@hdc.com.au>
    Re: MSWin32 Active State Perl Question <goldbb2@earthlink.net>
    Re: Need Help : Pass ing Variables between a Script and <bwalton@rochester.rr.com>
        Not a perl script at XXX <morden@shadows.net>
    Re: Not a perl script at XXX <goldbb2@earthlink.net>
    Re: Not a perl script at XXX <grazz@nyc.rr.com>
    Re: Not a perl script at XXX <grazz@nyc.rr.com>
        OT: Regex - hard or soft 'g' (Tom Beer)
    Re: OT: Regex - hard or soft 'g' <goldbb2@earthlink.net>
        Perl editors (Stephen Adam)
    Re: Perl editors <bwalton@rochester.rr.com>
    Re: perl module---returning values to anothe string <noreply@gunnar.cc>
    Re: perl noob question <jurgenex@hotmail.com>
        Problem building perl on WinXP. Help! <crusader@bestweb.net>
    Re: Problem building perl on WinXP. Help! <kalinabears@hdc.com.au>
    Re: Problem with a subroutine executing another instanc <bwalton@rochester.rr.com>
        Problem with function prototype! <pengtaoli@hotmail.com>
    Re: Problem with function prototype! <grazz@nyc.rr.com>
    Re: Regex - hard or soft 'g' <jkeen@concentric.net>
    Re: Regex - hard or soft 'g' <kalinabears@hdc.com.au>
        Sample Perl module with callback functions <sun_tong@users.sourceforge.net>
    Re: Sending quit <doherty0@nospam.frontiernet.net>
    Re: Test / Performance benchmarking position available  <jkeen@concentric.net>
    Re: trouble with "Hello, World!" script <goldbb2@earthlink.net>
    Re: use modules with same namespace <jkeen@concentric.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 02 Apr 2003 05:04:39 +0200
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: CGI::ContactForm 1.03 - Feedback request
Message-Id: <pan.2003.04.01.19.01.31.601457@aursand.no>

On Tue, 01 Apr 2003 11:57:01 +0200, Gunnar Hjalmarsson wrote:
> I want to keep it simple. *Very* simple.

The users wants *options*.  There is _NOTHING_ stopping you from giving
them what you're already giving them, _and_ giving something extra to
those who want that.

The only thing you need to do, and that's something I would suggest you'd
do anyway, is to separate the HTML code from the Perl code.

You wanted suggestions/feedback.  Stop whining when you get some.


-- 
Tore Aursand


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

Date: Wed, 02 Apr 2003 04:29:11 GMT
From: Matt <nwzmattXX@XXnetscape.net>
Subject: Re: modules using modules - shared objects
Message-Id: <upto5vg8q.fsf@XXnetscape.net>

Benjamin Goldberg <goldbb2@earthlink.net> writes:

> Matt wrote:
<snip>
> > 
> > It does. Thanks, this is helping me a lot. Can you explain what
> > `Mixin' is/does. Whats going on with line 8? It translates into:
> > 
> >         @{ "DBI::db::MyDBI Mixin::ISA" } = ( "MyDBI", "DBI::db" );
> 
> The term "Mixin" isn't perl specific -- it refers to defining a class
> which only defines methods, without adding data.  

No wonder I couldn't find any perl docs about it.

> It comes from
> languages where true multiple inheritance (where two or more different
> ancestor classes both define member data) is illegal, due to the
> complications that can arise.
 ...
> (Unlike the normal sense of mixin, it's MyDBI that's acting as a mixin
> class, and "...::MyDBI Mixin" isn't itself a mixing, but is using one.)

I think I get it.

> 
> ################
> 
> I would seriously suggest that you *not* write code like in the example
> bit that you quoted.  Instead, write it like the following:
> 
> package MyDBI;
> @MyDBI::db::ISA = "DBI::db";
> @MyDBI::st::ISA = "DBI::st";
> sub MyDBI::db::selectSomething {
>    my $dbh = shift;
>    ($dbh->selectrow_array("select something from nothing"))[0];
> }
> 1;
> __END__
> 

I got it. I think I finally have a pretty good grasp on what's gooing
on. I succesfully subclassed DBI using examples based on the above and
out of the DBI.pm documentation.

Thanks to you Benjamin and also Tassilo for helping me understand it
all.

Matt
-- 
Remove the X's to reply directly.


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

Date: Wed, 2 Apr 2003 11:17:12 +1000
From: "Sisyphus" <kalinabears@hdc.com.au>
Subject: Re: MSWin32 Active State Perl Question
Message-Id: <3e8a3afa$0$17498@echo-01.iinet.net.au>


"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3E88F92E.80EC515A@earthlink.net...

>
> I'm afraid that alarm() doesn't work on windows.  At all.  Not just, it
> doesn't work with STDIN, it just doesn't work.
>

That's true as regards pre-5.8 perl. But alarm() works fine on windows with
perl 5.8 (which I presume is what the op means by "5.008").

<snip>

> PS: Since alarm() doesn't work on windows, Sisyphus's suggested code
> can't possibly work, even though it uses the Term::ReadKey::ReadKey()
> function.  You have to use the timeout functionality that the ReadKey()
> itself provides, rather than trying to use alarm().
>

The code I posted works on 5.8. I tested it (my apologies for not mentioning
that)...... though I have no problem with the option you suggest (except
that I haven't tested it :-)

On win2k, the following code won't alarm out until after the 'enter' key has
been pressed, no matter how long I wait before hitting that key. (If I wait
more than 3 seconds it alarms out as soon as the 'enter' key is hit).

alarm(3);
<STDIN>;
for(;;){}

Cheers,
Rob




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

Date: Tue, 01 Apr 2003 21:32:35 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: MSWin32 Active State Perl Question
Message-Id: <3E8A4BC3.DB3A256A@earthlink.net>

Sisyphus wrote:
> Benjamin Goldberg wrote:
> 
> > I'm afraid that alarm() doesn't work on windows.  At all.  Not just,
> > it doesn't work with STDIN, it just doesn't work.
> 
> That's true as regards pre-5.8 perl. But alarm() works fine on windows
> with perl 5.8 (which I presume is what the op means by "5.008").

Whoops, I completely missed that part of the OP's post.

-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}


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

Date: Wed, 02 Apr 2003 02:59:17 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Need Help : Pass ing Variables between a Script and a Perl Module.
Message-Id: <3E8A51F9.2030301@rochester.rr.com>

KP wrote:

> I'm having problem figuring out how to Pass Variables between a Script
> and Perl Module.
> 
> When everything is in the same scope I had no problems. I moved two


Given the magnitude of problems below, I seriously doubt that.  Or did 
you retype you code for your note?  If so, don't do that -- always cut 
and paste working code.


> functions into the Perl Module and now I keep getting Can't call
> method "Result" on an undefined value.


You should check the result of your method calls to make sure they were 
successful.  Adding ... or die("Oops, the programmer blew it, $!" to the 
end of the statement usually works.


> 
> Trying to have Main.PL begin and call the First Function after it
> completes it then calls the Second Functino which resides in the Perl
> Module. Once complete it executes the Third Function and so on. When
> variables being passing in Main.PL I'm not having a problem with. The
> Perl Module sees $Var1 and $Var2 and it works but after that Function
> completes I can't get it to Pass the variable so that Functions 3 - 6
> can use $Var1 and $Var2.
> 
> #/// Main.PL ///#


use strict;
use warnings;


> First( );

> my $Var1,$Var2 = Perl::Second(\$Var1,\$Var2);

(---^
)---------------^
$Var1 and $Var2 are undef here.  That seems unlikely to be what you 
want.  If they aren't undef, then you don't want the my.


> my $Var3 = Third(\$Var1,\$Var2);
> my $Var4 = Third(\$Var1,\$Var2,$Var3);
> my $Var5 = Third(\$Var1,\$Var2,,$Var3,$Var4);
> my $Var6 = Third(\$Var1,\$Var2,Var5);

$--------------------------------^


> 
> sub First
> {
> Print "This is the First Function";

p-^


>    
> }
> 
> sub Third
> {
> My $Var1Ref = shift;

m-^


> My $Var2Ref = shift;            

m-^


> 
> $$Var1Ref->Result
>     (
>     E_FAIL,

where is this supposed to be defined?


>     ERROR_TYPE_HRESULT,
>     __WFILE__,

where is this supposed to be defined?


>     __LINE__,
>     "FAIL",
>     $$Var2Ref
>     );
> }
> 
> ... Snippet 
> 
> #/// Perl.PM ///#
> package Perl;
> use Exporter();
> @ISA = qw(Exporter);
> @EXPORT = qw(ERROR_TYPE_HRESULT);
> use constant ERROR_TYPE_HRESULT => 1;

move use constant to main program -- that's where you use that constant

use warnings;
use strict;
use Win32::OLE;


> 
> sub Second
> {
> My $Var1Ref = shift;

m-^


> My $Var2Ref = shift;           

m-^


> 
> $$Var1Ref = Win32::OLE->new
>     (
>     'Logger.Log'
>     );

         or die("Oops, couldn't start Logger.Log, $!");


>  
> $$Var2Ref = $$Var1Ref ->Create
>     (
>     '$Console'
>     );

         or die("Oops, blah blah, $!";


> 
> $$Var1Ref ->Start
>     (
>     "File",
>     $$Var2Ref
>     );        

         or die("Oops, ..., $!";


> }  

1;


> 
> ... Snippet
> 
> 
> I'm still pretty new to perl so any help on how to achieve this would
> be greatly appreciated. I have read other posts on this Topic in
> Google Groups but none of the answers or snippets made any sense to
> me.
 ...


>  KP
> 

-- 
Bob Walton



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

Date: Tue, 01 Apr 2003 17:16:23 -0800
From: morden <morden@shadows.net>
Subject: Not a perl script at XXX
Message-Id: <b6d7fv$825$1@bob.news.rcn.net>

WTF is this?

perl -d /sbin/sptimpd.pl
Not a perl script at /sbin/sptimpd.pl line 1.

I've tried different things including removing
#!/usr/bin/perl
on the first line to no avail.

What's wrong with it? I have 5.6.1 installed on that RedHat box.



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

Date: Tue, 01 Apr 2003 18:56:05 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Not a perl script at XXX
Message-Id: <3E8A2715.F2F116F8@earthlink.net>

morden wrote:
> 
> WTF is this?
> 
> perl -d /sbin/sptimpd.pl
> Not a perl script at /sbin/sptimpd.pl line 1.
> 
> I've tried different things including removing
> #!/usr/bin/perl
> on the first line to no avail.
> 
> What's wrong with it? I have 5.6.1 installed on that RedHat box.

According to perldoc perldiag:

     Not a perl script 
          (F) The setuid emulator requires that scripts have a well-formed #! line even on
          machines that don't support the #! construct. The line must mention perl. 

Either you've mistakenly set the setuid bit for the perl script, or
you want setuid, but you've got a spurious \r on the #! line.

The easiest fix would be to change the #! line to "#!/usr/bin/perl -w"

-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}


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

Date: Wed, 02 Apr 2003 01:13:46 GMT
From: Steve Grazzini <grazz@nyc.rr.com>
Subject: Re: Not a perl script at XXX
Message-Id: <ePqia.286$n95.594343@twister.nyc.rr.com>

morden <morden@shadows.net> wrote:
> WTF is this?
> 
> perl -d /sbin/sptimpd.pl
> Not a perl script at /sbin/sptimpd.pl line 1.
> 

Looks like the error comes from the setuid emulation code.

    ~/suid > ls -l
    total 8
    -rwsr-xr-x    1 grazz    users          11 Apr  1 19:56 bang
    -rwsr-xr-x    1 grazz    users          11 Apr  1 19:59 db
    -rwsr-xr-x    1 grazz    users           0 Apr  1 19:58 missing
    -rwsr-xr-x    1 grazz    users          16 Apr  1 19:56 opts
    ~/suid > cat opts
    #!/usr/bin/perl
    ~/suid > perl -d opts
    Args must match #! line at opts line 1.
    ~/suid > perl missing
    No #! line at missing line 1.
    ~/suid > cat bang 
    #!/bin/foo
    ~/suid > perl bang
    Not a perl script at bang line 1.
    ~/suid > cat db 
    #!/usr/bin/perl -d
    ~/suid > perl -d db
    No -d allowed while running setuid.
    ~/suid > perl -v

    This is perl, v5.8.0 built for i686-linux

So you'll probably have to turn off the setuid before 
running this in the debugger.

-- 
Steve


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

Date: Wed, 02 Apr 2003 01:24:27 GMT
From: Steve Grazzini <grazz@nyc.rr.com>
Subject: Re: Not a perl script at XXX
Message-Id: <fZqia.331$n95.598329@twister.nyc.rr.com>

Steve Grazzini <grazz@nyc.rr.com> wrote:
> morden <morden@shadows.net> wrote:
>> WTF is this?
>> 
>> perl -d /sbin/sptimpd.pl
>> Not a perl script at /sbin/sptimpd.pl line 1.
> 
>     ~/suid > perl -d db
>     No -d allowed while running setuid.
> 
> So you'll probably have to turn off the setuid before 
> running this in the debugger.
> 

Afterthought:

      $ perl -de "do '/sbin/sptimpd.pl'"

-- 
Steve


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

Date: 1 Apr 2003 16:25:29 -0800
From: tom.beer@btfinancialgroup.com (Tom Beer)
Subject: OT: Regex - hard or soft 'g'
Message-Id: <aa52b6f.0304011625.4519b1a6@posting.google.com>

Hi all,

How does one pronounce "regex"? Is the 'g' hard (as in "regular"), or
is it soft.

I understand the etymology, but something inside me wants to make the
'g' soft and I was wondering what the generally accepted pronunciation
before I embarras myself.

Thanks,

Tom.


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

Date: Tue, 01 Apr 2003 21:31:08 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: OT: Regex - hard or soft 'g'
Message-Id: <3E8A4B6C.9624EBEA@earthlink.net>

Tom Beer wrote:
> 
> Hi all,
> 
> How does one pronounce "regex"? Is the 'g' hard (as in "regular"), or
> is it soft.
> 
> I understand the etymology, but something inside me wants to make the
> 'g' soft and I was wondering what the generally accepted pronunciation
> before I embarras myself.

I generally pronounce the 'g' in "regex" as a 'j' sound.

-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}


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

Date: 1 Apr 2003 16:11:21 -0800
From: 00056312@brookes.ac.uk (Stephen Adam)
Subject: Perl editors
Message-Id: <945bf980.0304011611.10dc15de@posting.google.com>

Hi guys and girls 

I have been coding in Perl for a good few months now, though I started
of with Delphi. The Delphi editor has facilities for break points,
step through, high lighting of key words etc.

I know there are editors available for Perl have these functions and
am hoping I could get some advice on which one I should use. I am
programing under windows XP and want an editor which will be easy to
use for a programer relatively new to Perl though I would like as much
functionality as possible.

Thanks in advance for your advice

Steve


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

Date: Wed, 02 Apr 2003 01:24:04 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Perl editors
Message-Id: <3E8A3BB2.4040400@rochester.rr.com>

Stephen Adam wrote:

>

 ...
> I know there are editors available for Perl have these functions and
> am hoping I could get some advice on which one I should use. I am
> programing under windows XP and want an editor which will be easy to
> use for a programer relatively new to Perl though I would like as much
> functionality as possible.
 ...

> Steve
> 

Try VIM:  www.vim.org

-- 
Bob Walton



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

Date: Wed, 02 Apr 2003 01:22:08 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: perl module---returning values to anothe string
Message-Id: <b6d75b$42dsi$1@ID-184292.news.dfncis.de>

ramesh wrote:
> I want to create my own perl module.  How can i do that.

Why do you post the same question again, moreover in a new thread? You 
got a reply to the other post. In addition to that, this is an 
applicable URL:
http://www.perldoc.com/perl5.8.0/pod/perlfaq7.html#How-do-I-create-a-module-

/ Gunnar

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Wed, 02 Apr 2003 01:56:09 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: perl noob question
Message-Id: <Zqria.15158$pW1.4345@nwrddc01.gnilink.net>

banjo wrote:
> I want to append the name of an array with a counting variable
> so that a new array is created each time the loop executes,giving,

Not A Good Idea(TM)! Actually a very bad idea.

Please read PerlFAQ7:  "How can I use a variable as a variable name?" about
why you don't want to do that (although you may think you want to) and what
to do instead.

jue




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

Date: Wed, 02 Apr 2003 00:42:21 -0000
From: Bill <crusader@bestweb.net>
Subject: Problem building perl on WinXP. Help!
Message-Id: <Xns9350C874DC6B2crusaderbestwebnet@216.168.3.50>

I am new to the concept of building sources. I am trying to build perl 
5.8.0 in Windows XP with the Mingw32 GCC version 2.95.2 and dmake-4.1pl1-
win32 as told in the perl readme.win32. I followed all of the directions. 
The only thing I was really stuck on was how to get the ENVIRONMENT 
VARIABLES in the config.mk in dmake configured for Ming32 GCC. There was 
no corresponding file in the distribution. I left the configuration like 
this:
   
   OS            	*:= win32
   OSRELEASE     	*:= borland
   OSENVIRONMENT 	*:= bcc50
What do I put for osrelease and osenvironment when using  Mingw32 GCC?

Anyway this is what happened when I tried too build. Can anyone tell me 
whats happening?

Thanks,

Bill

D:\download\latestperl\perl-5.8.0\win32>dmake
del /f config.h
Could Not Find D:\download\latestperl\perl-5.8.0\win32\config.h
copy config_H.vc config.h
        1 file(s) copied.
cl -c  -nologo -Gf -W3 -I..\lib\CORE -I.\include -I. -I.. -DWIN32 -
D_CONSOLE -DN
O_STRICT  -DPERLDLL -DPERL_CORE                  -MD -DNDEBUG -O1 -
DPERL_IMPLICI
T_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX -Foperlglob.obj 
perlglob.c
'cl' is not recognized as an internal or external command,
operable program or batch file.
dmake.exe:  Error code 1, while making 'perlglob.obj'

PS: This is what dmake puts out from its -V command incase it means 
anything.

C:\Documents and Settings\William>dmake -V
dmake.exe - Copyright (c) 1990,...,1997 by WTI Corp., Version 4.10, PL 1

Default Configuration:
        MAXLINELENGTH := 20460
        MAXPROCESSLIMIT := 16
        .IMPORT .IGNORE: ROOTDIR
        .MAKEFILES : makefile.mk makefile
        .SOURCE    : .NULL
        MAKESTARTUP := $(MAKECMD:d)startup/startup.mk



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

Date: Wed, 2 Apr 2003 12:30:24 +1000
From: "Sisyphus" <kalinabears@hdc.com.au>
Subject: Re: Problem building perl on WinXP. Help!
Message-Id: <3e8a4c22$0$17497@echo-01.iinet.net.au>


"Bill" <crusader@bestweb.net> wrote in message
news:Xns9350C874DC6B2crusaderbestwebnet@216.168.3.50...
> I am new to the concept of building sources. I am trying to build perl
> 5.8.0 in Windows XP with the Mingw32 GCC version 2.95.2 and dmake-4.1pl1-
> win32 as told in the perl readme.win32. I followed all of the directions.
> The only thing I was really stuck on was how to get the ENVIRONMENT
> VARIABLES in the config.mk in dmake configured for Ming32 GCC.

You should not edit that file. All the required configuring is achieved by
editing 'makefile.mk' in the Win32 folder. Then cd to that folder and run
'dmake' ...... or does one have to run 'dmake makefile.mk' ..... I can't
remember, though I *think* it's the first of those two.

<snip>
> 'cl' is not recognized as an internal or external command,
> operable program or batch file.
> dmake.exe:  Error code 1, while making 'perlglob.obj'
>

It thinks you're using the msvc compiler. (This is one of the things taken
care of in the 'makefile.mk' configuration.)

You might also need to edit the 'non-configurable' section of 'makefile.mk'.
In some notes I have regarding the building of 5.6.1 with gcc (on Win2k,
btw) I find:
---------------------------------------------------
"changed line ~ 422 from:
OPTIMIZE  = -g -O2
LINK_DBG  =

to:
OPTIMIZE  = -O2
LINK_DBG  =

Otherwise you get a very big perl.exe and perl56.dll."
---------------------------------------------------------

I can't remember whether the same advice applied also to 5.8.
I could send you a copy of the makefile.mk I used (and those notes) if you
think it would help. Just let me know.

For source code, it's a good idea to get the latest ActiveState source from
their website as it incorporates the latest patches.

gcc-built perl is nice, though slightly bigger and marginally slower than
that built by the mega-bucks msvc++ compilers.
Stick with it :-)

Cheers,
Rob




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

Date: Wed, 02 Apr 2003 00:17:43 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Problem with a subroutine executing another instance of itself
Message-Id: <3E8A2C25.8010709@rochester.rr.com>

Jay wrote:

> Hi,
> 
> I am trying to do a simple script that would perform the same action as the
> good old "copy-paste" from windows, but it seems that I am having trouble
> with it being recursive. Here is my current code:
 ...
> Dje
 ...


Add the lines:

     use strict;
     use warnings;

to the beginning of your program.  When you have cleared up all the 
errors which show then, post another note if it doesn't work then. 
Hint: recursive subs don't usually work well with global variables.
-- 
Bob Walton



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

Date: Wed, 2 Apr 2003 10:34:50 +0800
From: "Franklin Lee" <pengtaoli@hotmail.com>
Subject: Problem with function prototype!
Message-Id: <b6di8f$otd@netnews.proxy.lucent.com>

Hello All,

I find that the use of prototype in class and process programing are
different.
Who can tell me the detail reason?
The test program is below:
****************************************************************************
*
package ABC;

sub new()
{
 ...
}

sub a1(\@)
{
  my $self = shift;
  my $a = shift;
  foreach $value(@$a)
  {
    print("$value \n");
  }
}

sub a2(\@)
{
   my $a = shift;
   foreach $value(@$a)
   {
     print($value \n");
   }
}
1;

package main;
my @n=(1,2,3,4);
my $abc = new ABC;
$abc->a1(\@n);
ABC::a2(@n);
*********************************************************************
I think function a1&a2 are all prototype.
But I can't use $abc->a1(@n) or ABC::a2(\@n).
So I want to know these two prototype's defference.
If I use object programing, the prototype will be defferent? and why?

Thank you in advacne!

Franklin




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

Date: Wed, 02 Apr 2003 04:23:46 GMT
From: Steve Grazzini <grazz@nyc.rr.com>
Subject: Re: Problem with function prototype!
Message-Id: <mBtia.501$n95.660689@twister.nyc.rr.com>

Franklin Lee <pengtaoli@hotmail.com> wrote:
> 
> I find that the use of prototype in class and process 
> programing are different.

That's a mild way of putting it. :)

  $ perldoc perlsub

  Prototypes

  Perl supports a very limited kind of compile-time argument
  checking using function prototyping. [...]

  Method calls are not influenced by prototypes either,
  because the function to be called is indeterminate at
  compile time, since the exact code called depends on
  inheritance.

-- 
Steve


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

Date: 02 Apr 2003 02:01:51 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: Re: Regex - hard or soft 'g'
Message-Id: <b6dgaf$5q7@dispatch.concentric.net>


"Tom Beer" <tom.beer@btfinancialgroup.com> wrote in message
news:aa52b6f.0304011625.4519b1a6@posting.google.com...
> Hi all,
>
> How does one pronounce "regex"? Is the 'g' hard (as in "regular"), or
> is it soft.
>
> I understand the etymology, but something inside me wants to make the
> 'g' soft and I was wondering what the generally accepted pronunciation
> before I embarras myself.
>
Either is acceptable, provided you remember that in "regexp," the "p" is
silent.




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

Date: Wed, 2 Apr 2003 12:36:07 +1000
From: "Sisyphus" <kalinabears@hdc.com.au>
Subject: Re: Regex - hard or soft 'g'
Message-Id: <3e8a4d78$0$17503@echo-01.iinet.net.au>


"James E Keenan" <jkeen@concentric.net> wrote in > >
> Either is acceptable, provided you remember that in "regexp," the "p" is
> silent.
>

Ah, yes ...... this is perl ...... there's more than one way to say it.
:-)

Cheers,
Rob




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

Date: Wed, 02 Apr 2003 03:26:35 GMT
From: * Tong * <sun_tong@users.sourceforge.net>
Subject: Sample Perl module with callback functions
Message-Id: <LLsia.5276$9I.493807@news20.bellglobal.com>

Hi, 

Can somebody give me an example of Perl module that allow user
define their own callback functions? 

I was trying to find one on the net, the following is the closest
that I find, but it is clammed to be not working. Please comment on
the code, or give me another cookie-cutter. 

Thanks

- - - - >8 - - - -
by Frank Hale on 1999-11-21

How do you go about executing a reference to a method?
I mean I have coded a small module which uses a
callback. I want it to execute the callback method but
I cannot figure out how to call the reference to a
method so the callback gets executed.

Say I have the following code:

# Junk module 
package Junk;
use strict;

sub new {

	my $proto = shift;
	my $class = ref($proto) || $proto;	
	my $self  = {};

	# All the configuration stuff
	$self->{callback} = { };
	
	bless ($self, $class);
	
	return $self;
}

sub justdoit {
	
	my $self = shift;
	
	sub { $self->{callback} };
	
}

1;

# end Junk module

 -- Here is the perl code which uses the module

#!/usr/bin/perl -w

use strict;
use Junk;

my $t = Junk->new( callback => sub { print "hi" } );

$t->justdoit();

- - - - >8 - - - -

-- 
Tong (remove underscore(s) to reply)
  *niX Power Tools Project: http://xpt.sourceforge.net/
  - All free contribution & collection


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

Date: Tue, 01 Apr 2003 23:35:38 GMT
From: Jim Doherty <doherty0@nospam.frontiernet.net>
Subject: Re: Sending quit
Message-Id: <enpia.837$wa3.749@news01.roc.ny.frontiernet.net>

Dale Bohl wrote:
> I want to check the version of sendmail that's
> running on a group of rwmote hosts with perl.
> 
> The command is "telnet $host 25" but this also
> requires a "quit" to exit the telnet.
> 
> Anyone know how I can do this from within
> a perl script?
> 

$MAIL =  IO::Socket::INET->new(Proto => "tcp", PeerAddr => $host,
                                PeerPort => 25,)  or die "can't get 
there from here";
$header = <$MAIL>;
print $MAIL "QUIT\n";
print $header;
exit 0;

> Dale



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

Date: 02 Apr 2003 01:58:06 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: Re: Test / Performance benchmarking position available in Germantown, MD
Message-Id: <b6dg3e$5qb@dispatch.concentric.net>


"ldap" <ldap1777@yahoo.com> wrote in message
news:1a3bf200.0304011503.40b31f58@posting.google.com...
> We have an entry level position available:
>
Not the right place to post jobs.  Please consult http://jobs.perl.org




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

Date: Tue, 01 Apr 2003 18:47:53 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: trouble with "Hello, World!" script
Message-Id: <3E8A2529.8BE854C0@earthlink.net>

"R. Bryant" wrote:
> 
> I have a problem with my "Hello, World!" script. Here's what it looks
> like:
> 
> print "Hello, World!\n";
> 
> It outputs exactly what I expect it to output, but it doesn't seem
> like a "real" Perl script:
> 
>     1.) it doesn't use map()
>     2.) it doesn't sufficiently resemble line noise
>     3.) if I leave my terminal for an hour and come back,
>         I still understand what my script does
> 
> If this is answered in a FAQ or perldoc somewhere, just reply with the
> relevant bits: I can't be bothered to read the actual documentation.

The first and third those things are not real requirements for Hello,
World scripts.  For example, the following Towes of Hanoi program
doesn't use map, and I *do* understand what it does, even though I wrote
it quite a while ago:

   $a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
   );{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
   ]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}

Simply looking like line noise is sufficient.  Oh, and it helps if it's
not obvious to others how or why it works.


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

Date: 02 Apr 2003 01:55:14 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: Re: use modules with same namespace
Message-Id: <b6dfu2$5q6@dispatch.concentric.net>


"peter pilsl" <pilsl_usenet@goldfisch.at> wrote in message
news:3e89f73a$1@e-post.inode.at...
>
> to split a big module into several smaller modules I use the following
way.
>
> package mymodule;
>
> use submodule1;
> use submodule2;
>
> ....
>
> where submodule1 und submodule2 is only a collection of subs.
> Cause many subs in submodule1 make calls to subs in the mainmodule and
even
> in submodule2 I didnt give submodule1 and submodule2 a own namespace, but
> also use the same namespace.
>
> So submodule1 reads like this:
>
> package mymodule;
>
> sub1{...}
> sub2{...}
>
> 1;
>
>
> It seems to work - even with mod_perl - but it doesnt seem very ok to me.
> Are there any drawbacks on this ?  (beside the fact that it isnt good
style)
>
> peter
>
One reason it's not good style is that it's confusing to other Perl folks,
at least on the face of it.  Assuming that these are all regular modules
(not OO), you have a strong potential for namespace confusion here.  You
don't appear to have placed any restrictions on which subroutines can be
imported/exported from which packages.  Apart from having smaller files, is
there a compelling reason why you wish to split your module into several
smaller ones?  If not, then I'd suggest the advantages are outweighed by the
confusion created.




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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 4803
***************************************


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