[19898] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2093 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 8 14:06:07 2001

Date: Thu, 8 Nov 2001 11: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)
Message-Id: <1005246312-v10-i2093@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 8 Nov 2001     Volume: 10 Number: 2093

Today's topics:
    Re: 0 response from a DHCP client nobull@mail.com
    Re: A Newbie's Question (John A. Dutton)
    Re: ActivePerl can't open file...sometimes <vautourNO@SPAMunb.ca>
    Re: Best language for low IQ programmers? <mspight@dnai.com>
    Re: can you help? grabbing urls mixed in with other tex <comdog@panix.com>
    Re: DBD::Mysql arbitrarily creating duplicate entries <cpryce@pryce.net>
    Re: Everything but the if... (martinblack)
        file copy problems (maddman)
    Re: file copy problems (Tad McClellan)
    Re: file copy problems <jkezar@doc.state.vt.us>
    Re: file copy problems (Clinton A. Pierce)
    Re: file copy problems (Tad McClellan)
    Re: file copy problems (Tad McClellan)
    Re: File uploading without CGI.pm <loophole64@home.com>
    Re: force stack dump  after die (Peter Scott)
    Re: hash scope problem - an emergency <ronh@iainc.com>
    Re: How to find length of scalar var? (Tad McClellan)
    Re: How to find length of scalar var? <jasper@guideguide.com>
    Re: Impossible to store tied hash (MLMDB) in an object? nobull@mail.com
    Re: Impossible to store tied hash (MLMDB) in an object? <tassilo.parseval@post.rwth-aachen.de>
    Re: Mail Script Has Just Stopped Working!?!?! <ross@timeplan.ltd.uk>
    Re: mod_perl - a last man standing-problem nobull@mail.com
    Re: Need Help To Get Started <zoltan.kandi@tellabs.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 08 Nov 2001 17:56:12 +0000
From: nobull@mail.com
Subject: Re: 0 response from a DHCP client
Message-Id: <u94ro5qh8j.fsf@wcl-l.bham.ac.uk>

jack@brainminers.net (jack) writes:

> Subject: 0 response from a DHCP client

"Client"?

> Your insight is highly appreciate.

>       use IO::Socket;

I suggest that you actually do! Use IO::Socket that is, don't just
declare that you are going to use IO::Socket and then use the much
more difficult primative socket interface instead.

There's nothing in your code to attempt to construct a valid DHCP
request.  There is nothing in your code to attempt to specify the UDP
source port as 68.  This has nothing to do with Perl.

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


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

Date: 8 Nov 2001 07:42:17 -0800
From: dutton@dirtdevil.com (John A. Dutton)
Subject: Re: A Newbie's Question
Message-Id: <4f338514.0111080742.4408a22b@posting.google.com>

"James Sullivan" <JJSUSA2001@yahoo.com> belched up in message
news:<9sdm2e$okc$1@slb5.atl.mindspring.net>...
> What is the difference between:
> 
> @data = split ('  ', $input) and
> @data = split(/  /, $input)

http://groups.google.com/groups?hl=en&threadm=x7wvuw3fmw.fsf%40home.sysarch.com&rnum=1&prev=/groups%3Fq%3Dsingle%2Bquotes%2Bversus%2Bdouble%2Bquotes%26hl%3Den%26group%3Dcomp.lang.perl.*%26rnum%3D1%26selm%3Dx7wvuw3fmw.fsf%2540home.sysarch.com


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

Date: Thu, 08 Nov 2001 10:41:35 -0400
From: Gil Vautour <vautourNO@SPAMunb.ca>
Subject: Re: ActivePerl can't open file...sometimes
Message-Id: <3BEA999F.20F52D6D@SPAMunb.ca>

Your right.  Its was the way I was specifying the paths to the files...  Works
now!

Brian Helterline wrote:

