[12265] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5865 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 2 22:07:32 1999

Date: Wed, 2 Jun 99 19:00:17 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 2 Jun 1999     Volume: 8 Number: 5865

Today's topics:
    Re: Can I do this with an "if" statement? (Abigail)
    Re: Can PERL attach a file to a FORM that will get Emai (Abigail)
    Re: Cryptic error message (Abigail)
    Re: how to attach a file to the mail? <justisd@mnl.com>
    Re: I pass an array to a subroutine, but that array is  <upsetter@ziplink.net>
    Re: micro$~1 perl (Ronald J Kimball)
        Parameter passing <derek@realware.com.au>
    Re: PERL FOR NT <cassell@mail.cor.epa.gov>
        perlcc and modules <aaa@cs.stanford.edu>
    Re: perldebug: visibility of local (private) variables (Ronald J Kimball)
    Re: Problem with SQL statement in DBI <brew1@voicenet.com>
        Return value from an associative array (Pat Traynor)
    Re: Return value from an associative array (Ronald J Kimball)
        Running expect script from CGI w/ params <sroque@man.amis.com>
    Re: The artistic license and perl: (Chip Salzenberg)
    Re: The artistic license and perl: <tchrist@mox.perl.com>
    Re: The artistic license and perl: <rra@stanford.edu>
        Transferring string to other Perl program? (Jim)
    Re: Tying a double knot in a hash <burton.not.spam@lucent.com>
    Re: Tying a double knot in a hash zenin@bawdycaste.org
    Re: undesired result with .* in s command (Ronald J Kimball)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 2 Jun 1999 18:16:05 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Can I do this with an "if" statement?
Message-Id: <slrn7lbf6t.grs.abigail@alexandra.delanet.com>

