[22025] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4247 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 11 09:05:56 2002

Date: Wed, 11 Dec 2002 06:05:12 -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           Wed, 11 Dec 2002     Volume: 10 Number: 4247

Today's topics:
        ** WHAT URL DOES A BROWSER CONSTRUCT FROM A POST METHOD (gnuist006)
    Re: ** WHAT URL DOES A BROWSER CONSTRUCT FROM A POST ME (Jay Tilton)
    Re: Can't find MakeRegex.pm (Anno Siegel)
    Re: Can't find MakeRegex.pm (RonaldWS)
    Re: Comparison confusion <nobody@dev.null>
    Re: Complex log parsing. <goldbb2@earthlink.net>
    Re: convert a date-time to an absolute value (in second <a@b.c>
    Re: convert a date-time to an absolute value (in second (Sam Holden)
    Re: convert a date-time to an absolute value (in second <nobull@mail.com>
    Re: Determining If a Socket is Open... <goldbb2@earthlink.net>
    Re: hidden eval variables (Anno Siegel)
    Re: hidden eval variables <tassilo.parseval@post.rwth-aachen.de>
    Re: hidden eval variables (Anno Siegel)
    Re: hidden eval variables <tassilo.parseval@post.rwth-aachen.de>
    Re: Newbie question (Jay Tilton)
    Re: Newbie question (Anno Siegel)
    Re: open <David.Nowak_NS@libertysurf.fr>
    Re: open <rune.froysa@usit.uio.no>
        open2 program dies (Mike Wilson)
        Passing an object to another object <dl19@le.academicplace.intheuk>
    Re: perl bad interpreter: No such file or directory <comdog@panix.com>
    Re: perl bad interpreter: No such file or directory <flavell@mail.cern.ch>
        Perl step-thru debugger in browser? (Mike)
    Re: Perl step-thru debugger in browser? (Tad McClellan)
    Re: Problem - Array as Member of Object <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
    Re: problem with google posting causing multiple posts (maybe)
    Re: Re FAQ: How can I capture STDERR from an external c <goldbb2@earthlink.net>
    Re: The CPAN Police (was: Re: first element of a hash) <comdog@panix.com>
    Re: unknown import: lib Calc at C:/Perl/lib/Math/BigInt (Anno Siegel)
        Using Mail::Header modul for array of messages <No_Mail_Address@cox.net>
    Re: Using Mail::Header modul for array of messages <krahnj@acm.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 10 Dec 2002 22:04:03 -0800
From: gnuist006@hotmail.com (gnuist006)
Subject: ** WHAT URL DOES A BROWSER CONSTRUCT FROM A POST METHOD OF A FORM? **
Message-Id: <b00bb831.0212102204.1fb47a7e@posting.google.com>

jstokes@crmnet.org (John Stokes) wrote in message news:<BA1A75F6.3D30%
> 
> As you know, HTML encodes GET and POST requests using the format:
> "myurl.com?name1=value1&name2=value2&..."

My problem is:

I do not know if this is the right group for my question sorry if I am
wrong here.

I have the following html page:

<html><head></head>

<form method=post action=http://www.some_site.zzz/tt.t >
<input type="text" name="ID" value="5">
<INPUT type="submit" name="down_load" VALUE="button">
</form>

</body></html>

and when I click the button the site sends a file and a dialog box opens
with the filename in it asking your to save it.

I want to automate this. One method is to construct some url like this:

http://www.some_site.zzz/tt.t-ID=5&down_load=submit&method=post

I am not sure if this is correct approach. I know little about wget although
it comes with NTRK and I know little about perl. If a kind soul can give me
a very simple working solution in either wget, perl or both, it would be
very nice. I know C/C++ and can hack a little if you get me started.

Thanks for reading

-- 
gnuist


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

Date: Wed, 11 Dec 2002 07:06:14 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: ** WHAT URL DOES A BROWSER CONSTRUCT FROM A POST METHOD OF A FORM? **
Message-Id: <3df6e338.33055909@news.erols.com>

On 10 Dec 2002 22:04:03 -0800, gnuist006@hotmail.com (gnuist006) wrote:

: My problem is:

"...that I have no patience at all.  Rather than wait for replies, I'll
just keep posting the same article."

http://makeashorterlink.com/?U10321972



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

Date: 11 Dec 2002 11:10:32 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Can't find MakeRegex.pm
Message-Id: <at76f8$isf$3@mamenchi.zrz.TU-Berlin.DE>

According to RonaldWS <ronaldws@aol.com>:
> MakeRegex.pm seems to be needed to extend the list of names for
> Lingua::En::Nickname..  The only plausible link to this module I have found is
> http://www.netch.se/~hakank/makeregex/ and that link no longer seems to be
> functioning.  Does anyone know where I can get the module?

Googgle for it.

Anno


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

Date: 11 Dec 2002 13:44:05 GMT
From: ronaldws@aol.com (RonaldWS)
Subject: Re: Can't find MakeRegex.pm
Message-Id: <20021211084405.02407.00000011@mb-mc.aol.com>

>Googgle for it.
>
>Anno
>

I checked both google and askjeeves but did not find the module.  If you can
give me a link to the module or a google query that will help me find it I
would be  interested.

http://www.google.com/search?q=MakeRegex.pm

resulted in three dead end links.

-Ron


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

Date: Wed, 11 Dec 2002 12:47:09 GMT
From: Andras Malatinszky <nobody@dev.null>
Subject: Re: Comparison confusion
Message-Id: <3DF73350.6080808@dev.null>



Tad McClellan wrote:

> 
> The scorefile will work properly after I start a new newsreader session.
> 
What is this scorefile thing you keep mentioning?



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

Date: Wed, 11 Dec 2002 01:15:26 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Complex log parsing.
Message-Id: <3DF6D7FE.8DDB6C24@earthlink.net>

^darkage wrote:
> 
> This is the sample output of the type of information I want to parse.
> the unique number is 1447844 which I have to match with number 1474.
> Currently I've been trying to regex a line at a line breaking up the
> lines into an array.  Then hoping to join everything at the end.   I
> want to be able to pull from this  FROM emailaddress, TO emailaddress,
> SUCCESS or FAILURE, REASON y failed (which is in the same space as the
> "accepted message" line below) and time and date which isn't hard to
> convert here in multilog format.  The reason y I want to do this, is
> that I wish is to put the above info into a mysql db which I have the
> hang of already (:     Im not sure if Im attacking this from the right
> direction?

Instead of splitting things apart and joining parts back together, I
would suggest you try and match the data properly in the first place.

> @400000003df03e640e689364 new msg  1447844
> @400000003df03e640e6ae524 info msg 1447844: bytes 2419 from
>   <me@me.com> qp 25584 uid 1005
> @400000003df03e640eb73834 starting delivery 1474: msg 1447844 to
>   remote email@email.com
> @400000003df03e773af12e14 delivery 1474: success:
>   10.0.0.2_accepted_message./Remote_host_said:_250_OK/
> @400000003df03e773b11354c end msg 1447844

#!/usr/bin/perl -w
use strict;
use warnings;
open( MAILLOG, "<", "current_mail_log" )
   or die "Error opening 'current_mail_log': $!";
my (%messages, %deliveries);
while( <MAILLOG> ) {
   chomp;
   s/^\@[0-9a-f]{24} //
      or die "Line $. has no timestamp\n";
   my ($message, $info) = /^([^:]+)(?:: (.*))?\z/
      or die "Line $. contains no data\n";
   $message =~ s/\s+(\d+)\z//
      or die "Line $. contains no message id\n";
   my $id = $1;
   if( $message eq "new msg" ) {
      $messages{$id} = {};
   } elsif( $message eq "info msg" ) {
      my ($from) = $info =~ /^bytes \d+ from (.*?) qp \d+ uid \d+\z/
         or die "Line $. is malformed\n";
      $message{$id}{from} = $from;
   } elsif .......
}
close MAILLOG;

I leave completing this as an exercise to the reader.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Wed, 11 Dec 2002 09:41:11 +0100
From: ZZT <a@b.c>
Subject: Re: convert a date-time to an absolute value (in seconds or so)
Message-Id: <at6tn8$skf$1@news1.wdf.sap-ag.de>

Brian Wakem wrote:

> $_ = "Mon, 9 Dec 2002 14:14:57";
> use Time::Local;
> my $time;
> my @month = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
> my %month = map { $month[$_] => $_ } 0 .. $#month;
> if(/^\w+,\s(\d+)\s(\w+)\s(\d+)\s(\d+):(\d+):(\d+)$/) {
> $time = timelocal($6, $5, $4, $1, $month{$2}, $3);
> }
> 
> print $time;

btw: is there a comprehensive documentation about this /.../ splitting 
syntax? I think its very powerful but difficult to use.

thanks



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

Date: 11 Dec 2002 08:56:38 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: convert a date-time to an absolute value (in seconds or so)
Message-Id: <slrnavdve6.2i3.sholden@flexal.cs.usyd.edu.au>

On Wed, 11 Dec 2002 09:41:11 +0100, ZZT <a@b.c> wrote:
> Brian Wakem wrote:
> 
>> $_ = "Mon, 9 Dec 2002 14:14:57";
>> use Time::Local;
>> my $time;
>> my @month = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
>> my %month = map { $month[$_] => $_ } 0 .. $#month;
>> if(/^\w+,\s(\d+)\s(\w+)\s(\d+)\s(\d+):(\d+):(\d+)$/) {
>> $time = timelocal($6, $5, $4, $1, $month{$2}, $3);
>> }
>> 
>> print $time;
> 
> btw: is there a comprehensive documentation about this /.../ splitting 
> syntax? I think its very powerful but difficult to use.

perldoc perlre

-- 
Sam Holden



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

Date: 11 Dec 2002 12:51:52 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: convert a date-time to an absolute value (in seconds or so)
Message-Id: <u9d6o8btw7.fsf@wcl-l.bham.ac.uk>

ZZT <a@b.c> writes:

> Brian Wakem wrote:
> 
> > $_ = "Mon, 9 Dec 2002 14:14:57";
> > use Time::Local;
> > my $time;
> > my @month = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
> > my %month = map { $month[$_] => $_ } 0 .. $#month;
> > if(/^\w+,\s(\d+)\s(\w+)\s(\d+)\s(\d+):(\d+):(\d+)$/) {
> > $time = timelocal($6, $5, $4, $1, $month{$2}, $3);
> > }
> > print $time;
> 
> btw: is there a comprehensive documentation about this /.../ splitting
> syntax? I think its very powerful but difficult to use.

The // (or m//) operator is documented in perlop but it isn't going to
make a lot of sense unless you understand regular expressions.  The
latter are documented in perlre.

If regular expressions are totally new to you then look at
perlrequick first.

An overview of the standard documentation can be found in perltoc.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 11 Dec 2002 01:24:26 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Determining If a Socket is Open...
Message-Id: <3DF6DA1A.A66829CB@earthlink.net>

Brad W. Galiette wrote:
> 
> How would one go about determining if a client is still active on a
> server-based socket? (i.e., does the socket remain open and is there a
> computer at the other end? :-)

If you're worried about the client closing the socket, either explicitly
with close(), or by the client process exiting (or being killed), then
simply test it for readability -- if the socket has been closed by the
client, the server's end will become readable, and the next call to the
C read function (or the perl sysread function) will produce EOF.

If you're worried about the client machine being shutdown or crashing,
or the client's LAN or modem dieing (or you own), or one of the routers
between you and the client going down, then it becomes a tad trickier. 
The simplest is to send some sort of ping message, and time out it's
response.  If you've a good grasp of how tcp works, you can make your
machine automatically send 'keepalive' queries every so often, and then
otherwise write the code the same as for "only" testing for the client
process exiting or closing the socket -- the C read or perl sysread will
return an error instead of EOF, but it's otherwise the same.

Regardless, this is not a perl issue -- you would handle the problem
exactly as you would in C.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: 11 Dec 2002 11:05:11 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: hidden eval variables
Message-Id: <at7657$isf$2@mamenchi.zrz.TU-Berlin.DE>

According to Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de>:
> Also sprach Risto Vaarandi:
> 
> > I would like to build an expression calculator that would read user
> > input from stdin and rely on perl's eval() to calculate the expression
> > the user entered.
> > However, with eval() the user can actually set variables inside the
> > program if he/she wants to. E.g., if user enters $a = 1 and there is a
> > variable called $a in the main perl program, the value of that variable
> > will be changed.
> > Is there any way to avoid that? (with eval() or some other way?)
> 
> First make sure that the script that eval()s the code runs under
> strictures (use strict). After that, separate your script from the stuff
> that gets dynamically executed through a block:
> 
>     use strict;
>     {
>         # ordinary script
>         ...
>         call_eval();
>     }
>     sub call_eval { 
>         eval <STDIN>;
>     }
> 
> Thus you can protect all lexical variables from the upper block. They
> will be invisible within call_eval() as long as they are declared with
> my().

 ...except for possible file-global lexicals that happen to be declared
before the "sub call_eval ..." statement, so this sub should be one of
the first things in the file.  The peculiar placement deserves a comment.

Anno


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

Date: 11 Dec 2002 11:12:06 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: hidden eval variables
Message-Id: <at76i6$3dj$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Anno Siegel:

> According to Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de>:

>>     use strict;
>>     {
>>         # ordinary script
>>         ...
>>         call_eval();
>>     }
>>     sub call_eval { 
>>         eval <STDIN>;
>>     }
>> 
>> Thus you can protect all lexical variables from the upper block. They
>> will be invisible within call_eval() as long as they are declared with
>> my().
> 
> ...except for possible file-global lexicals that happen to be declared
> before the "sub call_eval ..." statement, so this sub should be one of
> the first things in the file.  The peculiar placement deserves a comment.

Good point. I was aware of the problem with declared globals but had no
real solution for that so I left that off (hoping that 'use vars' and
possibly our() wouldn't be that common anyway). The re-placement of the
subroutine is an obvious solution that escaped me.

Tassilo
-- 
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;


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

Date: 11 Dec 2002 11:38:27 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: hidden eval variables
Message-Id: <at783j$isf$4@mamenchi.zrz.TU-Berlin.DE>

According to Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de>:
> Also sprach Anno Siegel:
> 
> > According to Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de>:
> 
> >>     use strict;
> >>     {
> >>         # ordinary script
> >>         ...
> >>         call_eval();
> >>     }
> >>     sub call_eval { 
> >>         eval <STDIN>;
> >>     }
> >> 
> >> Thus you can protect all lexical variables from the upper block. They
> >> will be invisible within call_eval() as long as they are declared with
> >> my().
> > 
> > ...except for possible file-global lexicals that happen to be declared
> > before the "sub call_eval ..." statement, so this sub should be one of
> > the first things in the file.  The peculiar placement deserves a comment.
> 
> Good point. I was aware of the problem with declared globals but had no
> real solution for that so I left that off (hoping that 'use vars' and
> possibly our() wouldn't be that common anyway). The re-placement of the
> subroutine is an obvious solution that escaped me.

Ah, but this isn't about "use vars" and "our()".  Package variables
will always be accessible from anywhere, only lexicals can be protected.

Anno


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

Date: 11 Dec 2002 13:11:20 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: hidden eval variables
Message-Id: <at7dho$cut$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Anno Siegel:

> According to Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de>:
>> Also sprach Anno Siegel:
>> 
>> > According to Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de>:
>> 
>> >>     use strict;
>> >>     {
>> >>         # ordinary script
>> >>         ...
>> >>         call_eval();
>> >>     }
>> >>     sub call_eval { 
>> >>         eval <STDIN>;
>> >>     }
>> >> 
>> >> Thus you can protect all lexical variables from the upper block. They
>> >> will be invisible within call_eval() as long as they are declared with
>> >> my().
>> > 
>> > ...except for possible file-global lexicals that happen to be declared
>> > before the "sub call_eval ..." statement, so this sub should be one of
>> > the first things in the file.  The peculiar placement deserves a comment.
>> 
>> Good point. I was aware of the problem with declared globals but had no
>> real solution for that so I left that off (hoping that 'use vars' and
>> possibly our() wouldn't be that common anyway). The re-placement of the
>> subroutine is an obvious solution that escaped me.
> 
> Ah, but this isn't about "use vars" and "our()".  Package variables
> will always be accessible from anywhere, only lexicals can be protected.

Oh, sorry, missed the bits about "lexicals" that are file-global. I
think they don't exist in my solution since the whole program (except for
the call_eval() subroutine) is meant to reside in a block of its own. In
such a case it is does not matter where call_eval() is declared...all
lexicals from the program are invisible to it.

Tassilo
-- 
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;


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

Date: Wed, 11 Dec 2002 05:37:09 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Newbie question
Message-Id: <3df6ceca.27824714@news.erols.com>

"TBN" <ihave@noemail.com> wrote:

: Subject: Newbie question

You cannot be so new that you do not recognize the value of a good subject
line, and that the one you chose there is worthless.



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

Date: 11 Dec 2002 10:02:35 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Newbie question
Message-Id: <at72fr$isf$1@mamenchi.zrz.TU-Berlin.DE>

According to Mina Naguib  <spam@thecouch.homeip.net>:

[...]

> Your example doesn't work because of precedence. Here's a clean
> (untested) alternative:
> 
> for $myFile (qw(filename1 filename2)) {
> 	open (STUFF, $myFile) && last;
> }

Very nice.

> STUFF || &notFound;

You can't check a package filehandle like "STUFF" this way (Perl will
use the bareword "STUFF" or complain, depending on warnings).  The
standard method to check whether a filehandle is open is "defined
fileno STUFF", which works for all filehandles.  Or just keep a
success variable around:

    my $success;
    for $myFile (qw(filename1 filename2)) {
          $success = open (STUFF, $myFile) and last;
    }
    $success || notFound();

Anno


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

Date: Wed, 11 Dec 2002 10:55:21 +0100
From: David Nowak <David.Nowak_NS@libertysurf.fr>
Subject: Re: open
Message-Id: <at7229$51n$1@discovery.ens-cachan.fr>

Walter Roberson wrote:
> In article <at533t$hvd$1@discovery.ens-cachan.fr>,
> David Nowak  <David.Nowak_NS@libertysurf.fr> wrote:
> :In perl 5.6.1,
> 
> :   open (STDOUT, ">/tmp/xxx");
> :   close(STDOUT);
> :   open (STDOUT, ">-");
> :   print "B";
> :   exit 0;
> 
> :never prints the B. If I replace ">-" with ">/tmp/yyy" then the B is correctly 
> :printed in the file /tmp/yyy.
> 
> :What's wrong?
> 
> Opening ">-" opens the descriptor to the current location of STDOUT,
> but you closed STDOUT in the line above, so the current location
> is effectively /dev/null .
> 
> You should not expect STDOUT to still be pointed at the file,
> because you explicitly closed that connection. open() and
> kin have no memory: there is no way to specify that you want
> to open to "the last place that STDOUT was open to before I
> closed it"

So, instead of

   open (STDOUT, ">-");

what command should I use to open again the standard output after closing it?

David.



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

Date: 11 Dec 2002 11:05:47 +0100
From: Rune Froysa <rune.froysa@usit.uio.no>
Subject: Re: open
Message-Id: <svlznrcrhtw.fsf@dresden.uio.no>

David Nowak <David.Nowak_NS@libertysurf.fr> writes:

> So, instead of
> 
>    open (STDOUT, ">-");
> 
> what command should I use to open again the standard output after closing it?

"man perlfunc".  Look for the section containing the text "Here is a
script that saves, redirects, and restores STDOUT and STDERR".

-- 
Rune Frøysa


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

Date: 11 Dec 2002 05:51:43 -0800
From: mike_wilson@m-petfilm.com (Mike Wilson)
Subject: open2 program dies
Message-Id: <eafb44b7.0212110551.7fe27c52@posting.google.com>

hi,
i am using open2 to read and write to another process. Everything
works fine, except if the process dies or something. If i write to the
write handle after that, my program dies. Is there some way for me to
check, before i write. I would rather not run some system command such
as ps every time i write. I have tried IO::Select with has_exception
or writeable, but without success.

Thanks,
mike


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

Date: Wed, 11 Dec 2002 13:47:47 +0000
From: Dela Lovecraft <dl19@le.academicplace.intheuk>
Subject: Passing an object to another object
Message-Id: <at7flf$6i8h$1@rook.le.ac.uk>

Dear All,

'Nother question. :)

I have an object into which I need to pass another, different object in 
the following manner:

Object::Object2->new($instanceOfObject1);

Assume that Object1 has a new() sub similar to:

sub new
{
	my $type = shift;
	my $class = ref($type) || $type;
	my $self = {};

	$self->{NAME} = shift;
	$self->{HONORIFIC} = shift;
	bless ($self, $class);
	return $self;
}

So to make a new instance we can use the following construct:

my $o = Object::Object1->new("Jones", "Mrs");

No problem. If I want to pass this object as the arguments to another 
object's creation, how would I do it? If I use this:

sub new
{
	my $type = shift;
	my $class = ref($type) || $type;
	my $self = {};
	my $tempObject = shift;
	$self->{OBJECT} = $tempObject;
	$self->{WHO} = $tempObject->{NAME}; #Or use a function:
	#   $self->{WHO} = $tempObject->getName();
	bless ($self, $class);
	return $self;
}

#   Usage:   Object::Object2->new($o);


Then it all goes a bit wrong, and $self->{WHO} is undefined.

I need to use objects on this, but I am at the early stages of learning. 
I have a feeling it has something to do with passing the object as a 
scalar, but that is as far as my tiny brain has got. Sorry for not 
included the *exact* code, but this would mean sending vast amounts of 
text file - thie above code fits the pattern exactly, so you should gett 
he idea of things from that.

Any help would be much appreciated. Again. :)


Dela



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

Date: Tue, 10 Dec 2002 23:55:28 -0600
From: brian d foy <comdog@panix.com>
Subject: Re: perl bad interpreter: No such file or directory
Message-Id: <101220022355280433%comdog@panix.com>

In article <Pine.LNX.4.40.0212110215100.507-100000@lxplus073.cern.ch>,
Alan J. Flavell <flavell@mail.cern.ch> wrote:

> On Dec 10, Stas Neuberger inscribed on the eternal scroll:
> 
> > i get this message on every perl script i'm trying to start. doesn't
> > matter via cgi or shell. the script runs normally if i add -w at the
> > end of #!/usr/bin/perl. also perl test.pl runs the file.
> 
> This should be an FAQ. 

and so it enters my list of possible new faqs.

(i see this same error message a lot).

-- 
brian d foy, comdog@panix.com


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

Date: Wed, 11 Dec 2002 11:27:51 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: perl bad interpreter: No such file or directory
Message-Id: <Pine.LNX.4.40.0212111112280.21307-100000@lxplus072.cern.ch>

On Dec 11, Eric Le Donné deposited TOFU on the eternal scroll:

> ... or #!/usr/bin/perl ain't a valid Perl interpreter...

It seems to be a constant of nature that top-posters never take the
time to understand what they're quoting.

> since perl script.pl works, it's quite likely that it doesn't reside under
> /usr/bin

Which would make it more than a little implausible why the original
poster reported that merely adding -w to the shebang line would
miraculously repair the problem.

> What does "which perl" return ?

It's quite conceivable that "which perl" would report
/usr/local/bin/perl _despite_ the fact that a shebang line of
#!/usr/bin/perl works correctly.  Witness one particular system (yes,
it happens to be an old one) where this is the case:

ls -l /usr/bin/perl
lrwxr-xr-x   1 root     system        19 Feb 20  1999 /usr/bin/perl ->
/usr/local/bin/perl

As I said, the symptoms are very characteristic.  There's a stray
control character at the end of the shebang line, and my hunch is that
the original poster was mistaken in thinking it was a "normal unix
LF".  Perhaps I'll be proved wrong in thinking that the offending
character is a CR, but it seems a reasonable initial hypothesis.


[fullquote snipped, and considering adding @spam to the @nospam
that's already in the scorefile.]



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

Date: 11 Dec 2002 00:57:34 -0800
From: info@damigella.com (Mike)
Subject: Perl step-thru debugger in browser?
Message-Id: <f5bdcb8b.0212110057.42f668c4@posting.google.com>

Anybody know if there's a perl debugger I can use in my browser to
step-thru a script?

Thanks much.


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

Date: Wed, 11 Dec 2002 07:36:16 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl step-thru debugger in browser?
Message-Id: <slrnavefqg.5qv.tadmc@magna.augustmail.com>

Mike <info@damigella.com> wrote:

> Anybody know if there's a perl debugger I can use in my browser to
> step-thru a script?


That would be a really good trick, as CGI programs do not
execute in a browser.

You can debug your CGI programs from the server's command line,
or even from the command line on your home computer.


You have no doubt already seen the CGI FAQ, right?

   "Troubleshooting a CGI application"

   http://www.webthing.com/tutorials/cgifaq.4.html


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 11 Dec 2002 08:52:42 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: Problem - Array as Member of Object
Message-Id: <newscache$v73y6h$jxh$1@news.emea.compuware.com>

Tad McClellan wrote:

> Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com> wrote:
>> With all due respect Ted,


>                         ^
>                         ^
> s/e/a/;


Sorry. But then again...hahaha... it's your own fault: If I look at American 
movies, guys are always named Ted, never Tad. And my keyboard remembers it 
this way too :-)


[cool examples from Tad almost entirely snipped]
>    return 0, 1, 2;

I'm shocked to see you've dropped the parens. (That's what happens when you 
(I) code Perl with the auto pilot switched on.) These are the examples you 
realize a list is a list.

Thanks for the clerification!

-- 
KP



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

Date: Wed, 11 Dec 2002 08:46:34 -0000
From: Jacqui or (maybe) Pete <porjes@spamcop.net>
Subject: Re: problem with google posting causing multiple posts
Message-Id: <MPG.18610bc1a74eb303989687@news.CIS.DFN.DE>

In article <K4yJ9.8661$BB.1692@nwrddc01.gnilink.net>, 
jurgenex@hotmail.com says...
> gnuist006 wrote:
> > From: gnuist006@hotmail.com (gnuist006)
> > Newsgroups: alt.html,comp.lang.perl.misc,perl.beginners.cgi
> > Subject: How DO YOU CONSTRUCT A URL STRING FROM A POST METHOD IN A
> > FORM ? NNTP-Posting-Host: 209.179.39.190
> 
> Don't you think you are little bit obnoxious?
Perhaps you should just reply in the perl group?
 ...
-- 
On the earth the broken arcs; in the heaven, 
a perfect round.


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

Date: Wed, 11 Dec 2002 00:55:16 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Re FAQ: How can I capture STDERR from an external command?
Message-Id: <3DF6D344.7174C779@earthlink.net>

Peter J. Acklam wrote:
> 
> Benjamin Goldberg <goldbb2@earthlink.net> wrote:
[snip]
> > In what way do FIFO files seem cleaner?
> 
> I was scared by the all the warnings in the docs for Net::Open3.
> There seems to be so much that can go wrong (deadlocks etc.),

Except that those exact same deadlocks would still occur if you used
fifos instead of pipes.

> and I don't yet have that much experience with IPC, so I was worried
> about screwing things up.  Separating stdout and stderr is so easy
> in the shell, but seems to be so complicated in Perl.

Sending stdout and stderr to two seperate files is quite easy, in both
shell and perl.

But simultaneously processing both stdout and stderr can be quite
complicated, in both shell and perl.

How would you do it in the shell, if you consider it to be so easy?

> I'll probably just redirect stdout and stderr to the same place and
> avoid all the hassle.

If you don't explicitly need to deal them *seperately*, then joining
stdout and stderr certainly simplifies things; After all, what could be
easier than the following?

   open( my ($fh), "-|", "some program and args 2>&1" ) or die horribly;

> I really appreciate what you have posted about IPC in this group.
> Googling through your postings has been very educational.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Tue, 10 Dec 2002 23:59:29 -0600
From: brian d foy <comdog@panix.com>
Subject: Re: The CPAN Police (was: Re: first element of a hash)
Message-Id: <101220022359294944%comdog@panix.com>

In article <t109vuggdedhcgfkq2ihcpmiupqg96ee6g@4ax.com>, Bart Lateur
<bart.lateur@pandora.be> wrote:

> Torsten Werner wrote:
> 
> >Have a look on
>
> >>http://search.cpan.org/author/BINKLEY/Tie-InsertOrderHash-0.01/InsertOrderHa
> >sh.pm
> >Torsten
> 
> Oh no. Where's the CPAN Police when you need them?

> I wish somebody would monitor what's appearing on CPAN, and if
> necessary, put a stop to it -- or at least, put a "parental advisory"
> sticker onto it :-). 

we do.  we typically do not register namespaces that re-invent the 
wheel. 

> There's no use in having 5 or 10 modules on CPAN
> all for the same purpose, with no clear advantage of the newer ones over
> the already existing ones, but with more bugs. It makes CPAN, and Perl,
> look like a mess.

CPAN would be much less useful with this sort of moderation.  people 
should be allowed to upload what they like to their author directory and
let people use it or not use it. 

i think Jarkko talked about this in one of his recent posts (to
somewhere) about the success of CPAN---the loose controls make it
what it is.

-- 
brian d foy, comdog@panix.com


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

Date: 11 Dec 2002 12:02:06 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: unknown import: lib Calc at C:/Perl/lib/Math/BigInt.pm
Message-Id: <at79fu$3cc$1@mamenchi.zrz.TU-Berlin.DE>

According to bsma1 <bsma1@hotmail.com>:
> Hello,
> 
> I'm a relative newbie to Perl. What I want to do is use large integers
> (64 bit) in a script I'm writing. I have downloaded and installed all
> the Math::BigInt, Bit::Vector, and anything I thought was/is related.
> I have the line "use bigint;",

No, you have a line that reads "use Math::BigInt", otherwise you
would see a different error.

>                                but I still get the error: "unknown
> import: lib Calc at C:/Perl/lib/Math/BigInt.pm". Can anyone help me,
> or point me in the right direction? Thanks for any and all help

Apparently you have loaded Math::BigInt manually, as opposed to
the CPAN procedure.  The missing module Math::BigInt::Calc is part
of the Math::BigInt distribution and should be right there.

Call CPAN as "perl -MCPAN -e shell" and then type "install Math::BigInt".
You may have to use "force install" instead of "install" if it believes
the module is already installed.

Oh, and Bit::Vector is not related to Math::BigInt, it is (among
other things) an alternative to Math::BigInt.  Without having looked
in detail, I'd expect it to be somewhat harder to use and quite a bit
more efficient.

Anno


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

Date: Wed, 11 Dec 2002 05:19:02 GMT
From: Fred <No_Mail_Address@cox.net>
Subject: Using Mail::Header modul for array of messages
Message-Id: <3DF6CB40.7CFDF68E@cox.net>

Hello there,
I want to use Mail::Header to make a summary of my Mozilla Mailbox
(containing 300 messages). The following code runs without error, but
creates only an empty outfile. The reason is probably in the line
my $header = new Mail::Header $message;
I tried all kinds of variations of this line, but nothing worked.

--- Fred


#!/usr/bin/perl	-w

	use strict ;
	use Mail::Header;

	my $messagefile = shift ;
	my $outfile = shift ;
	my ($message) ;

	local $/ = undef ;

	open (MESSAGE, "$messagefile") or die "Unable to open
$messagefile:$!\n";
	open(OUT, "> $outfile") or die "Could not open $outfile for writing:
$!\n";

	my @messages = split (/^From -/m, <MESSAGE>) ;

	foreach $message (@messages) {
		my $header = new Mail::Header $message;
		my @from = $header->get("From");
		my @subject = $header->get("Subject");
		my @date = $header->get("Date");

	foreach (@from) {print OUT "From: ", $_ };
	foreach (@subject) {print OUT "Subject: ", $_ };
	foreach (@date) {print OUT "Date: ", $_ };
	}


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

Date: Wed, 11 Dec 2002 12:10:51 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Using Mail::Header modul for array of messages
Message-Id: <3DF72B1E.5445C4BD@acm.org>

Fred wrote:
> 
> I want to use Mail::Header to make a summary of my Mozilla Mailbox
> (containing 300 messages). The following code runs without error, but
> creates only an empty outfile. The reason is probably in the line
> my $header = new Mail::Header $message;
> I tried all kinds of variations of this line, but nothing worked.
> 
> --- Fred
> 
> #!/usr/bin/perl -w
> 
>         use strict ;
>         use Mail::Header;
> 
>         my $messagefile = shift ;
>         my $outfile = shift ;
>         my ($message) ;
> 
>         local $/ = undef ;
> 
>         open (MESSAGE, "$messagefile") or die "Unable to open
> $messagefile:$!\n";
>         open(OUT, "> $outfile") or die "Could not open $outfile for writing:
> $!\n";
> 
>         my @messages = split (/^From -/m, <MESSAGE>) ;
> 
>         foreach $message (@messages) {
>                 my $header = new Mail::Header $message;
>                 my @from = $header->get("From");
>                 my @subject = $header->get("Subject");
>                 my @date = $header->get("Date");
> 
>         foreach (@from) {print OUT "From: ", $_ };
>         foreach (@subject) {print OUT "Subject: ", $_ };
>         foreach (@date) {print OUT "Date: ", $_ };
>         }


You should probably use Mail::Util::read_mbox() to read the mail file:

#!/usr/bin/perl -w
use strict;
use Mail::Util qw(read_mbox);
use Mail::Header;

my $messagefile = shift;
my $outfile = shift;

open OUT, "> $outfile" or die "Could not open $outfile for writing:
$!\n";

foreach my $message ( read_mbox $messagefile ) {
    my $header = new Mail::Header $message;
    print OUT "From: $_"    for $header->get( 'from' );
    print OUT "Subject: $_" for $header->get( 'subject' );
    print OUT "Date: $_"    for $header->get( 'date' );
    }

__END__




John
-- 
use Perl;
program
fulfillment


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

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


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