> "Ron Reidy" <rereidy@indra.com> wrote in message
> news:3BE972ED.32B61156@indra.com...
> > Gil Vautour wrote:
> > >
> > > Hello,
> > >
> > > I'm running ActivePerl on a Windows2000 machine and I have a script will
> > > run fine when when double-clicked or run from a command prompt like (ie.
> > > c:\>perl script.pl)  However, when I specify the path to Perl.exe and
> > > specify the path to the
> > > script it spits an error saying that it cannot open the file ("No such
> > > file or directory at...") that exists in the same place as the script.
> > > The same error occurs when running it from the command prompt like
> > > C:\Perl\bin>c:\script.pl
> > >
> > > Why would this be happening?  Is the script run with different
> > > permissions
> > > when invoked that way?  Below is the script.
> > >
> > > #!/usr/local/bin/perl -w
> > >
> > > open(CRSOUTFILE,">coursesnew.txt") || die "cannot open the file $!";
> > > open(CRSINFILE,"COURSES.TXT") || die "cannot open the file $!";
> > > while(<CRSINFILE>){
> > >
> > >            if (/\(.*?\)/) {
> > >            $_ =~ s/\(.*?\)//g;
> > >            print (CRSOUTFILE "$_");
> > >            } else {
> > >            print (CRSOUTFILE "$_");
> > >            }
> > > }
> > > close CRSINFILE;
> > > close CRSOUTFILE;
> > >
> > > Thanks,
> > I am not sure is sh-bang works in windows (search the FAQs).  But this
> > error indicates that Perl is not found at the location specified in the
> > sh-bang line (at least in UNIX), or the current directory is not in your
> > %PATH% variable.
>
> It has nothing to do with sh-bang or finding perl.  It can't find the
> "COURSES.TXT" file to open since the script assumes it is the current
> working directory which is different than the location of the script (in the
> cases where it failed)
>
> > --
> > Ron Reidy
> > Oracle DBA
> > Reidy Consulting, L.L.C.



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

Date: Thu, 08 Nov 2001 18:47:23 GMT
From: "Marshall Spight" <mspight@dnai.com>
Subject: Re: Best language for low IQ programmers?
Message-Id: <%qAG7.7868$Vf4.3964628@news1.rdc1.sfba.home.com>

"Peter Henriksen" <neskirneh_retep@hotmail.com> wrote in message news:hlikutkg4os0m67gucs1hkn66a1cmfd6fm@4ax.com...
> On Tue, 06 Nov 2001 23:58:21 GMT, "Marshall Spight" <mspight@dnai.com>
> wrote:
> >True enough. Still, I find it pretty wacky to have been passed over
> >for something because of a missing ten cent technology, when I
> >had hundred dollar skills listed on my resume.
>
> You're absolutely right, thoguh that would tell me not to work for
> such a company ;-)
>
> If they're not smart enough to read my resume... but maybe it's just
> me being picky ...


Good point!


M





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

Date: Thu, 08 Nov 2001 11:23:28 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: can you help? grabbing urls mixed in with other text
Message-Id: <comdog-11646B.11232808112001@news.panix.com>

In article <pJkG7.3548$Le.86637@sea-read.news.verio.net>, 
inwap@best.com (Joe Smith) wrote:

> In article <3be91551.2096578@news.freeserve.co.uk>,
> Phil <phil@no-6.co.uk> wrote:
> >Hi,
> >
> >I am fairly new to perl and have a text list of many urls mixed in
> >with other regular text. Is there a way and can fish out just the urls
> >and output the results? I have tried many different flavours if
> >regular expressions, but most don't seem to do what I expect them to!
> 
> Regular expressions are not the appropriate tool for the job here.
> You need a real parser.  The following was adapted from the examples
> from the HTML::Parser docs.

an HTML parser only works if the data is in the HTML format, so it
cannot pull out URLs from plain text.

if the text is HTML, the HTML::SimpleLinkExtor is much easier to use
rather than subclassing HTML::Parser. :)

-- 
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html



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