Larry Rosler (lr@hpl.hp.com) wrote on MMC September MCMXCIII in
<URL:news:MPG.11bd2a1046992c65989b47@nntp.hpl.hp.com>:
^^ In article <3752164A.45E9B2D4@home.com> on Tue, 01 Jun 1999 04:54:44 
^^ GMT, Mitch <portboy@home.com> says...
^^ > I would like to check to make sure that the input from the user is
^^ > within 1-60 (integer).  Can I do something like this with an if
^^ > statement.  If so how?
^^ > 
^^ > if ($ans = [1...60]) {
^^ >     blah blah
^^ > }
^^ > else {
^^ >     print "out of bounds";
^^ > }
^^ 
^^   if (1 <= $ans && $ans <= 60) {


Yes, if you know $ans is numeric. If it is pure user input, you might
want to see if it's all numbers first:

     if ($ans !~ /\D/ && 1 <= $ans && $ans <= 60)

That eliminates some potential -w warnings.



Abigail
-- 
perl -wlne '}for($.){print' file  # Count the number of lines.


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 2 Jun 1999 18:18:36 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Can PERL attach a file to a FORM that will get Emailed?
Message-Id: <slrn7lbfbk.grs.abigail@alexandra.delanet.com>

news.boeing.com (jim.ray@west.boeing.com) wrote on MMC September MCMXCIII
in <URL:news:FCnJow.8M0@news.boeing.com>:
 .. I need to create a FORM that will be emailed to me.  I also need to have the
 .. user attach a file to the form.  Can this be down with PERL?  If so where
 .. can I purchase or download the file?


Yes, it could, but wouldn't it be easier if you let the user use a browser?
Modern browser already have the functionality to attach files to forms.

And it sure beats a "you must install Perl first".


Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 2 Jun 1999 18:21:50 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Cryptic error message
Message-Id: <slrn7lbfhm.grs.abigail@alexandra.delanet.com>

Collin Starkweather (collin.starkweather@colorado.edu) wrote on MMC
September MCMXCIII in <URL:news:375426FF.A68A5890@colorado.edu>:
## When I close an app, I receive the message
## 
##    Attempt to free unreferenced scalar during global destruction.

As 'man perldiag' will tell you, that's an internal error. Perl
screwed up a reference count somewhere. It shouldn't happen, but
alas, sometimes it does.



Abigail
-- 
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Wed, 02 Jun 1999 17:37:22 -0500
From: Justis <justisd@mnl.com>
Subject: Re: how to attach a file to the mail?
Message-Id: <3755B222.3515C2B0@mnl.com>



David Cassell wrote:

> Gleb Ekker wrote:
> >
> > Hi,
> >
> > can anybody help me with my problem - how to attach a file to the mail
> > sent by using Sendmail program? Better would be not to use any module.
>
> No modules, huh?  Okaaaaaay...
>
> > Usually I send mails from my scripts as follows:
> >
> > #!/usr/bin/perl
>                  ^^^^
>   #!/usr/bin/perl -w
>
> You need to use that -w flag.  And you ought to consider the following
> for lines #2 and #3:
>
> use strict;
> use diagnostics;   # only needed until you learn to interp
>                    # the error messages without it
>
> > $mailprog = "/usr/sbin/sendmail";
> > $recipient= "globus\@infonet.ee";
> >
> > open(MAIL, "|$mailprog $recipient") || die;
>
> If you're going to do this instead of using Mail::Mailer
> or a similar module, you need to get the sendmail switches
> in there, and you need to get them correctly.  I would think
> you need -oi at a minimum.  and you really ought to check
> the return status and print $! out so you have some idea
> why your fork failed.
>
> > print MAIL "To: $recipient\n";
> > print MAIL "From: Your Web Site\n";
> > print MAIL "Subject: Test Mail\n\n";
> > print MAIL "? ? ? ? ? ? ? ? ? ? ? ?\n\n";
>
> Use a here-doc.  It will look cleaner.
>
> > close(MAIL);
>
> You ought to check the status of the close() as well.
>
> > What line must I put to attach some file, for example, test.zip?
>
> This is a MIME issue now.  You'll have to go read the MIME
> specs and be sure to get all the headers and everything just
> right, or it won't work.  Or you could just use the fine
> MIME::Lite module, which would take care of all that for you.
> But since you don't want to use a module, you'll have to go
> do all that other stuff now...

I've tried using the module MIME:Lite and its works fine except the headers
are included in the body of the message,
whenever the mail message is multipart.

For example:

use MIME::Lite;

$msg = new MIME::Lite (
        From    =>'x@x.xxx',
        To      =>'x@x.xxx',
        Subject =>'A message with 2 parts...',
        Type    =>'multipart/mixed',
        );

attach $msg (
        Type    =>'TEXT',
        Data    =>"Hello\n",);


attach $msg (
       Disposition=>'attachment',  # I've tried leaving this field out also
       Type     =>'application/octet-stream',
       Path     =>'file.pl',
       Filename =>'attach');

$msg->send;

This code will send a message looking like:

Content-Disposition: inline
Content-Length: 5
Content-Transfer-Encoding: binary
Content-Type: text/plain

Hello
Content-Disposition: attachment; filename="attach"
Content-Length: 5905
Content-Transfer-Encoding: binary
Content-Type: application/octet-stream; name="attach"

Attachment Converted: "c:\program files\eudoralight\attach\attach"

The email message originates on hpux.
I am using eudora light to read the email message.
How can I get rid of the headers?

Thanks in advance,
Justis

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



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

Date: Wed, 02 Jun 1999 22:39:36 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: I pass an array to a subroutine, but that array is broken up by @_.
Message-Id: <Ioi53.1688$nn.500792@news.shore.net>

Greg Bacon <gbacon@itsc.uah.edu> wrote:
: In article <Qhh53.1674$nn.498301@news.shore.net>,
: 	Scratchie <upsetter@ziplink.net> writes:
: : It's less ambiguous that way if someone who only knows a little perl has
: : to maintain my code.

: Down this path lies madness.

Please elaborate on this. Are you implying that I should never let anyone
else maintain my code, or that I should insure that anyone who ever does
has at least the same understanding of perl that I did the week I wrote
that script?

I'm working with an intern right now who's just beginning to learn perl.
If he saw "$foo = @{ shift @_ }" he's going to know what @_ is and he
might be able to figure out the right place in the docs/camel book to
figure out what's going on. If he sees "$foo = @{+shift}" he's going to be
completely baffled, I guarantee.

--Art
-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: Wed, 2 Jun 1999 21:40:34 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: micro$~1 perl
Message-Id: <1dssiao.1w909nj1kmadq6N@p12.block2.tc2.state.ma.tiac.com>

Cameron Dorey <camerond@mail.uca.edu> wrote:

> Tom Christiansen wrote:
> > 
> > You should go read what's on p5p about it today before you
> > get too creeped out.
> 
> Might you copy/summarize what's taking place there for those of us
> without access to p5p?

Everyone should have access to p5p.  You can find it archived on
DejaNews under the forum 'perl.porters-gw'.  This particular topic has
the subject 'Control and accountability after ActiveState / Microsoft
deal'.

HTH!

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 03 Jun 1999 10:25:23 +1000
From: Derek Lavine <derek@realware.com.au>
Subject: Parameter passing
Message-Id: <3755CB73.1461DEDB@realware.com.au>

This is basic, I am very new to perl.

I have a function log() function that I pass a filename and a hash, it
is called thus

%fields = (
      application  => "My App",
        severity   => "Fatal",
        page      => $ENV{HTTP_REFERER}

        etc.
        );

&log("${site_path}/logfiles/error.log", \%fields);

# Log looks like this

sub log {
 my ($filename, $fillings) = @_;

 ....

# I process $fillings as

  while ( ($tag, $value) = each %$fillings )
  {
     $value =~ s/(\w+)\n/{$1}/g;
     $buff .= "$tag : $value\n";
  }

  # more stuff

  # now I want to call another function that takes a filename and a hash

  func2( $filename, $fillings); # this does not work, how should I pass
'fillings'
}

So my question is how do I turn $fillings back in to a hash for the call
of func2() as I want the call to func2() to be the equivalent of

%fields = (
      application  => "My App",
        severity   => "Fatal",
        page      => $ENV{HTTP_REFERER}

        etc.
        );

&func2("${site_path}/logfiles/error.log", \%fields);


Thanks for any help.

Are there some basic rules (one liners) that can be applied to turn on
type of variable in to another (for convert able types)?
Or is there a specific place that will explain this in "Programing Perl"
(I could not find it?)

Thanks again







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

Date: Wed, 02 Jun 1999 15:44:39 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: PERL FOR NT
Message-Id: <3755B3D7.5B9A4E96@mail.cor.epa.gov>

sam@cheapnet.co.uk wrote:
> 
> I need some sample scripts for Perl with NT
> I want to create user accounts etc

You'll be pleased to know that there are tons of such scripts
on the Web.  Just use Alta Vista [or something similar] to
search for them.  Or use DejaNews [deja.com] to search the
archives of this newsgroup and the win32-perl-users listserv 
for NT admin scripts.  There are very good Perl NT admin
scripts in the O'Reilly 'octopus' book NT Administration
too.  And check out Dave Roth's latest book too.

OTOH, this is really not a good place to ask for scripts.
This newsgroup is oriented toward Perl programming.  That
means that once you've written or adapted a Perl program,
if you have some problems you can come here for some help.
Just follow the directions in the nice e-mail you've just
received from gnat about this newsgroup and Perl.

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


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

Date: Wed, 02 Jun 1999 17:15:43 -0700
From: "Amr A. Awadallah" <aaa@cs.stanford.edu>
Subject: perlcc and modules
Message-Id: <3755C92F.C8BCD490@cs.stanford.edu>


Dear Perlers,

  I have a problem with perlcc and modules. I have a script which uses
the News::NNTPClient module. The script compiles fine, but when I run the
compiled binary I get this reponse:

Can't locate object method "new" via package "News::NNTPClient" at tmp.pl line
3. 

  Any help would be really appreciated. I include the script I wrote at the
end of this message.

Thanks,

-- Amr

#!/usr/local/bin/perl -w
# PRINT FIRST MESSAGE IN NEWSGROUP comp.lang.perl.misc
use News::NNTPClient;
$c = News::NNTPClient->new;
($first, $last) = ($c->group("comp.lang.perl.misc"));
print $c->article($first);
$c->quit;


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

Date: Wed, 2 Jun 1999 21:40:35 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: perldebug: visibility of local (private) variables
Message-Id: <1dssj0t.1cu1a7g9v5inhN@p12.block2.tc2.state.ma.tiac.com>

Thomas_Wilde <thomas.wilde@hl.siemens.de> wrote:

>     my ($filename,

> [...]

> At this point I'd expect that $filename has a value that I can access
> with the debugger command: 
> 
> DB<some_line> X filename
> 
> But I can't.  
> (...BIG SILENCE...)

X and V are used for examining the values of package variables.  my()'ed
variables are not in a package.  Thus, you cannot examine their values
with X or V.

Use x instead.


> To make things more confuse I _can_ see the values of
> '%hash_of_boundaries', which was declared with 'my' as well. 
> 
> When later values are added to this associative array, a:
> 
> DB<some_line> x %hash_of_boundaries
> 
> tells me:
> 
> 0  '------------B83691E653CD7F9410F27EA3'
> 1  1
> 
> which is what I expect to see.

See, you used x there, instead of X.  You already knew the answer!  :)


-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 03 Jun 1999 01:46:10 GMT
From: Bruce Schiller <brew1@voicenet.com>
Subject: Re: Problem with SQL statement in DBI
Message-Id: <C7l53.181$lJ3.29644@news3.voicenet.com>

: Could anyone suggest why the following statement does not work via
: DBI? 

: $c = $dbh->prepare("SELECT * INTO OUTFILE $afile FROM $table");

John....

Are you using a do or an execute to run this statement after you prepare
it?  It doesn't actually execute the SQL statement with this code, just
prepares it.

On the other hand if you are asking why doesn't this prepare the
statement....  never mind! 

brew

-- 
 ==========================================================================
                  Strange Brew   (brew@theMode.com)
     Check out my Musician's Online Database Exchange (The MODE Pages)
                        http://www.TheMode.com
 ==========================================================================



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

Date: Wed, 02 Jun 1999 23:27:49 GMT
From: pat@ssih.ssih.com (Pat Traynor)
Subject: Return value from an associative array
Message-Id: <slrn7lbffe.r29.pat@ssih.ssih.com>

Newbie alert...

I'm teaching myself Perl from the Llama and Camel books, and I can't
find an answer to this question.  Also, depending on which book I'm
looking in, they call this either an "associative array" or a "hash".
I'm not sure which is correct in the newsgroup.

I'm trying to find out how to get a true/false value from a hash.  I
know that this code is incorrect.  But from this, you should get an idea
of what I'm trying to do:

	$age{"bob"} = 35;
	$age{"mary"} = 28;

# This is where I'm lost:
	if( $age{"dave"} ) {
	    print "Dave's age is $age{"dave"}\n";
	}
	else {
	    print "Sorry - Dave's age is not recorded.\n";
	}

That particular statement will always return true.

Thanks in advance for any help.

--pat--
--
Pat Traynor
pat@ssih.com


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

Date: Wed, 2 Jun 1999 21:40:37 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Return value from an associative array
Message-Id: <1dssjau.1fqjnkodj4ljiN@p12.block2.tc2.state.ma.tiac.com>

Pat Traynor <pat@ssih.ssih.com> wrote:

> I'm teaching myself Perl from the Llama and Camel books, and I can't
> find an answer to this question.  Also, depending on which book I'm
> looking in, they call this either an "associative array" or a "hash".
> I'm not sure which is correct in the newsgroup.

Which editions of the bookds?

"Hash" is the preferred term; "associative array" is an old term that
isn't used anymore.


> I'm trying to find out how to get a true/false value from a hash.  I
> know that this code is incorrect.  But from this, you should get an idea
> of what I'm trying to do:
> 
>   $age{"bob"} = 35;
>   $age{"mary"} = 28;
> 
> # This is where I'm lost:
>   if( $age{"dave"} ) {
>       print "Dave's age is $age{"dave"}\n";
>   }
>   else {
>       print "Sorry - Dave's age is not recorded.\n";
>   }
> 
> That particular statement will always return true.
> 

That code won't even compile.  What does your code really look like?


if ($age{"dave"}) {

will do exactly what you say you want.


-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 03 Jun 1999 00:11:13 GMT
From: "Sheila  Roque" <sroque@man.amis.com>
Subject: Running expect script from CGI w/ params
Message-Id: <01bead55$656250c0$2bbe10ac@amipnet>

I was wondering if anyone can help me. I have a CGI which will perform vax
authentication. We are on NT and I have installed Expect. My Perl script
looks like this:
***********************************
require "cgi-lib.pl";
&ReadParse(*args);
if ($args{vax_password}) {
system("script.exp $args{username} \"$args{vax_password}\" "); 
if ($? >> 8) {
	$status = $? >>8;
 	if ($status == 6) {
		print "Timeout\n";
                      	}
                      elsif ($status == 5) {
                      print "Unexpected exit mode\n";
                      }
                      elsif ($status == 3) {
                      print "Invalid username/password\n";
                      }
                      elsif ($status == 2) {
                      print "Expired VAX password\n";
                      }
          }
}
 ******************************
The expect script I am trying to call is the ff:
 set timeout 50
 spawn telnet 172.16.101.2
 match_max 100000
 expect -exact "Username: "
 send -- "[lindex $argv 0]\r"
 expect -exact "Password: "
 send -- "[lindex $argv 1]\r"
 expect {
              -exact "\[c"
              {send -- "\[?1;0c";exp_continue}
              -exact "7\[255;255H\[6n8"
              {send -- "\[100;80R";exp_continue}
               "zation failure"  {exit 3}
               "expired"  {exit 2}
               "ora-mfg: "  {send --
               "logout:==logout\rlogout/brief\r";exit 0}
                timeout  {exit 6}
       }
expect eof
exit 5
**********************
My expect script works both on dos command shell and Tcl window. My
problem is it's not working from the Perl script. I am expecting an output
depending on the username/passwd combination entered into the form by the
user. This will be compared to the login acct in VAX. This acct is distinct
for
every employee so it's kind of useful.
Please help me. Making this work will be all that I need to justify the
project.
Thanks in advance!


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

Date: 2 Jun 1999 18:02:42 -0400
From: chip@perlsupport.com (Chip Salzenberg)
Subject: Re: The artistic license and perl:
Message-Id: <7j49m2$1ln$1@hoon.streaker.org>

According to Greg Bartels <gbartels@xli.com>:
>It seems that the artistic license aint so great after all:

The AL is great, except for people who have internalized the GPL.

>http://www.oreilly.com/catalog/opensources/book/perens.html

Bruce Perens?  It is to laugh.
-- 
Chip Salzenberg               - a.k.a. -             <chip@perlsupport.com>
          ->  Ask me about Perl training and consulting  <-
   "It's a dangerous game we play."  "You mean, like, Jarts?!"  //MST3K


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

Date: 2 Jun 1999 17:16:08 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: The artistic license and perl:
Message-Id: <3755bb38@cs.colorado.edu>

Whyever would you want to hurt Perl by infecting it with infinitely
reaching strings of the notorious GPV?  That would merely reduce its
freedom and restrict people from using it.  What a terrible idea!

--tom
-- 
    "I just hope I'm never promoted to the level of my incontinence."
    	--Larry Wall


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

Date: 02 Jun 1999 16:41:00 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: The artistic license and perl:
Message-Id: <yl7lpmyxv7.fsf@windlord.stanford.edu>

Chip Salzenberg <chip@perlsupport.com> writes:
> According to Greg Bartels <gbartels@xli.com>:

>> It seems that the artistic license aint so great after all:

> The AL is great, except for people who have internalized the GPL.

Um.

The Artistic License is very badly written from a legal perspective, tends
to make lawyers roll their eyes, and is horribly unclear as to its exact
implications in any number of different circumstances.  I'd never
recommend someone use it as their sole license.  It's rife with undefined
or ill-defined terms and confusing implications.

If you want a license with some of the same flavor as the Artistic
License, I'd strongly recommend using either the MIT/X Consortium license
(for maximum freedom) or the Mozilla Public License (for GPL-like
restrictions on how one can use the code in proprietary software but
without the infectiousness).  Neither offer quite the same conditions,
unfortunately, but they've both been gone over thoroughly by lawyers.

(I really wish Larry or someone would hire a good intellectual property
lawyer to go over the Artistic License with a fine-tooth comb and clean it
up.)

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Wed, 02 Jun 1999 23:07:00 GMT
From: jrglynn@geocities.com (Jim)
Subject: Transferring string to other Perl program?
Message-Id: <3755b7c9.537629@NNTP.netcomuk.co.uk>

I tried posting this through DejaNews, but I couldn't see it in from
my Newsgroup viewer at home.  Hopefully I am not re-posting.

-----------------------------------------------------------------------------------------------
I am very new to Perl, and cannot find a place to pose this question,
so I thought I would attempt here.  If this is the wrong forum, please
accept my apologies.

I have two Perl scripts.  Script1 calls Script2, which receives a
string from the user.  I then want to transfer this string back to
Script1, to be used in other things.  How do I accomplish this?

This is just an example of what I need.  I figured it would be easier
to pose it as real simple, then to try and post my actual code.  I
just need to know the concept, the basic steps of how to do this.

Thanks a lot,

--Jim
jrglynn@geocities.com



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

Date: Wed, 02 Jun 1999 17:04:37 -0500
From: Burton Kent <burton.not.spam@lucent.com>
To: Mark-Jason Dominus <mjd@op.net>
Subject: Re: Tying a double knot in a hash
Message-Id: <3755AA75.E58C5E4@lucent.com>

I'm creating a tied hash which stores information
in a regular hash.  Basically the tied hash 
lets me treat it in an OO way so that I don't
have to worry about what and how things are
stored in there.  I just store it.

Then I want to convert the regular hash (where
the tied hash stores things) to a tied dbm hash 
so it's persistent.

How is this a bad idea?  I thought it was just
unusual.  But of course, there's another way
to do it.

Burton

Mark-Jason Dominus wrote:
 >>The double knot occurs because I'm also tying
 >>a SDBM_database to the anonymous hash returned
 > >by TIEHASH.
> 
> It's hard to believe that you mean what you say here, but if you do
> mean it, then what you are doing is an incredibly bad idea and it is
> definitely not going to accomplish anything useful.
> 
 > >What can I try?  Is this a bug?
> 
> I don't understand what you're trying to accomplish or how you're
> trying to accomplish it.  You need to make a more complete statement
> of what you want to do, and then show a more complete version of the
> code that you are using to do it.  You said you were doing two ties,
> but you only showed us one:
> 
 > >#dbmopen(%hash, $DATABASE, 0700) ||  #interchangable with below
 > >tie (%hash, 'SDBM_File', "$DATABASE", O_RDWR|O_CREAT, 0700) || 
#interchangable
 > >with above
 > >        die "Could not open database $DATABASE\n";
>  
 >>Can't use string ("HASH(0x175064)") as a HASH ref while "strict refs"
 >>in use at remap line 207, <INPUT> chunk 1.


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

Date: 03 Jun 1999 01:07:50 GMT
From: zenin@bawdycaste.org
Subject: Re: Tying a double knot in a hash
Message-Id: <928372241.19888@localhost>

Burton Kent <burton.not.spam@lucent.com> wrote:
	>snip<
: Can't use string ("HASH(0x175064)") as a HASH ref while "strict refs" in use at
: remap line 207, <INPUT> chunk 1.
: 
: What can I try?  Is this a bug?

	Your code please, or we can't help you much.

	Consider this however:

	package DoubleKnot;
	sub TIEHASH {
	    my $class = shift;

	    my $self = bless {}, $class;

	    tie %{ $self->{MyDBM} }, 'AnyDBM_File', @args or die $!;
	    return $self;
	}

-- 
-Zenin (zenin@archive.rhps.org)         Caffeine...for the mind.
                                        Pizza......for the body.
                                        Sushi......for the soul.
                                             -- User Friendly


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

Date: Wed, 2 Jun 1999 21:40:38 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: undesired result with .* in s command
Message-Id: <1dssjz0.kf4d5e1waufv8N@p12.block2.tc2.state.ma.tiac.com>

Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:

> Ronald J Kimball wrote:
> 
> > .*? finds the shortest possible _leftmost_ match.  A subtle distinction,
> > but an important one, that often catches people unawares.
> 
> This bears no relationship to RExen (unless you discuss a REx
> consisting of 3 chars .*? only, and in this particular case your
> description is too long - .*? matches nothing at the leftmost possible
> position).

Exactly.  It would be pretty hard to find a shorter, more leftmost
string than the null string at the beginning, wouldn't you say?  :)

But you're right, my comment was pretty pointless without putting .*? in
the context of an actual regular expression.


-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

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

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

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 5865
**************************************

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