From pm.org at daveola.com Sun Jul 1 03:47:34 2007 From: pm.org at daveola.com (David Ljung Madison) Date: Sun, 01 Jul 2007 03:47:34 -0700 Subject: [sf-perl] Calling perl from C and back again. Message-ID: I'm starting to answer my own question.. I've learned about the newXS() call that registers functions so Perl can use them. Evidently xsubpp creates code, including a "boot_main" that does this registration (via newXSproto), but I'm guessing the boot_main is somehow naturally called when you start from Perl (i.e., when you write C code that you're calling from Perl). I'm doing it somewhat backwards, from C->Perl->C, so it seems I have to call newXS myself. I may be wrong, I'm certainly not an expert on this, but at least I have the code doing the round trip from C to Perl and back again. I can post the code if anyone is interested - but first to figure out how to deal with the Perl->C args when I'm not using the XS tools to do it for me... Dave --------------------------------------------------------------------------- Dave Ljung Madison http://GetDave.com/ 415 341-5555 ------------ "Preferred over shiny round objects 2-to-1" ------------------ From friedman at highwire.stanford.edu Sun Jul 1 10:04:59 2007 From: friedman at highwire.stanford.edu (Michael Friedman) Date: Sun, 1 Jul 2007 10:04:59 -0700 Subject: [sf-perl] Calling perl from C and back again. In-Reply-To: References: Message-ID: <47985ED7-D241-41E4-8D63-04356293D405@highwire.stanford.edu> I hesitate to mention this, since I have no experience with it, but have you looked at Inline::C? Supposedly the Inline::* modules make a lot of this inter-language communication easier. -- Mike On Jul 1, 2007, at 3:47 AM, David Ljung Madison wrote: > I'm starting to answer my own question.. > > I've learned about the newXS() call that registers functions > so Perl can use them. > > Evidently xsubpp creates code, including a "boot_main" that > does this registration (via newXSproto), but I'm guessing the > boot_main is somehow naturally called when you start from Perl (i.e., > when you write C code that you're calling from Perl). I'm doing it > somewhat backwards, from C->Perl->C, so it seems I have to call newXS > myself. I may be wrong, I'm certainly not an expert on this, but > at least I have the code doing the round trip from C to Perl and > back again. I can post the code if anyone is interested - but > first to figure out how to deal with the Perl->C args when I'm > not using the XS tools to do it for me... > > Dave > > ---------------------------------------------------------------------- > ----- > Dave Ljung Madison http://GetDave.com/ 415 > 341-5555 > ------------ "Preferred over shiny round objects 2-to-1" > ------------------ > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm at pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm --------------------------------------------------------------------- Michael Friedman HighWire Press Phone: 650-725-1974 Stanford University FAX: 270-721-8034 --------------------------------------------------------------------- From Peter.Loo at source.wolterskluwer.com Thu Jul 5 15:33:59 2007 From: Peter.Loo at source.wolterskluwer.com (Loo, Peter # PHX) Date: Thu, 5 Jul 2007 15:33:59 -0700 Subject: [sf-perl] Setting LD_LIBRARY_PATH Message-ID: <8E3D502A002DA04FADBDED4CB4D94D3A03AE897F@phxmail02.phx.ndchealth.com> Hello All, Unix admins here are not happy about updating the .profile of the production account to add two additional entries to LD_LIBRARY_PATH environment variable. So I am having to figure out an alternative solution in setting this environment dynamically during program run. I have tried setting it at the beginning of the program and I have tried putting it in the BEGIN block with no luck. I have searched the Internet and found a lot of discussion but did not find any solution. According to Tim Bunce's posting, LD_LIBRARY_PATH must be set before the process starts. http://groups.google.com/group/perl.dbi.users/browse_thread/thread/8de20 3f9ee4cb9a/579d2732c9712f1d?lnk=st&q=Perl+LD_LIbrary_path&rnum=7&hl=en#5 79d2732c9712f1d Shall I just go Tim's advise and have the admins change the .profile or does someone have a solution to help with this problem? Thanking you in advance. Peter -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20070705/8505d61e/attachment.html From extasia at extasia.org Thu Jul 5 15:47:52 2007 From: extasia at extasia.org (David Alban) Date: Thu, 5 Jul 2007 15:47:52 -0700 Subject: [sf-perl] Setting LD_LIBRARY_PATH In-Reply-To: <8E3D502A002DA04FADBDED4CB4D94D3A03AE897F@phxmail02.phx.ndchealth.com> References: <8E3D502A002DA04FADBDED4CB4D94D3A03AE897F@phxmail02.phx.ndchealth.com> Message-ID: <4c714a9c0707051547t1d1d0baerac70b21949f29911@mail.gmail.com> How about writing a wrapper around your program. The wrapper sets LD_LIBRARY_PATH (or for that matter, any environment variable you like), and then calls your program with all arguments it got? On 7/5/07, Loo, Peter # PHX wrote: > Unix admins here are not happy about updating the .profile of the production > account to add two additional entries to LD_LIBRARY_PATH environment > variable. So I am having to figure out an alternative solution in setting > this environment dynamically during program run. I have tried setting it at > the beginning of the program and I have tried putting it in the BEGIN block > with no luck. I have searched the Internet and found a lot of discussion > but did not find any solution. > > According to Tim Bunce's posting, LD_LIBRARY_PATH must be set before the > process starts. > > http://groups.google.com/group/perl.dbi.users/browse_thread/thread/8de203f9ee4cb9a/579d2732c9712f1d?lnk=st&q=Perl+LD_LIbrary_path&rnum=7&hl=en#579d2732c9712f1d > > Shall I just go Tim's advise and have the admins change the .profile or does > someone have a solution to help with this problem? -- Live in a world of your own, but always welcome visitors. From li at senweb.net Thu Jul 5 19:22:03 2007 From: li at senweb.net (Li Sen) Date: Thu, 05 Jul 2007 19:22:03 -0700 Subject: [sf-perl] Setting LD_LIBRARY_PATH In-Reply-To: <4c714a9c0707051547t1d1d0baerac70b21949f29911@mail.gmail.com> References: <8E3D502A002DA04FADBDED4CB4D94D3A03AE897F@phxmail02.phx.ndchealth.com> <4c714a9c0707051547t1d1d0baerac70b21949f29911@mail.gmail.com> Message-ID: <468DA74B.1040408@senweb.net> David Alban wrote: > How about writing a wrapper around your program. The wrapper sets > LD_LIBRARY_PATH (or for that matter, any environment variable you > like), and then calls your program with all arguments it got? > > On 7/5/07, Loo, Peter # PHX wrote: > >> Unix admins here are not happy about updating the .profile of the production >> account to add two additional entries to LD_LIBRARY_PATH environment >> variable. So I am having to figure out an alternative solution in setting >> this environment dynamically during program run. I have tried setting it at >> the beginning of the program and I have tried putting it in the BEGIN block >> with no luck. I have searched the Internet and found a lot of discussion >> but did not find any solution. >> >> According to Tim Bunce's posting, LD_LIBRARY_PATH must be set before the >> process starts. >> >> http://groups.google.com/group/perl.dbi.users/browse_thread/thread/8de203f9ee4cb9a/579d2732c9712f1d?lnk=st&q=Perl+LD_LIbrary_path&rnum=7&hl=en#579d2732c9712f1d >> >> Shall I just go Tim's advise and have the admins change the .profile or does >> someone have a solution to help with this problem? >> > > Or, you can add try this: BEGIN { my $additonal_path = '/whatever/path/you/want'; if (ENV{LD_LIBRARY_PATH} !~ m/$additonal_path/) { $ENV{LD_LIBRARY_PATH} .= $additonal_path; exec $0, @ARGV; exit; } } to re-invoke your script with the additional path(s) set. Regards, Li From quinn at fairpath.com Fri Jul 6 09:57:43 2007 From: quinn at fairpath.com (Quinn Weaver) Date: Fri, 6 Jul 2007 09:57:43 -0700 Subject: [sf-perl] Setting LD_LIBRARY_PATH In-Reply-To: <8E3D502A002DA04FADBDED4CB4D94D3A03AE897F@phxmail02.phx.ndchealth.com> References: <8E3D502A002DA04FADBDED4CB4D94D3A03AE897F@phxmail02.phx.ndchealth.com> Message-ID: <20070706165743.GB3693@fu.funkspiel.org> On Thu, Jul 05, 2007 at 03:33:59PM -0700, Loo, Peter # PHX wrote: > Hello All, > > Unix admins here are not happy about updating the .profile of the > production account to add two additional entries to LD_LIBRARY_PATH > environment variable. So I am having to figure out an alternative > solution in setting this environment dynamically during program run. Hi, Peter, I think your Unix admins are being unreasonable--this sounds like a global setting for all Perl programs, which is exactly the kind of thing that should go in .profile. However, if you can't get them to cooperate, I think David Alban has the right tack: write a wrapper. If you so something like this, you can reuse the same wrapper for multiple programs: #!/bin/sh LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/my/path export LD_LIBRARY_PATH exec $@ Call that perlwrap. Then you can do /path/to/perlwrap /path/to/my_perl_program.pl [perl_prog_arguments] For any Perl program you like. HTH, -- Quinn Weaver, independent contractor | President, San Francisco Perl Mongers http://fairpath.com/quinn/resume/ | http://sf.pm.org/ 510-520-5217 From sphink at gmail.com Fri Jul 6 10:12:40 2007 From: sphink at gmail.com (Steve Fink) Date: Fri, 6 Jul 2007 10:12:40 -0700 Subject: [sf-perl] Setting LD_LIBRARY_PATH In-Reply-To: <20070706165743.GB3693@fu.funkspiel.org> References: <8E3D502A002DA04FADBDED4CB4D94D3A03AE897F@phxmail02.phx.ndchealth.com> <20070706165743.GB3693@fu.funkspiel.org> Message-ID: <7d7f2e8c0707061012y33b9e5abq5b00e36a06db4f69@mail.gmail.com> On 7/6/07, Quinn Weaver wrote: > On Thu, Jul 05, 2007 at 03:33:59PM -0700, Loo, Peter # PHX wrote: > > Hello All, > > > > Unix admins here are not happy about updating the .profile of the > > production account to add two additional entries to LD_LIBRARY_PATH > > environment variable. So I am having to figure out an alternative > > solution in setting this environment dynamically during program run. > > Hi, Peter, > > I think your Unix admins are being unreasonable--this sounds like a global > setting for all Perl programs, which is exactly the kind of thing > that should go in .profile. I think I'd lean towards siding with the admins -- yes, it's a global setting, but: 1. .profile should be used sparingly, because it's far too easy to dump things in there and tweak how stuff works (eg overriding binaries by putting something in the front of $PATH), but then having things mysteriously behave differently when you're trying to replicate your system on another box. Modifying it becomes part of the installation of a dozen different packages, and an easy-to-forget and easy-to-screw-up part as well (if you install twice, do you update it twice? If two packages both modify LD_LIBRARY_PATH, will they overwrite each other's changes? etc.) 2. LD_LIBRARY_PATH itself is a nasty hacky thing to depend on. I'm very glad it exists, but I try to only use it when testing uninstalled things. Because it's a nasty hacky thing, it also tends to get stripped out of the environment to avoid security problems, eg when running under sudo or as a setuid program. I think you want to make a system-wide change as specific to what you're trying to achieve as possible. In this case, then if you're on a Linux box then I think that would mean adding your paths to /etc/ld.so.conf (and rerunning ldconfig? not sure). I could have just said that in the first place without getting pedantic, I suppose. The even better-er option would be to install whatever it is within a lib dir already in the library search path, but I recognize that there all kinds of reasons why that may not work out for your particular case. From Peter.Loo at source.wolterskluwer.com Fri Jul 6 10:15:18 2007 From: Peter.Loo at source.wolterskluwer.com (Loo, Peter # PHX) Date: Fri, 6 Jul 2007 10:15:18 -0700 Subject: [sf-perl] Setting LD_LIBRARY_PATH In-Reply-To: <20070706165743.GB3693@fu.funkspiel.org> References: <8E3D502A002DA04FADBDED4CB4D94D3A03AE897F@phxmail02.phx.ndchealth.com> <20070706165743.GB3693@fu.funkspiel.org> Message-ID: <8E3D502A002DA04FADBDED4CB4D94D3A03AE8C54@phxmail02.phx.ndchealth.com> Thanks everyone for your inputs. My director has convinced the admins to add to the .profile. I thought of the idea of having a shell wrapper setting the environment before spawning off the Perl program, however, the Perl program itself is a wrapper that performs many different tasks according to a list of parameters that I dynamically pass to it. At any rate, the issue is resolved with the entries into the .profile. I do have one question though. If I was to have a Perl program that sets $ENV{LD_LIBRARY_PATH} = 'some value'; then spawning of another Perl program from within it using system(), will the spawned Perl program inherit the set environment variable? Thanks. Peter -----Original Message----- From: sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.org [mailto:sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.or g] On Behalf Of Quinn Weaver Sent: Friday, July 06, 2007 9:58 AM To: San Francisco Perl Mongers User Group Subject: Re: [sf-perl] Setting LD_LIBRARY_PATH On Thu, Jul 05, 2007 at 03:33:59PM -0700, Loo, Peter # PHX wrote: > Hello All, > > Unix admins here are not happy about updating the .profile of the > production account to add two additional entries to LD_LIBRARY_PATH > environment variable. So I am having to figure out an alternative > solution in setting this environment dynamically during program run. Hi, Peter, I think your Unix admins are being unreasonable--this sounds like a global setting for all Perl programs, which is exactly the kind of thing that should go in .profile. However, if you can't get them to cooperate, I think David Alban has the right tack: write a wrapper. If you so something like this, you can reuse the same wrapper for multiple programs: #!/bin/sh LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/my/path export LD_LIBRARY_PATH exec $@ Call that perlwrap. Then you can do /path/to/perlwrap /path/to/my_perl_program.pl [perl_prog_arguments] For any Perl program you like. HTH, -- Quinn Weaver, independent contractor | President, San Francisco Perl Mongers http://fairpath.com/quinn/resume/ | http://sf.pm.org/ 510-520-5217 _______________________________________________ SanFrancisco-pm mailing list SanFrancisco-pm at pm.org http://mail.pm.org/mailman/listinfo/sanfrancisco-pm This E-mail message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply E-mail, and destroy all copies of the original message. From doom at kzsu.stanford.edu Fri Jul 6 12:10:17 2007 From: doom at kzsu.stanford.edu (Joe Brenner) Date: Fri, 06 Jul 2007 12:10:17 -0700 Subject: [sf-perl] Setting LD_LIBRARY_PATH In-Reply-To: <8E3D502A002DA04FADBDED4CB4D94D3A03AE8C54@phxmail02.phx.ndchealth.com> References: <8E3D502A002DA04FADBDED4CB4D94D3A03AE897F@phxmail02.phx.ndchealth.com> <20070706165743.GB3693@fu.funkspiel.org> <8E3D502A002DA04FADBDED4CB4D94D3A03AE8C54@phxmail02.phx.ndchealth.com> Message-ID: <200707061910.l66JAHnq058473@kzsu.stanford.edu> Loo, Peter # PHX wrote: > I do have one question though. If I was to have a Perl program that > sets $ENV{LD_LIBRARY_PATH} = 'some value'; then spawning of another Perl > program from within it using system(), will the spawned Perl program > inherit the set environment variable? The second program inherits the environment settings of the first. It's easy enough to check: === #!/usr/bin/perl # perl_env_invoke_1 use warnings; use strict; $|=1; $ENV{ NASTY_HACK } = 'Hello, whirled!'; system( "perl_env_invoke_2" ); === #!/usr/bin/perl # perl_env_invoke_2 use warnings; use strict; $|=1; if( $ENV{ NASTY_HACK } ) { print $ENV{ NASTY_HACK }, "\n"; } else { print "envar NASTY_HACK not found\n"; } === perl_env_invoke_2 envar NASTY_HACK not found perl_env_invoke_1 Hello, whirled! From quinn at fairpath.com Thu Jul 12 09:20:19 2007 From: quinn at fairpath.com (Quinn Weaver) Date: Thu, 12 Jul 2007 09:20:19 -0700 Subject: [sf-perl] Wednesday, July 25: Beer and Scripting SIG Message-ID: <20070712162019.GA63353@fu.funkspiel.org> July is a social month, so come on down to the Beer and Scripting SIG to rub elbows with other Perl, Python, Ruby, and LISP* hackers. http://www.cfcl.com/rdm/bass/ Hope to see you there. PS: August will also be a social meeting. We'll resume structured presentations in the fall. * Meeting may not contain actual LISP hackers. Emacs LISP may not be actual LISP. -- Quinn Weaver, independent contractor | President, San Francisco Perl Mongers http://fairpath.com/quinn/resume/ | http://sf.pm.org/ 510-520-5217 From rdm at cfcl.com Fri Jul 13 17:29:11 2007 From: rdm at cfcl.com (Rich Morin) Date: Fri, 13 Jul 2007 17:29:11 -0700 Subject: [sf-perl] 2 GB IOMEGA JAZ drive? Message-ID: I'm trying to get some files from a friend's 2 GB Jaz disks and the drive he has can't read them! Might you have one I could borrow? -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From extasia at extasia.org Fri Jul 13 18:27:23 2007 From: extasia at extasia.org (David Alban) Date: Fri, 13 Jul 2007 18:27:23 -0700 Subject: [sf-perl] 2 GB IOMEGA JAZ drive? In-Reply-To: References: Message-ID: <4c714a9c0707131827x32234d0ftae16642aa9099f9f@mail.gmail.com> you might want to pose this question also on the baylisa list. On 7/13/07, Rich Morin wrote: > I'm trying to get some files from a friend's 2 GB Jaz disks > and the drive he has can't read them! Might you have one I > could borrow? -- Live in a world of your own, but always welcome visitors. From quinn at fairpath.com Fri Jul 13 18:44:03 2007 From: quinn at fairpath.com (Quinn Weaver) Date: Fri, 13 Jul 2007 18:44:03 -0700 Subject: [sf-perl] 2 GB IOMEGA JAZ drive? In-Reply-To: References: Message-ID: <20070714014403.GA75643@fu.funkspiel.org> On Fri, Jul 13, 2007 at 05:29:11PM -0700, Rich Morin wrote: > I'm trying to get some files from a friend's 2 GB Jaz disks > and the drive he has can't read them! Might you have one I > could borrow? Hi, Rich, I have an old SCSI Jaz drive. I haven't used it in years, but it probably still works. Mail me off-list and let me know when you need it, and I'll arrange to get it to you. -- Quinn Weaver, independent contractor | President, San Francisco Perl Mongers http://fairpath.com/quinn/resume/ | http://sf.pm.org/ 510-520-5217 From extasia at extasia.org Mon Jul 23 14:16:45 2007 From: extasia at extasia.org (David Alban) Date: Mon, 23 Jul 2007 14:16:45 -0700 Subject: [sf-perl] Perl saves the day Message-ID: <4c714a9c0707231416o4043d308ke3cc56b6b912870e@mail.gmail.com> http://xkcd.com/208/ [worksafe] -- Live in a world of your own, but always welcome visitors. From bh1 at light42.com Mon Jul 23 14:38:56 2007 From: bh1 at light42.com (Brian Hamlin) Date: Mon, 23 Jul 2007 14:38:56 -0700 Subject: [sf-perl] Wednesday, July 25: Beer and Scripting SIG In-Reply-To: <20070712162019.GA63353@fu.funkspiel.org> References: <20070712162019.GA63353@fu.funkspiel.org> Message-ID: <1D5D9AC3-3965-11DC-A0F4-000A277A733C@light42.com> Hi QW- I am in Portland..So I will miss the social, but I am still up for some collaboration at LinuxWorld, just let me know your preference best regards -Brian On Jul 12, 2007, at 9:20 AM, Quinn Weaver wrote: > July is a social month, so come on down to the Beer and Scripting SIG > to rub > elbows with other Perl, Python, Ruby, and LISP* hackers. > http://www.cfcl.com/rdm/bass/ > > Hope to see you there. > > PS: August will also be a social meeting. We'll resume structured > presentations in the fall. > > * Meeting may not contain actual LISP hackers. Emacs LISP may not be > actual LISP. > > -- > Quinn Weaver, independent contractor | President, San Francisco Perl > Mongers > http://fairpath.com/quinn/resume/ | http://sf.pm.org/ > 510-520-5217 > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm at pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm From rdm at cfcl.com Tue Jul 24 09:19:16 2007 From: rdm at cfcl.com (Rich Morin) Date: Tue, 24 Jul 2007 09:19:16 -0700 Subject: [sf-perl] BASS Meeting (SF), Wed. July 25 Message-ID: The Beer and Scripting SIG rides again! If you'd like to eat good Italian food, chat with other local scripters, and possibly take a look at laptop-demoed scripting hacks, this is the place to do it! For your convenience, here are the critical details: Date: Wednesday, July 25, 2007 (4th. Wed.) Time: 8:00 pm Place: Pasquales Pizzeria 701 Irving St. (At 8th. Ave.) San Francisco, California, USA 415/661-2140 See the BASS web page for more information: http://cfcl.com/rdm/bass/ -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From josh at agliodbs.com Mon Jul 30 12:56:50 2007 From: josh at agliodbs.com (Josh Berkus) Date: Mon, 30 Jul 2007 12:56:50 -0700 Subject: [sf-perl] LinuxWorldExpo info up Message-ID: <200707301256.50949.josh@agliodbs.com> Quinn, all: http://developer.postgresql.org/index.php/LWESF2007 It's a bit postgresql-centric, but then it is on our wiki. Please forward me names & times for Perlmongers who want to be in the booth. -- --Josh Josh Berkus PostgreSQL @ Sun San Francisco