Date: Thu, 08 Nov 2001 10:39:13 -0600
From: cpryce <cpryce@pryce.net>
Subject: Re: DBD::Mysql arbitrarily creating duplicate entries
Message-Id: <B8101151.26B1%cpryce@pryce.net>

in article 516329be.0111071945.4679d40e@posting.google.com, Bill Gerba at
bill@wirespring.com wrote on 11/7/01 9:45 PM:

> foreach my $x (1..10) {
>   $query->prepare("blah blah $x");
>   if ($query->execute() { $query->finish(); }
>   else { print "problem: $!"; }
> }

If this is your real code, it won't compile. Please, in the future cut and
paste a minimum amount of code to demonstrate the problem. That way, when
people help, they'll know 1) exactly what you are trying to do and 2) that
any syntax errors are part of the script, and not an error in transposing
code.

Since I'm not sure of your level of expertise, or whether you are aware that
there are syntax errors in your code, I'll point out some errors.

First, the if statement is missing a )

Second, SQL statements should be prepare against a valid database handle:
$query = $dbh->prepare("SQL statement");
# where $dbh is a valid database handle
      
Third, checking for success in the if loop is not the best method. If
RaiseError is set to a true value in the connect, your program will
automatically die and print the error message to STDOUT.

Fourth, don't prepare the statement inside the loop. Use placeholders. Each
prepare is overhead that your script doesn't need.

Fifth, $! does not contain the error message. $DBI::errstr() does.

Try: 

 my $dbh = DBI->connect("dbi:mysql:database;host=host", "user", "pass",
{RaiseError=>1}); 

 my $query = $dbh->prepare("SELECT * FROM table where column=?");

 for my $x (1..10) {
    $query->execute($x);
 } 

Or, if you MUST roll your own error checking;

 my $dbh = DBI->connect("dbi:mysql:database;host=host", "user", "pass",
{RaiseError=>0, PrintError=>0}) or die "Can't connect: ", $DBI::errstr;
# disable auto error checking

 my $query = $dbh->prepare("SELECT * FROM table where column=?");

 for my $x (1..10) {
    $query->execute($x) or die "Error, Can't execute:", $query->errstr();

 } 


--
cp



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

Date: 8 Nov 2001 08:44:48 -0800
From: martinblack26@yahoo.com (martinblack)
Subject: Re: Everything but the if...
Message-Id: <c025943b.0111080844.7a89977a@posting.google.com>

"Rob" <robsjobs@hotmail.com> wrote in message news:<sOeG7.7266$Yb.1840669@typhoon.tampabay.rr.com>...
> "martinblack" <martinblack26@yahoo.com> wrote in message
> news:c025943b.0111070827.722e7cc@posting.google.com...
> > > Your other query string uses the wildcard "%" at the beginning and end
>  of
> > > the "\"%$query%\"" but you don't have the wild card at all in the first.
>  Do
> > > you actually have a title called "set" within the rows in the table?
> >
> > Yes, there is a number of products that are "set"(s). I can return the
> > items that contain 'set' when I remove the "if else" statements and
> > leave the:
> >
> > $sql="SELECT company_id, product_id, title,
> >   description, spex, price, sex, category_id
> > FROM product where title like \"%$query%\"";
> >
> > $sth = $dbh->prepare($sql); etc...
> >
> > The only problem is that it returns "sets", "preset" and anything else
> > with "set" in it. Thus, the need for the if-else statements.
> 
> The first query will only return a recordset containing rows where the title
> = "set" literally.  If it contains "sets" it won't match.  If you want
> everything where the title starts with the letters "set" and ends in
> anything else you can use "set%" and the % wildcard will match anything
> after the beginning letters "set".
> 
> The first query is inflexible in that you have to specify the exact entire
> text within the title field in the table for any given row.  Thus if you
> have  three records such as:
> 
> COMP_ID        PROD_ID        TITLE
> -----------         -----------        ---------------------------
> 0001551            12345              swing set
> 0000345            21123              socket set
> 0000100            32184              set of four t-shirts
> 
> You can select all three using the '%set%' but selecting 'set' will not
> select any.  In order to return the first two, you would want '%set' and for
> the last record above you would want 'set%' in order to get only the second
> you have to narrow the search by adding something to the query.  You can use
> 'soc%set' or you could use both '%set' and add another item to the where
> clause such as:
> > FROM product where title like \'%set\' and title like \'%socket%\'
> 
> Or, if you know the exact string, you could select the third as such:
> > FROM product where title = \'set of four t-shirts\'
> 
> Please clarify what you're trying to obtain if I am way off base.
> 
> Rob

