From fblack at docucorp.com Thu Jan 2 13:55:57 2003 From: fblack at docucorp.com (Black, Franklin) Date: Mon Aug 2 21:33:07 2004 Subject: [Nh-pm] RE: Nh-pm digest, Vol 1 #21 - 1 msg Message-ID: <60F043336182D3118E930050041891973D73AF@BED1CN02> Happy New Year! How do you use pointers to functions. I want to send the pointer as an argument to a sub routine, dereference it and call the function. From pll at lanminds.com Thu Jan 2 14:18:09 2003 From: pll at lanminds.com (Paul Lussier) Date: Mon Aug 2 21:33:07 2004 Subject: [Nh-pm] RE: Nh-pm digest, Vol 1 #21 - 1 msg In-Reply-To: Message from "Black, Franklin" of "Thu, 02 Jan 2003 13:55:57 CST." <60F043336182D3118E930050041891973D73AF@BED1CN02> References: <60F043336182D3118E930050041891973D73AF@BED1CN02> Message-ID: <20030102201809.4EC30F81A@tater> In a message dated: Thu, 02 Jan 2003 13:55:57 CST "Black, Franklin" said: >Happy New Year! > >How do you use pointers to functions. >I want to send the pointer as an argument to a sub routine, dereference it >and call the function. perldoc perlsub Basically, it's the same as creating pointers to arrays or lists (note, this is referred to in perl parlance as 'a closure'): my $secret_version = '1.001-beta'; my $secret_sub = sub { print $secret_version }; &$secret_sub(); HTH, -- Seeya, Paul -- Key fingerprint = 1660 FECC 5D21 D286 F853 E808 BB07 9239 53F1 28EE It may look like I'm just sitting here doing nothing, but I'm really actively waiting for all my problems to go away. If you're not having fun, you're not doing it right! From kclark at CetaceanNetworks.com Thu Jan 2 14:27:22 2003 From: kclark at CetaceanNetworks.com (Kevin D. Clark) Date: Mon Aug 2 21:33:07 2004 Subject: [Nh-pm] RE: Nh-pm digest, Vol 1 #21 - 1 msg In-Reply-To: <60F043336182D3118E930050041891973D73AF@BED1CN02> ("Black, Franklin"'s message of "Thu, 2 Jan 2003 13:55:57 -0600") References: <60F043336182D3118E930050041891973D73AF@BED1CN02> Message-ID: <3ufzsb8fh1.fsf@koan.cetaceannetworks.com> "Black, Franklin" writes: > How do you use pointers to functions. > I want to send the pointer as an argument to a sub routine, dereference it > and call > the function. Try something like this: #!/bin/perl sub foo { print "foo\n" } sub bar { my $func = shift; &$func } bar(\&foo); Regards, --kevin -- ``It's a bivouac, man. They sleep here.'' - Perfect Tommy From numberwhun at attbi.com Thu Jan 16 10:29:25 2003 From: numberwhun at attbi.com (Jefferson Kirkland) Date: Mon Aug 2 21:33:07 2004 Subject: [Nh-pm] Mod-Perl and Apache Message-ID: <5.2.0.9.0.20030116112846.00b732f0@mail.attbi.com> Does anyone know if the support for mod-perl is beter now than when Apache 2.0 was released, and how good is it? Regards, Jeff Kirkland From pll at lanminds.com Thu Jan 16 11:10:19 2003 From: pll at lanminds.com (Paul Lussier) Date: Mon Aug 2 21:33:07 2004 Subject: [Nh-pm] Mod-Perl and Apache In-Reply-To: Message from Jefferson Kirkland of "Thu, 16 Jan 2003 11:29:25 EST." <5.2.0.9.0.20030116112846.00b732f0@mail.attbi.com> References: <5.2.0.9.0.20030116112846.00b732f0@mail.attbi.com> Message-ID: <20030116171019.A5E78F82A@tater> In a message dated: Thu, 16 Jan 2003 11:29:25 EST Jefferson Kirkland said: >Does anyone know if the support for mod-perl is beter now than when Apache >2.0 was released, and how good is it? AFAIK, and you should check this on the Apache web site, mod_perl is still not well supported under Apache 2.0. Sites requiring mod_perl are encouraged to stay with 1.x for the time being. -- Seeya, Paul -- Key fingerprint = 1660 FECC 5D21 D286 F853 E808 BB07 9239 53F1 28EE It may look like I'm just sitting here doing nothing, but I'm really actively waiting for all my problems to go away. If you're not having fun, you're not doing it right! From numberwhun at attbi.com Thu Jan 16 15:55:46 2003 From: numberwhun at attbi.com (Jefferson Kirkland) Date: Mon Aug 2 21:33:07 2004 Subject: [Nh-pm] Mod-Perl and Apache In-Reply-To: <20030116171019.A5E78F82A@tater> References: <5.2.0.9.0.20030116112846.00b732f0@mail.attbi.com> <5.2.0.9.0.20030116112846.00b732f0@mail.attbi.com> Message-ID: <5.2.0.9.0.20030116165500.00b57768@mail.attbi.com> That's cool Paul, thanks for the information. I was being lazy and didn't have the time to surf to their site. I figured I would ask the group quick. Jeff At 12:10 PM 1/16/2003 -0500, Paul Lussier wrote: >In a message dated: Thu, 16 Jan 2003 11:29:25 EST >Jefferson Kirkland said: > > >Does anyone know if the support for mod-perl is beter now than when Apache > >2.0 was released, and how good is it? > >AFAIK, and you should check this on the Apache web site, mod_perl is >still not well supported under Apache 2.0. Sites requiring mod_perl >are encouraged to stay with 1.x for the time being. >-- > >Seeya, >Paul >-- >Key fingerprint = 1660 FECC 5D21 D286 F853 E808 BB07 9239 53F1 28EE > > It may look like I'm just sitting here doing nothing, > but I'm really actively waiting for all my problems to go away. > > If you're not having fun, you're not doing it right! From fblack at docucorp.com Fri Jan 17 16:03:02 2003 From: fblack at docucorp.com (Black, Franklin) Date: Mon Aug 2 21:33:07 2004 Subject: [Nh-pm] RE: Nh-pm digest, Vol 1 #24 - 1 msg Message-ID: <60F043336182D3118E930050041891973D73DB@BED1CN02> Does anyone know where I can get to routines to call perl from C? From rgacote at AppropriateSolutions.com Fri Jan 17 17:16:23 2003 From: rgacote at AppropriateSolutions.com (Ray Cote) Date: Mon Aug 2 21:33:07 2004 Subject: [Nh-pm] Re: Perl from C In-Reply-To: <60F043336182D3118E930050041891973D73DB@BED1CN02> References: <60F043336182D3118E930050041891973D73DB@BED1CN02> Message-ID: Google for "perlembed". -- --------------------------------------------------------- Raymond Cote Appropriate Solutions, Inc. www.AppropriateSolutions.com rgacote(at)AppropriateSolutions.com 603.924.6079(v) POB 458, Peterborough, NH 03458 603.924.8668(f) From pll at lanminds.com Tue Jan 28 15:15:23 2003 From: pll at lanminds.com (pll@lanminds.com) Date: Mon Aug 2 21:33:07 2004 Subject: [Nh-pm] Help with Exporter? Message-ID: <20030128211523.D467BF60C@tater> Hi all, Anyone familiar with creating modules? I've got a module I've created, which currently exports a single function. This works just fine. However, I now want to export certain variables set within the module so I can use them within the program calling the module, and that's not working. I'm quite sure I don't adequately grok the Exporter function :) Here's what I have so far: package Foo; use 5.008; use strict; use warnings; use CGI qw/:all/; require Exporter; our @ISA = qw(Exporter); our %EXPORT_TAGS = \ ('all'=> [qw(&print_header_table $TEXT $BGCOLOR $LINK $VLINK $ALINK)]); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw(print_header_table $TEXT $BGCOLOR $LINK $VLINK $ALINK); our $VERSION = '0.02'; # WWW vars my ($TEXT) = "#FFFFBB"; my ($BGCOLOR) = "#000000"; my ($LINK) = "#FFFFBB"; my ($VLINK) = "#00bbff"; my ($ALINK) = "#FF0000"; sub print_header_table { # a bunch of working code } The call to print_header_table() from my perl program works just fine. Yet I can't seem to access the scalars (listed under the section # WWW Vars). Any ideas? Thanks, -- Seeya, Paul -- Key fingerprint = 1660 FECC 5D21 D286 F853 E808 BB07 9239 53F1 28EE It may look like I'm just sitting here doing nothing, but I'm really actively waiting for all my problems to go away. If you're not having fun, you're not doing it right! From kclark at CetaceanNetworks.com Tue Jan 28 16:23:00 2003 From: kclark at CetaceanNetworks.com (Kevin D. Clark) Date: Mon Aug 2 21:33:07 2004 Subject: [Nh-pm] Help with Exporter? In-Reply-To: <20030128211523.D467BF60C@tater> References: <20030128211523.D467BF60C@tater> Message-ID: <69k7gork1n.fsf@koan.cetaceannetworks.com> What does your "use Foo" line look like, exactly? Can you show us how you are invoking the Foo::print_header_table() method and accessing $Foo::Text (etc.). What is the output when you include BEGIN { $Exporter::Verbose=1 } and then try to use the Foo module's scalars in your code? Regards, --kevin -- "...colder than a well digger's ass..." -- Tom Waits From pll at lanminds.com Wed Jan 29 08:32:41 2003 From: pll at lanminds.com (Paul Lussier) Date: Mon Aug 2 21:33:07 2004 Subject: [Nh-pm] Help with Exporter? In-Reply-To: Message from kclark@cetaceannetworks.com (Kevin D. Clark) of "28 Jan 2003 17:23:00 EST." <69k7gork1n.fsf@koan.cetaceannetworks.com> References: <20030128211523.D467BF60C@tater> <69k7gork1n.fsf@koan.cetaceannetworks.com> Message-ID: <20030129143241.99C3EF60C@tater> In a message dated: 28 Jan 2003 17:23:00 EST Kevin D. Clark said: >What does your "use Foo" line look like, exactly? Originally it was: use Foo; But when I added the scalars, I changed that to: use Foo qw/:all/; >Can you show us how you are invoking the Foo::print_header_table() >method and accessing $Foo::Text (etc.). Well for Foo::print_header_table(), I was just calling the function directly, like: print_header_table(); >What is the output when you include > > BEGIN { $Exporter::Verbose=1 } > >and then try to use the Foo module's scalars in your code? Don't know, however, after looking at how Getopt::Long does it, and slightly modifying my code to match that, I also noticed that the vars I was trying to export were all my'd in the module. Un-my'ing them suddenly popped them into existence in my program. My module now looks like this: package Foo; use 5.008; use strict; use warnings; use CGI qw/:all/; require Exporter; use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); our @ISA = qw(Exporter); %EXPORT_TAGS = \ ('all'=>[ qw(&print_header_table $TEXT $BGCOLOR $LINK $VLINK $ALINK)]); BEGIN { # Init immediately so their contents can be used # in the 'use vars' below. @EXPORT = qw(&print_header_table $TEXT $BGCOLOR $LINK $VLINK $ALINK); @EXPORT_OK = qw (); } our $VERSION = '0.02'; # User visible variables. use vars @EXPORT, @EXPORT_OK; # WWW vars $TEXT = "#FFFFBB"; $BGCOLOR = "#000000"; $LINK = "#FFFFBB"; $VLINK = "#00bbff"; $ALINK = "#FF0000"; sub print_header_table { # a bunch of code here } So, things *seem* to be working okay now. Though I still don't completey grok the whole Exporter thing, nor completely understand why the Getopt::Long module does what it does. Thanks! -- Seeya, Paul -- Key fingerprint = 1660 FECC 5D21 D286 F853 E808 BB07 9239 53F1 28EE It may look like I'm just sitting here doing nothing, but I'm really actively waiting for all my problems to go away. If you're not having fun, you're not doing it right! From kclark at CetaceanNetworks.com Wed Jan 29 08:35:35 2003 From: kclark at CetaceanNetworks.com (Kevin D. Clark) Date: Mon Aug 2 21:33:07 2004 Subject: [Nh-pm] Help with Exporter? In-Reply-To: <20030128211523.D467BF60C@tater> References: <20030128211523.D467BF60C@tater> Message-ID: pll@lanminds.com writes: [...] > Here's what I have so far: > > package Foo; > use 5.008; > use strict; > use warnings; > use CGI qw/:all/; > > require Exporter; > > our @ISA = qw(Exporter); > > our %EXPORT_TAGS = \ > ('all'=> [qw(&print_header_table $TEXT $BGCOLOR $LINK $VLINK $ALINK)]); I think that you want to get rid of that backslash (two lines above). > our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); > > our @EXPORT = qw(print_header_table $TEXT $BGCOLOR $LINK $VLINK $ALINK); > > our $VERSION = '0.02'; > > # WWW vars > my ($TEXT) = "#FFFFBB"; > my ($BGCOLOR) = "#000000"; > my ($LINK) = "#FFFFBB"; > my ($VLINK) = "#00bbff"; > my ($ALINK) = "#FF0000"; Use "our" instead of "my" here. > sub print_header_table { > > # a bunch of working code > > } Regards, --kevin -- Kevin D. Clark / Cetacean Networks / Portsmouth, N.H. (USA) cetaceannetworks.com!kclark (GnuPG ID: B280F24E) alumni.unh.edu!kdc From pll at lanminds.com Wed Jan 29 08:48:22 2003 From: pll at lanminds.com (Paul Lussier) Date: Mon Aug 2 21:33:07 2004 Subject: [Nh-pm] Help with Exporter? In-Reply-To: Message from kclark@cetaceannetworks.com (Kevin D. Clark) of "29 Jan 2003 09:35:35 EST." References: <20030128211523.D467BF60C@tater> Message-ID: <20030129144822.EFC4CF60C@tater> In a message dated: 29 Jan 2003 09:35:35 EST Kevin D. Clark said: >I think that you want to get rid of that backslash (two lines above). That was there strictly for the sake of the e-mail, it's not in the real code. >> # WWW vars >> my ($TEXT) = "#FFFFBB"; >> my ($BGCOLOR) = "#000000"; >> my ($LINK) = "#FFFFBB"; >> my ($VLINK) = "#00bbff"; >> my ($ALINK) = "#FF0000"; > >Use "our" instead of "my" here. Doh! cut'n'pasted from the wrong file! As I said, I un-my'ed those so there's nothing there now. I'll go RTFM on the our keyword! Thanks, -- Seeya, Paul -- Key fingerprint = 1660 FECC 5D21 D286 F853 E808 BB07 9239 53F1 28EE It may look like I'm just sitting here doing nothing, but I'm really actively waiting for all my problems to go away. If you're not having fun, you're not doing it right!