[18905] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1073 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 6 11:05:55 2001

Date: Wed, 6 Jun 2001 08:05:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <991839917-v10-i1073@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 6 Jun 2001     Volume: 10 Number: 1073

Today's topics:
        (csv) Split at a coma, how? <stevemartintelecom@home.com>
    Re: 2 questions about flock (Anno Siegel)
        Date of Halloween (for Date::Calc module)? <sb@engelschall.com>
    Re: Date of Halloween (for Date::Calc module)? <lmoran@wtsg.com>
    Re: Date of Halloween (for Date::Calc module)? (Steven M. O'Neill)
    Re: Date of Halloween (for Date::Calc module)? <flegga@uk.ibm.com>
    Re: Decoding file mode <skilchen@swissonline.ch>
    Re: Decoding file mode (Mark Jason Dominus)
        Finding the object associated with a TIE from XS <dmlloyd@tds.net>
    Re: GROUP TAKEOVER IN PROGRESS <bart.lateur@skynet.be>
    Re: mod_perl and clashing module names <godzilla@stomp.stomp.tokyo>
    Re: mod_perl and clashing module names <comdog@panix.com>
    Re: Net::RawIP anybody can help? <frank.castle@marvelknights.net>
    Re: Newb needs help with input from forms (Shawn Michael Taub)
        Newbie:  Help with cookie code ? <noemail@noemail.com>
        Perl debugger: specify lines within modules? <jboes@nexcerpt.com>
    Re: perl debugging questions <mjcarman@home.com>
    Re: Perl is dead! Long live Perl! <bart.lateur@skynet.be>
    Re: Perl is dead! Long live Perl! <josef.moellers@fujitsu-siemens.com>
    Re: Perl is dead! Long live Perl! <comdog@panix.com>
    Re: Perl Regex Question <bart.lateur@skynet.be>
        problems with perlcc <RIMUOVIclaves.do.amaral@netbusiness.it>
    Re: Problems with Threads and Signal handlers <dan@tuatha.sidhe.org>
    Re: Process form WITHOUT feedback page PART 2 (GearGirl)
    Re: question : OO accessing main::a from main::b::c ?? <gnarinn@hotmail.com>
        Text::Autoformat (was Re: who is authentic?...) (Greg Bacon)
    Re: Text::Autoformat (was Re: who is authentic?...) (Greg Bacon)
        The difference between =~ and = <lmoran@wtsg.com>
    Re: The difference between =~ and = <thelma@alpha2.csd.uwm.edu>
    Re: The difference between =~ and = (hymie!)
        try ... catch <bvv@get.be>
    Re: try ... catch <der.prinz@gmx.net>
    Re: using CGI and CGI::Cookie at the same time <todd@designsouth.net>
    Re: who is authentic? $hash_ref->{'key'} or $hash_ref{k <bart.lateur@skynet.be>
        xterm backspace character? r1ckey@home.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 06 Jun 2001 14:57:12 GMT
From: "Steve Martin" <stevemartintelecom@home.com>
Subject: (csv) Split at a coma, how?
Message-Id: <cxrT6.44423$Be4.14411182@news3.rdc1.on.home.com>

Hi,

I am doing a small script that opens a weekly schedule that an admin assist
is producing and saving in .csv.
I need to know how to split at every coma in order to incert every
separation in a nice html table.  I need the splitting codes that could be
added to my own codes.  See the perl codes a the bottom of this post.


The schedule looks something like this:  <start>

      "Version finale, le 18 mai,
2001",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      Saison du 4 juin au 3 septembre
2001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      Rogers télé-communautaire 23 (horaire
d'été),,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      Heure,Lundi ,Mardi ,Mercredi ,Jeudi,Vendredi ,,Samedi ,Dimanche
,Heure,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      9:00,Babillard communautaire de 00:00 à
17:00,,,,,,,,9:00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      9:30,,,,,,,,,9:30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      10:00,,,,,,,,,10:00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      10:30,,,,,,,,,10:30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      11:00,,,,,,,,,11:00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      11:30,,,,,,,,,11:30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      12:00,,,,,,,,,12:00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      12:30,,,,,,,,,12:30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      13:00,,,,,,,,,13:00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      13:30,,,,,,,,,13:30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      14:00,,,,,,,,,14:00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      14:30,,,,,,,,,14:30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
      15:00,,,,,,,,,15:00
      15:30,,,,,,,,,15:30
      16:00,,,,,,,,,16:00
      16:30,,,,,,,,,16:30
      17:00,L'Art Floral,Coup de Pinceau,De fil en
Aiguille,Grouille-toi,Programmation Spéciale,,Programmation
Spéciale,Programmation Spéciale,17:00
      17:30,Bouquet de Saveurs,,,,,,Bouquet de saveurs (2),Bouquet de
saveurs (2),17:30
      18:00,Deux Par Quatre,,,,,,Deux Par Quatre (2),Deux Par Quatre
(2),18:00
      18:30,Cardio Hip Hop,,,,,,Cardio Hip-Hop (2),Cardio Hip-Hop (2),18:30
      19:00,L'Art Floral,Coup de Pinceau,De fil en
Aiguille,Grouille-toi,Programmation
Spéciale,,Grouille-toi,Grouille-toi,19:00
      19:30,Bouquet de Saveurs,,,,,,Répertoire (Sinon reprise du Bloc de
17:00),Bouquet de saveurs (2),19:30
      20:00,Deux Par Quatre,,,,,,,Deux Par Quatre (2),20:00
      20:30,Cardio Hip Hop,,,,,,,Cardio Hip-Hop (2),20:30
      21:00,Répertoire (Sinon reprise du Bloc de 17:00),Coup de
Pinceau,Répertoire (Sinon reprise du Bloc de 17:00),Grouille-toi,Répertoire
(Sinon reprise du Bloc de 17:00),,,Coup de inceau,21:00
      21:30,,Bouquet de Saveurs,,Bouquet de Saveurs,,,Babillard
communautaire de 21:30 à 0:00,,21:30
      22:00,,Deux Par Quatre,,Deux Par Quatre,,,,,22:00
      22:30,Cardio Hip Hop,Cardio Hip Hop,Cardio Hip Hop,Cardio Hip
Hop,Cardio Hip-Hop,,,,22:30
      23:00,Babillard communautaire de 23:00 à
:00,,,,,,,,23:00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,


23:30,,,,,,,,,23:30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,

,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,

,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,

,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,

,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,


</end>


#!usr/bin/perl

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

$doc= 'D:\Apache\cgi-bin\horaire.csv';
open(CN, $doc)|| die $!;
my %lines;
my @doc = <CN>;
my $line = <CN>;
print "<table>\n";
foreach my $line (@doc){   #### Also split at every coma in a line and
incert the splitted data even if it is just a blank space inside an HTML
cell (<tr> <td> data </td> <td> next cell </td> </tr>)
print '<tr><td>';
print $line;
print '</td></tr>';
}
print "</table>";
close CN;


Thanks!!!

Steve Martin





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

Date: 6 Jun 2001 14:45:53 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: 2 questions about flock
Message-Id: <9flfn1$kbd$1@mamenchi.zrz.TU-Berlin.DE>

According to Alan J. Flavell <flavell@mail.cern.ch>:
> On 5 Jun 2001, Eric Bohlman wrote:
> 
> > Yep.  You need to open it in read/write mode, get an exclusive lock on it,
> > read it, truncate it, rewrite it, and close it.  The point is that you
> > have to keep the lock on it throughout the process: a common beginner's
> > mistake is opening the file in read mode, locking it, reading it, closing
> > it, opening it in write mode, locking it, rewriting it, and then closing
> > it.
> 
> Indeed.
> 
> But suppose that the action of reading it and doing whatever
> processing was needed, was something that took a significant amount of
> time, during which you wanted other processes (using suitable locking,
> of course) to be able to read it.  It seems as if there's no really
> feasible way to leave the file shareable until the update is ready,
> and then somehow upgrade the lock for writing the new contents to the
> file.
> 
> At least that was my best understanding... I'd be glad to learn if I
> was mistaken.  Naturally, you can't close and re-open the file, as you
> pointed out;  but one might have hoped that if it was held open for
> read-write, there might have been some way to upgrade the lock later,
> when ready to rewrite the file.

My naive assumption has been that you simply lock a file again when
you want to change the type of lock. This has worked as expected in
a few experiments.

Anno


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

Date: Wed, 6 Jun 2001 15:13:29 +0200
From: Steffen Beyer <sb@engelschall.com>
Subject: Date of Halloween (for Date::Calc module)?
Message-Id: <p9alf9.72b.ln@imperia.net>

I'm currently working on the new version 5.0 of Date::Calc,
which will also contain modules for performing date calculations
which take holidays into account.

(These modules also allow to generate calendars for different
countries and years - see http://www.engelschall.com/u/sb/calendar/
in a couple of days (maybe even as soon as tomorrow) for an example.)

In order to complete my holidays profiles, I'd need to know when
exactly is Halloween in the United States (and possibly elsewhere
as well) commemorated?

I.e., I need a "formula" like "the first Thursday in November"
or something of the sort.

Thank you very much in advance for your precious help!

Best regards,
-- 
    Steffen Beyer <sb@engelschall.com>
    (This message may not be replyable. Use address on line above instead!)
    http://www.engelschall.com/u/sb/whoami/ (Who am I)
    http://www.engelschall.com/u/sb/gallery/ (Fotos Brasil, USA, ...)
    http://www.engelschall.com/u/sb/download/ (Free Perl and C Software)


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

Date: Wed, 06 Jun 2001 10:42:04 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: Date of Halloween (for Date::Calc module)?
Message-Id: <s5gsht0oagq6uj8amj6eoth9gngl6ivjs2@4ax.com>

On Wed, 6 Jun 2001 15:13:29 +0200, Steffen Beyer <sb@engelschall.com>
wrote wonderful things about sparkplugs:

SNIP
>
>In order to complete my holidays profiles, I'd need to know when
>exactly is Halloween in the United States (and possibly elsewhere
>as well) commemorated?

Halloween is always October 31st

>
>I.e., I need a "formula" like "the first Thursday in November"
>or something of the sort.

--
BSOD? In my day we didn't have 0000FF!
lmoran@wtsg.com


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

Date: 6 Jun 2001 14:51:00 GMT
From: steveo@panix.com (Steven M. O'Neill)
Subject: Re: Date of Halloween (for Date::Calc module)?
Message-Id: <9flg0k$49u$1@news.panix.com>

Steffen Beyer  <sb@engelschall.com> wrote:
>In order to complete my holidays profiles, I'd need to know when
>exactly is Halloween in the United States (and possibly elsewhere
>as well) commemorated?
>
>I.e., I need a "formula" like "the first Thursday in November"
>or something of the sort.

In the U.S. it's the first day numbered 31 in October.
-- 
Steven O'Neill                                      steveo@panix.com
                                                   www.cars-suck.org


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

Date: Wed, 06 Jun 2001 15:41:23 +0100
From: Andrew Flegg <flegga@uk.ibm.com>
Subject: Re: Date of Halloween (for Date::Calc module)?
Message-Id: <3B1E4113.775B23B4@uk.ibm.com>

Steffen Beyer wrote:
> 
[snip]
> In order to complete my holidays profiles, I'd need to know when
> exactly is Halloween in the United States (and possibly elsewhere
> as well) commemorated?

Errr... isn't it 31 October, like everywhere else?
Hallowe'en certainly is here in the UK.

<joke>
Q: Why do programmers get Halloween and Christmas confused?
A: Because Oct 31 == Dec 25
</joke>

Hope that helps,

Andrew

-- 
Andrew Flegg -- my opinions are my own, not my employer's.


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

Date: Wed, 6 Jun 2001 16:18:15 +0200
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: Decoding file mode
Message-Id: <9flegf$4kgro$1@ID-13368.news.dfncis.de>

"expressionlibre" <expression_libre@yahoo.com> schrieb im Newsbeitrag
news:83c74064.0106060407.6fb1ac2e@posting.google.com...
> Hi,
>
> I'm trying to write a function to decode numeric file mode
>  as returned by Perl "stat" function under Unix.
>
> Ex: 33204 should give  -rw-rw-r-- (normal file)
>     41471              lrwxrwxrwx (symbolic link)
>     16868              drwxr--r-- (directory)
>
> Can anybody give me some advices ?
>
Some time back in 1999 i tried to reimplement the mode_string routine
from GNU's ls in Perl. I've added your testcases and it looks like it
produces the expected results:
perl mode_string.pl produces the following output:
mode: 33204, mode_string: -rw-rw-r--
mode: 41471, mode_string: lrwxrwxrwx
mode: 16868, mode_string: drwxr--r--

----%<---------------------------------
#!perl -w
use strict;
use POSIX;

BEGIN {
  eval { S_IFMT() };
  if ($@) {
    eval "sub S_IFMT { 0170000 }";
  }

  eval { S_IFLNK() };
  if ($@) {
    eval "sub S_IFLNK { 0120000 }";
  }

  eval { S_ISVTX() };
  if ($@) {
    eval "sub S_ISVTX { 0001000 }";
  }
}

sub S_ISLNK {
  my $bits = shift;
  return (($bits & S_IFMT) == S_IFLNK);
}

sub rwx {
  my $bits = shift;
  my $rwx = "";
  $rwx  = ($bits & S_IRUSR) ? 'r' : '-';
  $rwx .= ($bits & S_IWUSR) ? 'w' : '-';
  $rwx .= ($bits & S_IXUSR) ? 'x' : '-';
  return $rwx;
}

sub setst {
  my $bits = shift;
  my @chars = split(//, shift);

  if ($bits & S_ISUID) {
    if ($chars[3] != 'x') {
      # Set-uid, but not executable by owner.
      $chars[3] = 'S';
    } else {
      $chars[3] = 's';
    }
  }
  if ($bits & S_ISGID) {
    if ($chars[6] != 'x') {
      # Set-gid, but not executable by group.
      $chars[6] = 'S';
    } else {
      $chars[6] = 's';
    }
  }
  if ($bits & S_ISVTX) {
    if ($chars[9] != 'x') {
      # Sticky, but not executable by others.
      $chars[9] = 'T';
    } else {
      $chars[9] = 't';
    }
  }
  return join('', @chars);
}

# Return a character indicating the type of file described by
#   file mode BITS:
#   'd' for directories
#   'b' for block special files
#   'c' for character special files
#   'm' for multiplexor files
#   'M' for an off-line (regular) file
#   'l' for symbolic links
#   's' for sockets
#   'p' for fifos
#   '-' for regular files
#   '?' for any other file type.

sub ftypelet {
  my $bits = shift;

  if (S_ISBLK($bits)) {
    return 'b';
  }
  if (S_ISCHR($bits)) {
    return 'c';
  }
  if (S_ISDIR($bits)) {
    return 'd';
  }
  if (S_ISREG($bits)) {
    return '-';
  }
  if (S_ISFIFO($bits)) {
    return 'p';
  }
  if (S_ISLNK($bits)) {
    return 'l';
  }
  if (S_ISSOCK($bits)) {
    return 's';
  }
  if (S_ISMPC($bits)) {
    return 'm';
  }
  if (S_ISNWK($bits)) {
    return 'n';
  }
  if (S_ISOFD($bits)) {
    # off line, with data
    return 'M';
  }
  if (S_ISOFL($bits)) {
    # off line, with no data
    return 'M';
  }

  return '?';
}

sub mode_string {
  my $mode = shift;

  my $modestr = "";

  $modestr  = ftypelet($mode);
  $modestr .= rwx(($mode & 0700) << 0);
  $modestr .= rwx(($mode & 0070) << 3);
  $modestr .= rwx(($mode & 0007) << 6);
  $modestr  = setst ($mode, $modestr);

  return $modestr;
}

sub test {
  my @tests = @_;
  foreach my $mode (@tests) {
    print "mode: $mode, mode_string: ";
    print mode_string($mode);
    print "\n";
  }
}

my @tests = qw(33204 41471 16868);
test(@tests);



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

Date: Wed, 06 Jun 2001 15:00:20 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Decoding file mode
Message-Id: <3b1e456c.6d42$30e@news.op.net>

In article <83c74064.0106060407.6fb1ac2e@posting.google.com>,
expressionlibre <expression_libre@yahoo.com> wrote:
>Hi,
>
>I'm trying to write a function to decode numeric file mode
> as returned by Perl "stat" function under Unix.
>
>Ex: 33204 should give  -rw-rw-r-- (normal file)
>    41471              lrwxrwxrwx (symbolic link)
>    16868              drwxr--r-- (directory)
>
>Can anybody give me some advices ?

The Stat::lsMode module does this.

        http://perl.plover.com/lsMode/

>Thanks ;o)

You're welcome.


-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Wed, 06 Jun 2001 15:03:07 GMT
From: "David M. Lloyd" <dmlloyd@tds.net>
Subject: Finding the object associated with a TIE from XS
Message-Id: <Pine.LNX.4.21.0106060959060.12936-100000@homebody.freemm.org>

I just want to check if I'm taking the right approach here.

I have an XS function that takes a parameter that is a reference to a tied
hash.  The XS function needs the actual object (which is a pointer to a C
structure) to do its work, so I get the object this way:

void
mymodule_function(tied_hash_ref)
    SV *tied_hash_ref
    PREINIT:
	my_struct_t *object;
	MAGIC *mg;
    CODE:
	mg = mg_find(tied_hash_ref, 'P');
	object = (my_struct_t *)SvIV((SV *)SvRV(mg->mg_obj));
	/* Do stuff with object */

Is this valid?  That is, am I allowed to grab the object out of the 'P'
magic struct?

Thanks...

- D

<dmlloyd@tds.net>




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

Date: Wed, 06 Jun 2001 13:20:21 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: GROUP TAKEOVER IN PROGRESS
Message-Id: <qibsht8qk8gpu3n49i5srs3gdjkqbtsg82@4ax.com>

Brent K Kohler wrote:

>My first royal order to all of you peons is that from this time
>foward you will add the following signature to all of your posts!

I won't. Nyehnyehnyeh.

-- 
	Bart.


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

Date: Wed, 06 Jun 2001 08:00:20 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: mod_perl and clashing module names
Message-Id: <3B1E4584.75FAC56A@stomp.stomp.tokyo>

Kenneth Pedersen wrote:

(snipped)

> I am planning to port an application to mod_perl using Apache::Registry.
> However, my problem is that some of the modules in my application uses the
> same module names in different directories.
 
> The TestMod.pm module in directory 1 contains a subroutine, named
> identify, that prints the number 1. The TestMod.pm module in directory 2
> contains a subroutine also named identify, that prints out the number 2.
 
> The Test.pl scripts loads TestMod.pm via use TestMod; and calls
> TestMod::identify.
 
> Now, when using mod_perl and loading the scripts, they work correctly the
> first time. But on subsequent reloads the wrong identify subroutine is
> often called (e.g. identify from 1/TestMod.pm is called from 2/Test.pl and
> vice versa).
 
> I think this is because mod_perl only loads the modules the first time the
> scripts are run, and perl thinks that the modules are the same because
> they have the same names. What identify subroutine gets called is
> dependent on which httpd server process serves the request.

> Renaming ... the scripts is not an option.

Why is this? Are those module names permanently burned
into your system bios chip?

> ... moving the scripts is not an option. 

Wouldn't make any difference, right? Why would you
consider this be an option initially?

It is an exceptionally poor programming practice to
give two modules the same name, especially when working
with pseudo sticky mod_perl. Obviously you could not
give two modules the same name within a single directory.
Why would you expect mod_perl to sort your modules by
internal path?

You should rethink your approach and your options.


Godzilla!


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

Date: Wed, 06 Jun 2001 11:04:49 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: mod_perl and clashing module names
Message-Id: <comdog-019770.11044906062001@news.panix.com>

In article 
<Pine.GSO.4.33.0106061434520.23070-100000@jeeves.stud.ntnu.no>, Kenneth 
Pedersen <kennep@stud.ntnu.no> wrote:

> I am planning to port an application to mod_perl using Apache::Registry.
> However, my problem is that some of the modules in my application uses the
> same module names in different directories.

> As an example, if I have the following setup:
> 1/
>   TestMod.pm
>   Test.pl
> 2/
>   TestMod.pm
>   Test.pl

> Now, when using mod_perl and loading the scripts, they work correctly the
> first time. But on subsequent reloads the wrong identify subroutine is
> often called (e.g. identify from 1/TestMod.pm is called from 2/Test.pl and
> vice versa).

use different namespaces for the modules.  otherwise, there
isn't a way for apache or mod_perl not to know which TestMod
you want when you have two of them loaded.

i had this same problem until i looked at how mod_perl was
storing the subroutines.  check out the subroutine name that
mod_perl actually uses and you'll see what i mean. :)

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



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

Date: Wed, 6 Jun 2001 15:16:41 +0200
From: "Alex Randol" <frank.castle@marvelknights.net>
Subject: Re: Net::RawIP anybody can help?
Message-Id: <9fleha$qsq$01$1@news.t-online.com>

I tested some other things but it doesn't seem to work. :-(

Alex

Alex Randol <frank.castle@marvelknights.net> schrieb in im Newsbeitrag:
9fkk0l$1ha$02$1@news.t-online.com...
> Thanks! The example looks exactly like the one I wrote. I think it shoudkl
> work well on Irix, because everything compiled fine without errors and
Irix
> is also able to create packages with other tools.
>
> Alex
>
> Michael Fuhr <mfuhr@dimensional.com> schrieb in im Newsbeitrag:
> 9fjnup$6eo@flatland.dimensional.com...
> > "Alex Randol" <frank.castle@marvelknights.net> writes:
> >
> > > I set source source to an adress (in ip => {...}) to some others host
> adress
> > > to fake a ip (udp) package to look like from another host. But send
told
> me
> > > that it could not send this package ("sendto(): Cannot assign
requested
> > > adress")  because it could n't be assigned. Is it possible to fake an
IP
> > > package with Net::RawIP and how does it work? I think it should be
> possible
> > > because this package is intended to manipulate IP packages.
> >
> > Indeed it is, and it's worked fine for me.  Spoofing packets is a
> > useful White Hat tool, although Black Hats can certainly use it for
> > their own nefarious purposes.  I've used Net::Rawip extensively to
> > troubleshoot connectivity problems through firewalls.
> >
> > > Note: I am using Irix 5.3, Net::RawIP compiled fine
> >
> > I suppose there could be an issue with Irix; it's worked for me on
> > Solaris, FreeBSD, and Linux.  Here's an example that should send
> > a UDP packet from 10.1.2.3:1234 to 10.3.4.5:5678:
> >
> > #!/usr/bin/perl -Tw
> >
> > use Net::RawIP;
> > use strict;
> >
> > my $ip = Net::RawIP->new({
> >     ip => {
> >         saddr => "10.1.2.3",
> >         daddr => "10.3.4.5",
> >     },
> >     udp => {
> >         source => "1234",
> >         dest   => "5678",
> >         data   => "What hath Larry wrought?",
> >     },
> > });
> >
> > $ip->send(0, 1);
> >
> > --
> > Michael Fuhr
> > http://www.fuhr.org/~mfuhr/
>
>




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

Date: 6 Jun 2001 06:55:30 -0700
From: shawntaub@yahoo.ca (Shawn Michael Taub)
Subject: Re: Newb needs help with input from forms
Message-Id: <d8fa40ef.0106060555.2e23f90a@posting.google.com>

Uh, I don't think I made myself clear enough.  I've been working with
perl for a few months and I still don't understand anything
whatsoever.  I'm still extremely confused as to what to do, and I'm
hoping someone will have the patience to explain it to me.  Thanx.


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

Date: Wed, 06 Jun 2001 15:00:42 GMT
From: "Thing" <noemail@noemail.com>
Subject: Newbie:  Help with cookie code ?
Message-Id: <uArT6.2169$9m.167051@newsread2.prod.itd.earthlink.net>

Hello, with this code i am trying to set a cookie.

#!/perl/bin/perl.exe -w
use CGI qw/:standard/;
use DBI;
use CGI;
use CGI::Carp qw(fatalsToBrowser);

$q = new CGI;
my $cookie = $q->cookie(-name => "something",
                        -value => "something",
                        -expires=> "+1d");
print $q->redirect (-url =>"http://dacry/cgi-bin/loginresults.pl",-cookie =>
$cookie);

Then i am trying to read the cookie and print the results to the Browser
just as a test.  I posted this code before and someone said it worked on
their PC, but i cant get it to work on several PC's.

#!/perl/bin/perl.exe -w
use CGI qw/:standard/;
use DBI;
use CGI;
use CGI::Carp qw(fatalsToBrowser);

$query = new CGI;
$answers = $query->cookie(-name=>'something');

print "Content-Type: text/html\n\n";
print "FAAAAAAAAAAAAAAAACKKCKCKKKKK";
print $answers;

does anyone see an obvious mistake im making ?  or maybe an exaple of
working cookie code ?  Thanks.




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

Date: Wed, 06 Jun 2001 10:39:55 -0400
From: "Jeff Boes" <jboes@nexcerpt.com>
Subject: Perl debugger: specify lines within modules?
Message-Id: <20010606.103954.11614769.26368@takin.private.nexcerpt.com>

Is there a way to specify a breakpoint within another module? E.g., 

use Foo;
line1;
foo::stub;
line2;

-------
package Foo;

sub stub {
  linethis;
  linethat;
}


I want to set a breakpoint in Foo::stub at some line number, but I don't
want to wait until stub() gets called before I set the breakpoint.

-- 
Jeff Boes                                             vox 616.226.9550
Database Engineer                                     fax 616.349.9076
Nexcerpt, Inc.                                      jboes@nexcerpt.com


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

Date: Wed, 06 Jun 2001 08:24:17 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: perl debugging questions
Message-Id: <3B1E2F01.2D9D7665@home.com>

Michael Still wrote:
> 
> 
> "Clinton A. Pierce" wrote:
> 
>> Michael Still writes:
[...]
> 23 sub headlines($) {

Are you *certain* you want this prototype?

> 39        $text . '</ul>';
> 40  return $text;
> 41 }
> 
> so how SHOULD this be done so as to not get errors?

$text .= '</ul>';

>>> Too many arguments for culture::dining at e2000.pl line 205, 
>>> near "}) "
[similar errors]
>>
>> We don't have these modules to tell, but from the look of it 
>> someone used a prototype and then lied about the argument count
>> later.  Most likely someone said something like:
>>
>>         sub foo () {
>>         }
> 
> Which modules dont you have to be able to tell. i believe this problem
> is within the primary module (e2000.pl)
> the lines that seem screwed up are like this:
>     elsif ( $page eq 'dining' ) {       return
> culture::dining($fields{screen}) }

Either the culture::dining() function takes no arguments or it was 
declared with an incorrect prototype. Clinton's guess was that the 
function was declared with an *empty* prototype, and that's what it 
looks like to me too.

Protypes in Perl aren't like prototypes in any other language. They are 
rarely needed, and shouldn't be used if they aren't. Read through the 
perlsub manpage, and pay particular attention to the section on 
prototypes. Once you get a handle around that, it should be clear
what you're doing wrong here. (If not, ask about it, and someone here
can explain.)

> where in each line, $fields is the array, and screen is the index we
> want in that array

$fields (which isn't anywhere in your code) would be a scalar. %fields 
(which is what you have) is a hash. "screen" is a key, not an index --
arrays have indices, hashes have keys. $fields{screen} is the value of 
the entry in the hash %fields with the key "screen".

Try to be more careful with your syntax. Programming is a precise art, 
and so is talking about it. If you use choose the wrong words to 
describe your problem, you risk getting the wrong answer.

HTH.
-mjc


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

Date: Wed, 06 Jun 2001 13:33:32 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl is dead! Long live Perl!
Message-Id: <v9cshtcovu8ljsbbf92elmtq1fsis1d910@4ax.com>

Andrew Lee wrote:

>Now that corporate reins are tightened and Java is all the rage -- what
>manager would invite chaos into her/his system with crazy Perl hacks?

What is it will all these trolls these days?

FWIW: I haven't heard much good/hype about Java in the last few years.

-- 
	Bart.


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

Date: Wed, 06 Jun 2001 16:14:56 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Perl is dead! Long live Perl!
Message-Id: <3B1E3AE0.704CDAA1@fujitsu-siemens.com>

Andrew Lee wrote:
> =

> Now that corporate reins are tightened and Java is all the rage -- what=

> manager would invite chaos into her/his system with crazy Perl hacks?
> =

> So much better to leave the mind behind -- Programming with a mouse can=

> be fun!  Yes it can!
> =

> Soon, very soon unix will be a a footnote in the history of the Almight=
y
> Microsoft.
> =

> Beware beware ... Perl angels look down upon us -- from the unemploymen=
t
> line.
> =

> Larry and Tom and Randall have gigs -- what about you?  Your manager is=

> willing to support your crazy Perl antics?  When will he do the RIGHT
> thing and turn to Java???
> =

> Come -- join me on the unemployment line!  Be a statistic!  Be all that=


"Join me"? I.e. you ARE on the unemployment line? Even when waving The
Flag and praising Java?
Then how about stop trolling and choose The Right Tool for the job. Be
it Java, Perl, Python, whatever. Knowing the right tools has never put
someone on the dole.

Enjoy your stay,

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


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

Date: Wed, 06 Jun 2001 11:00:05 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Perl is dead! Long live Perl!
Message-Id: <comdog-16516D.11000506062001@news.panix.com>

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

> Andrew Lee wrote:
> 
> >Now that corporate reins are tightened and Java is all the rage -- what
> >manager would invite chaos into her/his system with crazy Perl hacks?
> 
> What is it will all these trolls these days?
> 
> FWIW: I haven't heard much good/hype about Java in the last few years.

um, i thought it was a humor piece, hence the irony. :)

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



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

Date: Wed, 06 Jun 2001 13:28:36 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl Regex Question
Message-Id: <s1cshto7kvuovjr7etkff858pt9rnimfnm@4ax.com>

Arne Jamtgaard wrote:

>You listed 0., 1., and 880. as 'legal', but above defined a floating
>point number as _two_ non-empty strings.  Your examples look like 
>the second is indeed empty, yet are called 'legal'.
>
>Which is it?

He also said that the first one should not start with a zero. Yet, ".0"
is not "legal", and "0.0" is.

-- 
	Bart.


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

Date: Wed, 6 Jun 2001 15:08:24 +0200
From: "Claves do Amaral" <RIMUOVIclaves.do.amaral@netbusiness.it>
Subject: problems with perlcc
Message-Id: <9fla4a$khu$1@news.netpeople.it>

Hi everybody,
I use active state under winNT
I have problems with a script that compiles correctly when I type:

#perl formatta_ama.pl

but when I try to compile it with perlcc I get an error:

#perlcc formatta_ama.pl

----------------------------------------------------------------------------
----
Compiling formatta_ama.pl:
----------------------------------------------------------------------------
----
Making C(formatta_ama.pl.c) for formatta_ama.pl!
D:\Perl\bin\Perl.exe -ID:/Perl/lib -ID:/Perl/site/lib -I. -MB::Stash -c
formatta_ama.pl
D:\Perl\bin\Perl.exe -ID:/Perl/lib -ID:/Perl/site/lib -I. -MO=C,-l2000,-umai
n,-uattributes,-uDB,-u<none>,-uWin32 formatta_ama.pl
Impossibile trovare il file specificato.
ERROR: In generating code for formatta_ama.pl!


I tried the following, with no fortune:


#perl -MO=CC formatta_ama.pl

Prescan
Can't call method "can" without a package or object reference at
D:/Perl/lib/B/C.pm line 1341.
CHECK failed--call queue aborted.

I presume I need some missing file or module. How may I check it?
Thank you in advance

Claves do Amaral
claves.do.amaral@netbusiness.it





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

Date: Wed, 06 Jun 2001 14:42:30 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Problems with Threads and Signal handlers
Message-Id: <qjrT6.62131$v5.4757458@news1.rdc1.ct.home.com>

Scott Rutherford <arbman@dhmail.net> wrote:
> Hello,

> I was wondering if anyone cen tell me why this doesn't work. The basic
> framework is for a multi-forking client to parse multiple documents from
> several sources and the basics work fine if I comment out the downloader
> thread. Then the child signal handler reaps it's children like it's
> supposed to and a constant number of client processes can be maintained.
> However uncommenting the thread causes the signals to be ignored or
> something, any ideas anyone????????

Signals work rather differently with threads enabled then they do in a
non-threaded program. (And it's rather platform-dependent on top of
it)

The only really safe way to handle signals with threads is to use
a signal-handling thread. Thread::Signal will do this, though I'm
not 100% sure it works. (And things are different again if you're
running on Linux, as it handles signals in a threaded program in
a distinctly non-POSIX way)

					Dan


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

Date: 6 Jun 2001 07:36:45 -0700
From: m-m@lcc.net (GearGirl)
Subject: Re: Process form WITHOUT feedback page PART 2
Message-Id: <6f51e848.0106060636.6c769e25@posting.google.com>

"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message news:<3B1D7F9F.AB657AFA@stomp.stomp.tokyo>...

First...I must ask....Choctaw???

From some of the other posts I've seen, I wasn't sure WHAT kind of
response I'd get from you (flame or help).  I appreciate the help. 
Seems there is more to Godzilla! than initially meets the eye...

> GearGirl wrote:
>  
> (snipped)
> 
> > As suggested, I used the "Status: 204 No Response" lines in my Perl
> > script to try to capture some hidden info on one of my pages WITHOUT
> > giving the user a feedback page...
> 
> I have successfully replicated what you are doing. This
> works perfect with Mozilla 4.7 although I understand your
> problem is with Microsoft's browser. As you know MSIE does
> not meet industry standards. Nonetheless, maybe you will
> spot something in my html code and script code which 
> might be of help.

[snipped]

The only significant difference I had was I preceded

> print "Status: 204 No Response\n\n";

with print "Content-type: text/plain\n"; 

But even after I commented it out, I still got that confounded window
popping up.  It does log the data as requested, but unfortunately it's
not doing it "behind the scenes" like I wanted it to.

My script receipt.pl (documentation stripped out) follows (my html was
included in the first post of this string, "test" was the hidden field
in the form):

_____________________________________________________________________________

#!/usr/bin/perl -w

require 'parseform.lib';

&parse_form;
&get_date;
&logit;

$test = $formdata{'test'};

sub get_date {

    @days   = ('Sunday','Monday','Tuesday','Wednesday',
               'Thursday','Friday','Saturday');
    @months = ('January','February','March','April','May','June','July',
	         'August','September','October','November','December');

    ($sec,$min,$hour,$mday,$mon,$year,$wday) =
(localtime(time))[0,1,2,3,4,5,6];
    $time = sprintf("%02d:%02d:%02d",$hour,$min,$sec);
    $year += 1900;

    $date = "$days[$wday], $months[$mon] $mday, $year at $time";

}

sub logit {

if ($ENV{'HTTP_COOKIE'}) {
@cookies = split (/; /, $ENV{'HTTP_COOKIE'});
foreach $cookie (@cookies) {
($name, $value) = split (/=/, $cookie);
$crumbs{$name} = $value;
}

$cookiestring = $crumbs{'cookiestring'};
$coID = $crumbs{'coID'};
$longname = $crumbs{'longname'};

chomp ($longname);

&no_response;

&valid_viewer;

exit;
} else {

&no_response;

&invalid_viewer;

exit;
}

sub valid_viewer {

open(LOGIT, ">LOG/$longname.txt") || &ErrorMessage;
chmod(0777, "LOG/$longname.txt");
print LOGIT "$coID\n";
print LOGIT "$test\n";
print LOGIT "$date\n";
close(LOGIT);

}

sub no_response {

# print "Content-type: text/plain\n";
print "Status: 204 No Response\n\n";

}

sub invalid_viewer {

print <<HTML_CODE;

<HTML>
<HEAD>
<META NAME="description" CONTENT="UNAUTHORIZED ACCESS">
</HEAD>

<TITLE>
UNAUTHORIZED ACCESS</TITLE>

<BODY BGCOLOR="#000000" link="yellow" vlink="red" alink="red">
<FONT COLOR="#FFFFFF" SIZE="2" FACE="ARIAL">

<FONT COLOR="RED" SIZE="3">
<CENTER>
<B>
UNAUTHORIZED USER ERROR</B>
</CENTER>
</FONT>
<BR>
<HR>
<BR>
<B>
You have not yet registered or your registration has expired. &nbsp;
Page views are not allowed for unregistered viewers.
<BR>
<BR>
Please go back and register or re-register to gain access, or contact
your
<A HREF="mailto:my-email\@my.email.extension">administrator</A> if you
feel
this message is in error.
</B>

</FONT>
</BODY>
</HTML>

HTML_CODE
}
}
____________________________________________________________________________

Is there any other way to just get the script to process the form, log
the data, and END THERE?

~Melissa


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

Date: Wed, 6 Jun 2001 14:34:57 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: question : OO accessing main::a from main::b::c ??
Message-Id: <991838097.413727248087525.gnarinn@hotmail.com>

In article <cc1fb562.0106060347.483f2f22@posting.google.com>,
Robin Breman <rbreman@avensus.nl> wrote:
>
>I've got two pacakges A and B, but package B uses package C,
>and package C needs to do something with a function defined in A.
>

>in this example i try to access a string from main::a in main::b::c
>

>
>
>package main;
>
>use A
>use B
>
(rest snipped)

how about creating a minimal example that can be tested?

are you talking about packages or modules here?
if you are just talking about these packages in one file,
just skip the 'use A' , 'use B' and 'use C' lines and it should compile

gnari


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

Date: Wed, 06 Jun 2001 14:48:31 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Text::Autoformat (was Re: who is authentic?...)
Message-Id: <thsglvkp0hmf12@corp.supernews.com>

In article <g8wdO4mRh4gNfi+UvzVt15atLQ7C@4ax.com>,
    Jac.m.a.m.Oppers  <Jac@Oppers.nl> wrote:

: On Wed, 06 Jun 2001 02:31:51 -0000, gbacon@HiWAAY.net (Greg Bacon)
: wrote:
: 
: >ObDamianWorship: I've been using Text::Autoformat lately, and it's a
: >wonderful piece of code that's always been on my wish list.
: 
: Yes, it is a very nice tool, but I would not advice to use it in this
: newsgroup :-)

I used it on the text from the manpage.

:                If *I* apply Text::Autoformat to the text above, it
: seems to mess up especially this part :
: 
: >        $who = "Larry";
: >        print PASSWD "${who}::0:0:Superuser:/:/bin/perl\n";
: >        print "We use ${who}speak when ${who}'s here.\n";
: 
: Text::Autoformat is not capable of recognizing its own authentic
: language anymore :-)  Maybe I did not try all options yet ?

I believe recognizing code sections in on the TODO list.

Greg
-- 
Boon: Now, she should be decent looking, but we're willing to trade looks for
      a certain kind of morally casual attitude.


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

Date: Wed, 06 Jun 2001 14:51:59 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Text::Autoformat (was Re: who is authentic?...)
Message-Id: <thsgsfnnubor73@corp.supernews.com>

In article <thsglvkp0hmf12@corp.supernews.com>,
    Greg Bacon <gbacon@hiwaay.net> wrote:

: In article <g8wdO4mRh4gNfi+UvzVt15atLQ7C@4ax.com>,
:     Jac.m.a.m.Oppers  <Jac@Oppers.nl> wrote:
: 
: : Yes, it is a very nice tool, but I would not advice to use it in this
: : newsgroup :-)
: 
: I used it on the text from the manpage.

 ...but had to do the code section manually.  Small price to pay.

Greg
-- 
When government forces people to help their neighbors, conscience
atrophies.  When people are free to choose whether to help their
neighbors or not, conscience is strengthened.
    -- Jacob G. Hornberger


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

Date: Wed, 06 Jun 2001 10:28:50 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: The difference between =~ and =
Message-Id: <ibesht0ukpnbovr9sgmh2v7nfcf6gtddmi@4ax.com>

if you run this:

$foo = (AbcDEFGhi) ;
$foo =~ tr/A-Z/a-z/ ;
print $foo ;

you get: 

abcdefghi

if you run this:  (I have run it with warnings)

$foo = (AbcDEFGhi) ;
$foo = tr/A-Z/a-z/ ;
print $foo ;

you get this:

0

what does this happen?

--
BSOD? In my day we didn't have 0000FF!
lmoran@wtsg.com


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

Date: 6 Jun 2001 14:47:43 GMT
From: Thelma Lubkin <thelma@alpha2.csd.uwm.edu>
Subject: Re: The difference between =~ and =
Message-Id: <9flfqf$32j$1@uwm.edu>

Lou Moran <lmoran@wtsg.com> wrote:
: if you run this:

: $foo = (AbcDEFGhi) ;
: $foo =~ tr/A-Z/a-z/ ;
: print $foo ;

           The code above applies tr to $foo.

: you get: 

: abcdefghi

: if you run this:  (I have run it with warnings)

: $foo = (AbcDEFGhi) ;
: $foo = tr/A-Z/a-z/ ;
: print $foo ;

           The code above applies tr to $_, which you haven't set.

: you get this:

: 0

: what does this happen?


Excerpt from perlop:

  tr/SEARCHLIST/REPLACEMENTLIST/cds

	  Translates all occurrences of the characters found in the search
	  list with the corresponding character in the replacement list.  It
	  returns the number of characters replaced or deleted.	 If no string
	  is specified via the =~ or !~ operator, the $_ string is
	  translated.

                              --thelma
: lmoran@wtsg.com


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

Date: Wed, 06 Jun 2001 14:57:57 -0000
From: hymie@lactose.smart.net (hymie!)
Subject: Re: The difference between =~ and =
Message-Id: <thsh7l71o8ci60@corp.supernews.com>

In our last episode, the evil Dr. Lacto had captured our hero,
  Lou Moran <lmoran@wtsg.com>, who said:
>if you run this:  (I have run it with warnings)
>
>$foo = (AbcDEFGhi) ;
>$foo = tr/A-Z/a-z/ ;
>print $foo ;
>
>you get this:
>
>0

perldoc perlop tells you this:

       tr/SEARCHLIST/REPLACEMENTLIST/cds
       y/SEARCHLIST/REPLACEMENTLIST/cds
               It returns the
               number of characters replaced or deleted.  If no
               string is specified via the =~ or !~ operator, the
               $_ string is transliterated.

Does that answer your question?

hymie!          http://www.smart.net/~hymowitz          hymie@lactose.smart.net
===============================================================================
Life is what happens to you while you're busy making other plans. --John Lennon
===============================================================================


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

Date: Wed, 6 Jun 2001 15:37:44 +0200
From: "Benny Van de Velde" <bvv@get.be>
Subject: try ... catch
Message-Id: <3b1e31c6$0$194$4d4efb8e@news.be.uu.net>

Hi all,

Is there also a way to use
try {
 ......
} catch {
 ...
}

in Perl ?


Thanks in advance,
Benny.







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

Date: Wed, 6 Jun 2001 16:49:05 +0200
From: "Stefan Weiss" <der.prinz@gmx.net>
Subject: Re: try ... catch
Message-Id: <3b1e42a1$1@e-post.inode.at>

Benny Van de Velde <bvv@get.be> wrote:

> Is there also a way to use
> try {
> ......
> } catch {
> ...
> }
>
> in Perl ?

Yes, there are several. The usual construct is

eval {
 ..
};
if ($@) {
 ..
}

But if you want structured exceptions, otherwise, finally, etc,
have a look at the excellent Error.pm module on CPAN.

hth,
stefan





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

Date: Wed, 06 Jun 2001 15:01:55 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: using CGI and CGI::Cookie at the same time
Message-Id: <DBrT6.118199$I5.27384897@news1.rdc1.tn.home.com>


"David Efflandt" <see-sig@from.invalid> wrote in message
news:slrn9hr00f.2ot.see-sig@typhoon.xnet.com...
> On Tue, 05 Jun 2001 18:45:17 GMT, Todd Smith <todd@designsouth.net> wrote:
> > Here's my problem: If I use CGI and CGI::Cookie at the same time, I
can't
> > get a CGI object to work.
>
> CGI.pm includes cookie creation and handling routines.  What do you need
> from CGI::Cookie that is not already included in CGI.pm?
>
> --

I don't know- there must have been some reason CGI::Cookie was built on top
of CGI






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

Date: Wed, 06 Jun 2001 13:27:17 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: who is authentic? $hash_ref->{'key'} or $hash_ref{key}?
Message-Id: <vqbsht49u5f2vddthip85e0e8moupindbm@4ax.com>

kalasend at YAHOO dot COM wrote:

>oh no, i was asking, for the key, should I quote it or not?
>seems like both are syntactically ok to me...

In recent enough versions of perl you NEVER need to quote a bareword as
a hash key. 5.004 did give a warning if, for example, you uses "lc" as a
hash key:

	$hash{lc}

That situation, or worse, will not ever come back.

Now, for the definition of a bareword... note that "a'b" will be
converted to "a::b":

	my %hash;
	$hash{a'b} = 1;
	use Data::Dumper;
	print Dumper \%hash;
-->
	$VAR1 = {
	          'a::b' => 1
	        };

-- 
	Bart.


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

Date: Wed, 06 Jun 2001 14:56:55 GMT
From: r1ckey@home.com
Subject: xterm backspace character?
Message-Id: <XwrT6.61419$ko.993957@news1.frmt1.sfba.home.com>

How can the backspace charter in xterm be changed.  In gnome-terminal there's
an option to swap backspace and delete and this meets my needs as far as
using the correct backspace character.  But I prefer to use xterm.  thanks...

-- 



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

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


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