Hey Rob, thanks for the help. One less headache for the weekend...
Yes, sounds good to me. So the only way to search out two or more
types of set(s) is to use either: \'%set\' or: title like ? and title
like ? . Thanks again for the help.


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

Date: 8 Nov 2001 07:44:59 -0800
From: maddman_75@yahoo.com (maddman)
Subject: file copy problems
Message-Id: <bea807ca.0111080744.496c29d7@posting.google.com>

I have a script that needs to copy a file from the hard drive to a
network drive.  I'm fairly new to perl, so excuse me if this is a
simple mistake.  Here is the relevent code

# Copy file to the share

$source = qq(C:\\mydir\\) . $name;
$dest = qq(K:\\newfile);
use File::Copy;
copy($source, $dest);

There is no error, but the file is not copied to the K:\ drive.  If I
explicitly name the paths, like so

# Copy file to the share

use File::Copy;
copy("C:\\mydir\\name", "K:\\newfile");

if works just fine.  I cannot have it work that way, because the
source file is dynamic.  Its a company newsletter, and I need the
script to grab the file and copy it to the network automatically.  The
file name changes each week.

I've read the docs, but can't see what I'm doing wrong.  Any help
would be greatly appreciated.

maddman


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

Date: Thu, 08 Nov 2001 16:25:08 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: file copy problems
Message-Id: <slrn9ul9m6.jio.tadmc@tadmc26.august.net>

maddman <maddman_75@yahoo.com> wrote:
>I have a script that needs to copy a file from the hard drive to a
>network drive.  I'm fairly new to perl, so excuse me if this is a
>simple mistake.  


You have multiple simple mistakes below  :-)

The primary one being you either did not read the documentation
for the function that you are using, or you did not understand
it when you read it.


>Here is the relevent code
>
># Copy file to the share
>
>$source = qq(C:\\mydir\\) . $name;
           ^^


You should use single quotes unless you _require_ one of the
two extra things that double quotes give you (variable interpolation
and backslash escapes).

   $source = q(C:\mydir\) . $name;

This is very likely to work too:

   $source = q(C:/mydir/) . $name;


>$dest = qq(K:\\newfile);
>use File::Copy;


You can read the module's documentation like this:

   perldoc File::Copy


>copy($source, $dest);


The module's docs say:

 ------------------------------
RETURN
       All functions return 1 on success, 0 on failure.  $! will
       be set if an error was encountered.
 ------------------------------

So if you are encountering an error, it would be helpful in
discovering the nature of the error if you output the special
variable mentioned there:

   copy($source, $dest) or die "could not copy '$source' to '$dest' $!";

The above has the added debugging help of showing you what you
actually have in the variables. Maybe you don't have what you
think you have in there...


>There is no error, 


How do you know? You are ignoring the return value from copy().

That is, you have not tested to see if there is an error or not.


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


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

Date: Thu, 08 Nov 2001 11:24:24 -0500
From: Joseph Kezar <jkezar@doc.state.vt.us>
Subject: Re: file copy problems
Message-Id: <3BEAB1B8.1D89B9F7@doc.state.vt.us>

try $source = "C:\\mydir\\$name";

maddman wrote:

