ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Alexey Tourbin <at@altlinux.ru>
To: devel@altlinux.ru
Subject: [devel] Re: Requires для perl
Date: Wed, 14 Sep 2005 12:14:44 +0400
Message-ID: <20050914081444.GF3290@solemn.turbinal.org> (raw)
In-Reply-To: <200509141149.56948.lav@altlinux.ru>

[-- Attachment #1: Type: text/plain, Size: 1321 bytes --]

On Wed, Sep 14, 2005 at 11:49:56AM +0400, Vitaly Lipatov wrote:
> Может кто-нибудь подскажет -
> в начале программы такие строки:
> 
> #!/usr/bin/perl
> use Gtk2 -init;
> 
> При поиске зависимостей в конце сборки пакета идёт попытка 
> инициализации Gtk2 с соответственно неудачным обращением к 
> $DISPLAY. Вопрос - кто виноват?
>  а) программа (возможно надо просто переписать инициализацию)
>  б) поиск зависимостей
> До выяснения автопоиск я отключил :(

Программа.  Поиск зависимостей не виноват, так как поиск зависимостей
в смысле исполнения кода эквивалентен syntax check.

$ perl -h |grep -e -c
  -c              check syntax only (runs BEGIN and CHECK blocks)
$

use Gtk2 -init; в точности эквивалентно 
BEGIN { require Gtk2; Gtk2::->import(-init); }
(см. perldoc -f use)

То есть если сделать 'perl -c ПРОГРАММА' то будет такое же неудачное
обращение к $DISPLAY, как и при поиске зависимостей.  Исполнять
прикладной код в BEGIN -- по-моему, очень плохая идея.  Код в BEGIN
нужен только для импорта прототипов, перегрузки операторов и загрузки
лексических хинтов $^H (типа use strict).

Лучше вставить Gtk2->init в место фактической инициализации гуя у
программы, или же, если нет желания разбираться, где находится это
скорбное место, написать use Gtk2; INIT { Gtk2->init; }.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-09-14  8:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-14  7:49 [devel] " Vitaly Lipatov
2005-09-14  8:14 ` Alexey Tourbin [this message]
2005-09-14 10:03   ` [devel] " Alexey Tourbin
2005-09-14 23:25     ` Vitaly Lipatov
2005-09-15  4:16       ` Alexey Tourbin
2005-09-15  6:24         ` Vitaly Ostanin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050914081444.GF3290@solemn.turbinal.org \
    --to=at@altlinux.ru \
    --cc=devel@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git