> I have a script that needs to copy a file from the hard drive to a
> network drive.  I'm fairly new to perl, so excuse me if this is a
> simple mistake.  Here is the relevent code
>
> # Copy file to the share
>
> $source = qq(C:\\mydir\\) . $name;
> $dest = qq(K:\\newfile);
> use File::Copy;
> copy($source, $dest);
>
> There is no error, but the file is not copied to the K:\ drive.  If I
> explicitly name the paths, like so
>
> # Copy file to the share
>
> use File::Copy;
> copy("C:\\mydir\\name", "K:\\newfile");
>
> if works just fine.  I cannot have it work that way, because the
> source file is dynamic.  Its a company newsletter, and I need the
> script to grab the file and copy it to the network automatically.  The
> file name changes each week.
>
> I've read the docs, but can't see what I'm doing wrong.  Any help
> would be greatly appreciated.
>
> maddman

--
Joseph Kezar





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

Date: Thu, 08 Nov 2001 16:27:01 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: file copy problems
Message-Id: <3beab08c.9706947@localhost>

On 8 Nov 2001 07:44:59 -0800, maddman_75@yahoo.com (maddman) wrote:
>copy($source, $dest);
>
>There is no error [...]

Not to be flip, but this statement might not be true: you're not
checking for an error.   From the File::Copy manual page:

   RETURN
       All functions return 1 on success, 0 on failure. $! will be
      set if an error was encountered.

So perhaps:

   copy($source, $dest) || warn "Can't copy $source to $dest: $!";

might be more useful to you.

-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours  *and*
  clintp@geeksalad.org         Perl Developer's Dictionary 
"If you rush a Miracle Man,     for details, see http://geeksalad.org
        you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: Thu, 08 Nov 2001 16:41:34 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: file copy problems
Message-Id: <slrn9ulaih.jlj.tadmc@tadmc26.august.net>


[ text rearranged into an actual chronological order.

  snipped quote of entire article

  snipped quoted .sig

  Please see:

      http://www.geocities.com/nnqweb/nquote.html
]


Joseph Kezar <jkezar@doc.state.vt.us> wrote:
>maddman wrote:
>
>> $source = qq(C:\\mydir\\) . $name;

>try $source = "C:\\mydir\\$name";


Yes, let's do as you suggest:

--------------------
#!/usr/bin/perl
use warnings;
use strict;
   
my $name = 'Joseph';

my $source = "C:\\mydir\\$name";
print "'$source'\n";

$source = qq(C:\\mydir\\) . $name;
print "'$source'\n";
--------------------

output:

'C:\mydir\Joseph'
'C:\mydir\Joseph'


Did *you* try it before posting it?

Looks like it makes no difference at all...


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


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

Date: Thu, 08 Nov 2001 16:41:36 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: file copy problems
Message-Id: <slrn9ulaog.jlj.tadmc@tadmc26.august.net>

Clinton A. Pierce <clintp@geeksalad.org> wrote:
>On 8 Nov 2001 07:44:59 -0800, maddman_75@yahoo.com (maddman) wrote:
>>copy($source, $dest);
>>
>>There is no error [...]
>
>Not to be flip, but this statement might not be true


Actually that statement _is_ true (assuming that we can believe
it when the OP said the new file did not show up).

Surely the maddman _meant_ to say "There is no error message".


An "error" is not the same as an "error message".  :-)


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


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

Date: Thu, 8 Nov 2001 09:44:27 -0600
From: "Jason Kelley" <loophole64@home.com>
Subject: Re: File uploading without CGI.pm
Message-Id: <9se95r$m0c$1@news.chorus.net>


"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:35vhutofgpu9stu28tm0eki04tdqk0igq5@4ax.com...
> If the module needs not much more of installation than decompression
> into a directory iin @INC, then put a directory "lib" into your own home
> directory, and add it to your @INC with the "use lib" pragma:
>
> use lib '/home/johndoe/lib';
> use CGI::Lite;

Great. Thanks very much.

-Jason




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

Date: Thu, 08 Nov 2001 18:43:30 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: force stack dump  after die
Message-Id: <mnAG7.74918$Gh2.22666256@news2.rdc1.bc.home.com>


In article <af17817c.0111071330.7a54693f@posting.google.com>,
 google_news@linisoft.com (Reza Rob) writes:
>Can someone tell me how I can force a stack dump after each die command?

use Carp qw(confess verbose);
$SIG{__DIE__} = sub { confess @_ };

-- 
Peter Scott
http://www.perldebugged.com


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

Date: Thu, 08 Nov 2001 18:42:08 GMT
From: "Ron Hartikka" <ronh@iainc.com>
Subject: Re: hash scope problem - an emergency
Message-Id: <4mAG7.893$oM5.60298@typhoon.mw.mediaone.net>

you are repeatedly  assinging to %users rather than adding to it.

  %users =($user => [$name , $oddz]);

try

     $users{$user} = [$name , $oddz];


"Grzegorz Goryszewski" <gregory@pharmag.pl> wrote in message
news:9seg71$6fs$1@news.tpi.pl...
> Hello.
>
>     I have code like this, my point is to fill  hashes and play with it
outside the loop , but unfortunately outside the while loop foreach displays
> only last key value in any hash, what's going on ? Regards
>
>
>
>
> -------------------------------------
> #!/usr/bin/perl -w
>
> open (USERS , "<./users.txt") or die "error $! users \n";
> open (ZAKONCZ , "<./zakoncz.txt") or die "error  $! zakoncz \n";
> open (ROZPOCZ , "<./rozpocz.txt") or die "error $! rozpocz \n";
>
> while (<USERS>)
> {
> chomp;
>
>
>  if (/(\d\d);(...);(\S+\s\S+)/)
>  {
>    $oddz = $1 ;
>    $user = $2 ;
>    $name = $3 ;
>
>
>
>
>   %users =($user => [$name , $oddz]);
>   foreach $luser (keys %users)
>   {
>    print "inside $users{$luser}[1]\n";
>   }
>
>
>
>  }
>
> }
>
> ####################NEXT FILE ###############
>
>
> while (<ZAKONCZ>)
> {
> chomp;
>
>
>         if (/^CPF/ && /QPADEV/)
>
>
>      {
>                 if (/(\d{6}).*?(\d\d\/\d\d\/\d\d)...(\d\d:\d\d:\d\d)/)
>                 {
>                         $jobid = $1 ;
>                         $time = $3 ;
>                         $data = $2 ;
>                         $usr = substr $_ , 41 , 3 ;
>    %zakoncz = ($jobid => [$time, $data, $usr]);
>
>          }
>    }
> }
>
>
>
> ############# ROZPOCZ
######################################################################
>
>
> while (<ROZPOCZ>)
> {
> chomp;
>
>
>         if (/^CPF/ && /QPADEV/)
>
>
>      {
>                 if (/(\d{6}).*?(\d\d\/\d\d\/\d\d)...(\d\d:\d\d:\d\d)/)
>                 {
>                         $jobid2 = $1 ;
>                         $time2 = $3 ;
>                         $data2 = $2 ;
>                         $usr2 = substr $_ , 41 , 3 ;
>                         %rozpocz = ($jobid2 => [$time2, $data2, $usr2]);
>
>                 }
>     }
> }
> close USERS;
> close ROZPOCZ;
> close ZAKONCZ;
>
>
> foreach $luser2 (keys %users)
> {
>  print "outside $users{$luser2}[1]\n";
> }
>
> ---------------------
>
>
>
> Regards.
>
>     Grzegorz Goryszewski
>
>




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

Date: Thu, 08 Nov 2001 14:15:03 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How to find length of scalar var?
Message-Id: <slrn9ul1iq.ism.tadmc@tadmc26.august.net>

Jasper McCrea <jasper@guideguide.com> wrote:
>Murvin Ming-Wai Lai wrote:
>> 
>> 
>>   I have a question on scalar variable..  Which is, how to find its
>> length?

>This came up before on this newsgroup (so you should have browsed the
>archives first), 


It is fun to get ridiculous with a "self-answering question"
such as the OP asked, but there ought to be a smiley or
a footnote or something so that folks won't be so silly
as to actually use any of the methods that you proposed.

:-)


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


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

Date: Thu, 08 Nov 2001 16:31:00 +0000
From: Jasper McCrea <jasper@guideguide.com>
Subject: Re: How to find length of scalar var?
Message-Id: <3BEAB344.6496CFBB@guideguide.com>

Tad McClellan wrote:
> 
> Jasper McCrea <jasper@guideguide.com> wrote:
> >Murvin Ming-Wai Lai wrote:
> >>
> >>
> >>   I have a question on scalar variable..  Which is, how to find its
> >> length?
> 
> >This came up before on this newsgroup (so you should have browsed the
> >archives first),
> 
> It is fun to get ridiculous with a "self-answering question"
> such as the OP asked, but there ought to be a smiley or
> a footnote or something so that folks won't be so silly
> as to actually use any of the methods that you proposed.
> 
> :-)
> 

I suppose anyone who asked a question like that might actually be silly
enough to use one of those.

point taken.

:)

Jasp


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

Date: 08 Nov 2001 17:58:35 +0000
From: nobull@mail.com
Subject: Re: Impossible to store tied hash (MLMDB) in an object?
Message-Id: <u91yj9qh4k.fsf@wcl-l.bham.ac.uk>

Tassilo von Parseval <tassilo.parseval@post.rwth-aachen.de> writes:

>      $self->{db_hash}    = { %db_hash };

That makes $self->{db_hash} a reference to a new hash containing a
copy of the contents of %db_hash.

If you want $self->{db_hash} to be a reference to %db_hash the correct
syntax is:

   $self->{db_hash}    = \%db_hash;

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


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

Date: Thu, 08 Nov 2001 19:41:59 +0100
From: Tassilo von Parseval <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: Impossible to store tied hash (MLMDB) in an object?
Message-Id: <3BEAD1F7.4070300@post.rwth-aachen.de>

nobull@mail.com wrote:

> Tassilo von Parseval <tassilo.parseval@post.rwth-aachen.de> writes:
> 
> 
>>     $self->{db_hash}    = { %db_hash };
>>
> 
> That makes $self->{db_hash} a reference to a new hash containing a
> copy of the contents of %db_hash.


Gee, you are - as always - right. I overlooked this subtle difference of 
  referencing an array versus creating a reference to a newly populated 
hash that lost its 'tie'dness. The first time actually that this has 
bitten me.

Thanks again!


Tassilo


-- 
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};



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

Date: Thu, 8 Nov 2001 14:32:59 -0000
From: "Ross Holmes" <ross@timeplan.ltd.uk>
Subject: Re: Mail Script Has Just Stopped Working!?!?!
Message-Id: <1005229959.22505.0.nnrp-10.9e98ebed@news.demon.co.uk>

Thank you, I can't believe that I missed something that simple.
DHU!!

It looks like I have a lot of work to do in getting my Perl skills up to
scratch.

"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrn9ul0ll.ion.tadmc@tadmc26.august.net...
> Ross Holmes <ross@timeplan.ltd.uk> wrote:
>
> >I have put a copy of the script at
http://www.timeplan.ltd.uk/form-mail2.pl
> >
> >If anyone can figure out why this has stopped working then I would be
> >extremely grateful.
>
>
> If you enable warnings, perl itself will tell you that
> there is a problem with this line:
>
>    print MAIL "<a href="mailto:$FORM{'email'}">$FORM{'name'}</a>\n";
>               ^        ^                     ^
>               ^        ^                     ^
>
> [ A "here-doc" would make your code much easier for you to read.
>   Read about it in perldata.pod.
> ]
>
>
> Your script does not enable warnings, though you appear to be
> attempting to enable them.
>
>    #!/bin/perl -- -*-perl-*- -w
>
> perl starts parsing at the first mention of "perl" and stops
> when it hits "--" which marks the end of the switches. So
> the "-w" is never seen.
>
>    #!/bin/perl -w
>
> ought to work.
>
>
> Or, just try it at the command line:
>
>    perl -cw form-mail2.pl
>
>
> --
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas




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

Date: 08 Nov 2001 17:37:17 +0000
From: nobull@mail.com
Subject: Re: mod_perl - a last man standing-problem
Message-Id: <u97kt1qi42.fsf@wcl-l.bham.ac.uk>

ralf@pps.de (Ralf Inceoglu) writes:

> I' set up an apache (1.3.20) with mod_perl (1.26) and other modules, then
> created a script which uses Apache::Session::File and everything worked
> fine. But when i copied and modified the script for some other purpose, i
> got the problem that only one of them can run.

This probably means you tried to use some resource for two
incompatible purposes at the same time.

> Every script alone does fine, but when the 2nd script is called, the
> first one get hurt regardless which of them is first. Get hurt means
> that some requsts for the first script may get solved, depending on
> which httpd is met and which of them has seen the second script.

In that case it sounds like the resource in question is probably a
Perl symbol (or symbol table) or Perl4-style library.

> It looks like one httpd can hold only one mod-perl-script.

Nonsense.

> I've read a lot FAQs which telling me that the required libs are read only
> once,

Which is why you Perl4-style libs and modules don't mix safely.  If
two or more modules (well packages strictly speaking)  try to import
stuff into their symbol tables by simply using require() only the
first one will succede.

Under Apache::Registry your CGI script is effectively converted into a
module.

BTW: Last time I said that someone "corrected" "module" to
"subroutine".  It is also true to say that Apache::Registry converts
your script to a subroutine.  True, but not relevant.  It is the fact
that each converted script gets it's own namespace that is the problem.

> Can anyone help me with that "last man standing" problem ?

Stop using Perl4-style libraries.

For further discussion see previous threads with "mod_perl" in the subject.

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


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

Date: Thu, 08 Nov 2001 16:27:54 GMT
From: Zoltan Kandi <zoltan.kandi@tellabs.com>
Subject: Re: Need Help To Get Started
Message-Id: <3BEABFBA.F7443FEA@tellabs.com>

Hi,

Sarah Evan wrote:
> 
> Where do get Perl's software to run on Windows 2000? I downloaded a source
> code from www.perl.com but don't know how to make it work on Windows 2000. I
> extracted the file but there is no install.exe or setup.exe. Must I have a
> compiler like Visual C++ in order to use the software? Where can I get
> instruction to use the Perl software on Windows? I understand that Perl is
> an interpreted language not a compiled language like C/C++. Your help will
> be appreciated, thanks in advance.

If you've never worked with perl before, download ActivePerl from
www.activestate.com
It's a complete (and free) package, I started with it myself. Grab the
latest build 630 from the download section:

http://downloads.ActiveState.com/ActivePerl/Windows/5.6/ActivePerl-5.6.1.630-MSWin32-x86.msi

The MSI installer should already be available in W2K (I use NT), if not,
grab it at

http://www.activestate.com/Products/ActivePerl/system_requirements.plex#windows

Dont't miss to read the installation instructions before starting and
your perl system will run out-of-the-box.

Welcome and success with your beginning.

Zoltan Kandi, M. Sc.
Product & Application Specialist

Tellabs Netherlands BV
Perkinsbaan 17
3439 ND Nieuwegein

Tel:      +31 30 600 40 75
Fax:      +31 30 600 40 90
GSM:      +31 651 194 291
Email:    Zoltan.Kandi@tellabs.com
Internet: http://www.tellabs.com


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

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


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